KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > axi > Element


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.axi;
20
21 import java.util.List JavaDoc;
22 import org.netbeans.modules.xml.axi.datatype.Datatype;
23 import org.netbeans.modules.xml.axi.visitor.AXIVisitor;
24 import org.netbeans.modules.xml.schema.model.Form;
25 import org.netbeans.modules.xml.schema.model.SchemaComponent;
26
27 /**
28  * Represents an Element in XML Schema.
29  *
30  * @author Samaresh (Samaresh.Panda@Sun.Com)
31  */

32 public abstract class Element extends AbstractElement implements AXIType {
33     
34     /**
35      * Creates a new instance of Element
36      */

37     public Element(AXIModel model) {
38         super(model);
39     }
40     
41     /**
42      * Creates a new instance of Element
43      */

44     public Element(AXIModel model, SchemaComponent schemaComponent) {
45         super(model, schemaComponent);
46     }
47     
48     /**
49      * Creates a proxy for this Element.
50      */

51     public Element(AXIModel model, AXIComponent sharedComponent) {
52         super(model, sharedComponent);
53     }
54         
55     /**
56      * Allows a visitor to visit this Element.
57      */

58     public void accept(AXIVisitor visitor) {
59         visitor.visit(this);
60     }
61     
62     /**
63      * Returns true if it is a reference, false otherwise.
64      */

65     public abstract boolean isReference();
66             
67     /**
68      * Returns the referent if isReference() is true.
69      */

70     public abstract Element getReferent();
71     
72     /**
73      * Returns abstract property.
74      */

75     public abstract boolean getAbstract();
76     
77     /**
78      * Sets the abstract property.
79      */

80     public abstract void setAbstract(boolean value);
81     
82     /**
83      * Returns the block.
84      */

85     public abstract String JavaDoc getBlock();
86         
87     /**
88      * Sets the block property.
89      */

90     public abstract void setBlock(String JavaDoc value);
91     
92     /**
93      * Returns the final property.
94      */

95     public abstract String JavaDoc getFinal();
96     
97     /**
98      * Sets the final property.
99      */

100     public abstract void setFinal(String JavaDoc value);
101     
102     /**
103      * Returns the fixed value.
104      */

105     public abstract String JavaDoc getFixed();
106     
107     /**
108      * Sets the fixed value.
109      */

110     public abstract void setFixed(String JavaDoc value);
111     
112     /**
113      * Returns the default value.
114      */

115     public abstract String JavaDoc getDefault();
116     
117     /**
118      * Sets the default value.
119      */

120     public abstract void setDefault(String JavaDoc value);
121     
122     /**
123      * Returns the form.
124      */

125     public abstract Form getForm();
126     
127     /**
128      * Sets the form.
129      */

130     public abstract void setForm(Form value);
131         
132     /**
133      * Returns the nillable.
134      */

135     public abstract boolean getNillable();
136     
137     /**
138      * Sets the nillable property.
139      */

140     public abstract void setNillable(boolean value);
141
142     /**
143      * used by property editor
144      */

145     public Boolean JavaDoc isNillable() {
146         return Boolean.valueOf(getNillable());
147     }
148     
149     /**
150      * used by property editor
151      */

152     public void setNillable(Boolean JavaDoc nillable) {
153         if(nillable != null)
154             setNillable(nillable.booleanValue());
155     }
156     
157     /**
158      * Returns the complex type of this element, if there is one.
159      * Null for element with simple type or anonymous type.
160      */

161     public abstract AXIType getType();
162     
163     /**
164      * sets the type of this element.
165      */

166     public abstract void setType(AXIType type);
167         
168     /**
169      * String representation of this Element.
170      */

171     public String JavaDoc toString() {
172         return getName();
173     }
174     
175     ////////////////////////////////////////////////////////////////////
176
////////////////////////// member variables ////////////////////////
177
////////////////////////////////////////////////////////////////////
178
protected String JavaDoc finalValue;
179     protected String JavaDoc fixedValue;
180     protected String JavaDoc defaultValue;
181     protected Form form;
182     protected String JavaDoc block;
183     protected boolean isAbstract;
184     protected boolean isNillable;
185     
186     ////////////////////////////////////////////////////////////////////
187
////////////////// Properties for firing events ////////////////////
188
////////////////////////////////////////////////////////////////////
189
public static final String JavaDoc PROP_FINAL = "final"; // NOI18N
190
public static final String JavaDoc PROP_FIXED = "fixed"; // NOI18N
191
public static final String JavaDoc PROP_DEFAULT = "default"; // NOI18N
192
public static final String JavaDoc PROP_FORM = "form"; // NOI18N
193
public static final String JavaDoc PROP_BLOCK = "block"; // NOI18N
194
public static final String JavaDoc PROP_ABSTRACT = "abstract"; // NOI18N
195
public static final String JavaDoc PROP_NILLABLE = "nillable"; // NOI18N
196
public static final String JavaDoc PROP_TYPE = "type"; // NOI18N
197
public static final String JavaDoc PROP_ELEMENT_REF = "elementRef"; // NOI18N
198
}
199
Popular Tags