View Javadoc

1   /*
2    * $Id: XSDNamespaceSuggester.java,v 1.3 2005/02/28 22:39:40 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8    
9   package com.bbn.swede.editor.contentassist;
10  
11  import java.util.ArrayList;
12  import java.util.Iterator;
13  
14  /***
15   * Subclass of DefaultNamespaceSuggester preloaded with all of the
16   * elements of the XMLSchema Datatypes.
17   * 
18   * @author aperezlo
19   */
20  public class XSDNamespaceSuggester extends DefaultNamespaceSuggester
21  {
22  
23     /***
24      * Default constructor.
25      *
26      */
27     public XSDNamespaceSuggester()
28     {
29        super();
30        ArrayList temp = new ArrayList();
31        Iterator i = null;
32        
33        temp.add("string");
34        temp.add("boolean");
35        temp.add("decimal");
36        temp.add("float");
37        temp.add("double");
38        temp.add("duration");
39        temp.add("dateTime");
40        temp.add("time");
41        temp.add("date");
42        temp.add("gYearMonth");
43        temp.add("gYear");
44        temp.add("gMonthDay");
45        temp.add("gDay");
46        temp.add("gMonth");
47        temp.add("hexBinary");
48        temp.add("base64Binary");
49        temp.add("anyURI");
50        temp.add("QName");
51        temp.add("NOTATION");
52        temp.add("normalizedString");
53        temp.add("token");
54        temp.add("language");
55        temp.add("NMTOKEN");
56        temp.add("NMTOKENS");
57        temp.add("Name");
58        temp.add("NCName");
59        temp.add("ID");
60        temp.add("IDREF");
61        temp.add("IDREFS");
62        temp.add("ENTITY");
63        temp.add("ENTITIES");
64        temp.add("integer");
65        temp.add("nonPositiveInteger");
66        temp.add("negativeInteger");
67        temp.add("long");
68        temp.add("int");
69        temp.add("short");
70        temp.add("byte");
71        temp.add("nonNegativeInteger");
72        temp.add("unsignedLong");
73        temp.add("unsignedInt");
74        temp.add("unsignedShort");
75        temp.add("unsignedByte");
76        temp.add("positiveInteger");
77        
78        i = temp.iterator();
79        while(i.hasNext())
80        {
81           _elements.add(new DefaultSuggestionCandidate((String) i.next(), ISuggestionCandidate.CLASS));
82        }
83        
84        _uri = "http://www.w3.org/2001/XMLSchema#";
85     }
86     
87     /***
88      * Indicates whether the suggestor has any completion proposals for the text
89      * typed so far.  This implementation always returns true.
90      * @param alreadyTyped what has already been typed by the user (with any namespaces removed)
91      * @return <code>true</code>
92      * @see com.bbn.swede.editor.contentassist.INamespaceSuggester#hasSuggestions(java.lang.String)
93      */
94     public boolean hasSuggestions(String alreadyTyped) 
95     { 
96        return true; 
97     }
98     
99  }