KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > axi > impl > ElementProxy


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
20
21 package org.netbeans.modules.xml.axi.impl;
22
23 import java.util.List JavaDoc;
24 import org.netbeans.modules.xml.axi.AXIComponent;
25 import org.netbeans.modules.xml.axi.AXIComponent.ComponentType;
26 import org.netbeans.modules.xml.axi.AXIModel;
27 import org.netbeans.modules.xml.axi.AXIType;
28 import org.netbeans.modules.xml.axi.AbstractAttribute;
29 import org.netbeans.modules.xml.axi.AbstractElement;
30 import org.netbeans.modules.xml.axi.Compositor;
31 import org.netbeans.modules.xml.axi.ContentModel;
32 import org.netbeans.modules.xml.axi.Element;
33 import org.netbeans.modules.xml.axi.datatype.Datatype;
34 import org.netbeans.modules.xml.schema.model.Form;
35
36 /**
37  * Proxy element, acts on behalf of an Element.
38  * Delegates all calls to the original element.
39  *
40  * @author Samaresh (Samaresh.Panda@Sun.Com)
41  */

42 public class ElementProxy extends Element implements AXIComponentProxy {
43                 
44     /**
45      * Creates a new instance of ElementProxy
46      */

47     public ElementProxy(AXIModel model, AXIComponent sharedComponent) {
48         super(model, sharedComponent);
49     }
50     
51     /**
52      * Returns the type of this component,
53      * may be local, shared, proxy or reference.
54      * @see ComponentType.
55      */

56     public ComponentType getComponentType() {
57         return ComponentType.PROXY;
58     }
59         
60     /**
61      * Returns true if it is a reference, false otherwise.
62      */

63     public boolean isReference() {
64         return getShared().isReference();
65     }
66     
67     /**
68      * Returns the referent if isReference() is true.
69      */

70     public Element getReferent() {
71         return getShared().getReferent();
72     }
73     
74     /**
75      * Returns the name.
76      */

77     public String JavaDoc getName() {
78         return getShared().getName();
79     }
80     
81     /**
82      * Sets the name.
83      */

84     public void setName(String JavaDoc name) {
85         getShared().setName(name);
86     }
87     
88     /**
89      * Returns the MinOccurs.
90      */

91     public String JavaDoc getMinOccurs() {
92         return getShared().getMinOccurs();
93     }
94     
95     /**
96      * Sets the MinOccurs.
97      */

98     public void setMinOccurs(String JavaDoc value) {
99         getShared().setMinOccurs(value);
100     }
101     
102     /**
103      * Returns the MaxOccurs.
104      */

105     public String JavaDoc getMaxOccurs() {
106         return getShared().getMaxOccurs();
107     }
108     
109     /**
110      * Sets the MaxOccurs.
111      */

112     public void setMaxOccurs(String JavaDoc value) {
113         getShared().setMaxOccurs(value);
114     }
115     
116     /**
117      * Returns abstract property.
118      */

119     public boolean getAbstract() {
120         return getShared().getAbstract();
121     }
122     
123     /**
124      * Sets the abstract property.
125      */

126     public void setAbstract(boolean value) {
127         getShared().setAbstract(value);
128     }
129     
130     /**
131      * Returns the block.
132      */

133     public String JavaDoc getBlock() {
134         return getShared().getBlock();
135     }
136         
137     /**
138      * Sets the block property.
139      */

140     public void setBlock(String JavaDoc value) {
141         getShared().setBlock(value);
142     }
143     
144     /**
145      * Returns the final property.
146      */

147     public String JavaDoc getFinal() {
148         return getShared().getFinal();
149     }
150     
151     /**
152      * Sets the final property.
153      */

154     public void setFinal(String JavaDoc value) {
155         getShared().setFinal(value);
156     }
157     
158     /**
159      * Returns the fixed value.
160      */

161     public String JavaDoc getFixed() {
162         return getShared().getFixed();
163     }
164     
165     /**
166      * Sets the fixed value.
167      */

168     public void setFixed(String JavaDoc value) {
169         getShared().setFixed(value);
170     }
171     
172     /**
173      * Returns the default value.
174      */

175     public String JavaDoc getDefault() {
176         return getShared().getDefault();
177     }
178     
179     /**
180      * Sets the default value.
181      */

182     public void setDefault(String JavaDoc value) {
183         getShared().setDefault(value);
184     }
185     
186     /**
187      * Returns the form.
188      */

189     public Form getForm() {
190         return getShared().getForm();
191     }
192     
193     /**
194      * Sets the form.
195      */

196     public void setForm(Form value) {
197         getShared().setForm(value);
198     }
199         
200     /**
201      * Returns the nillable.
202      */

203     public boolean getNillable() {
204         return getShared().getNillable();
205     }
206     
207     /**
208      * Sets the nillable property.
209      */

210     public void setNillable(boolean value) {
211         getShared().setNillable(value);
212     }
213     
214     /**
215      * Adds a Compositor as its child.
216      * Compositor must always be at the 0th index.
217      */

218     public void addCompositor(Compositor compositor) {
219         getShared().addCompositor(compositor);
220     }
221     
222     /**
223      * Removes a Compositor.
224      */

225     public void removeCompositor(Compositor compositor) {
226         getShared().removeCompositor(compositor);
227     }
228     
229     /**
230      * Adds an Element as its child.
231      * If attributes exist, add the new child before all attributes.
232      * Attributes must always be added at the end of the list.
233      */

234     public void addElement(AbstractElement child) {
235         getShared().addElement(child);
236     }
237     
238     /**
239      * Removes an Element.
240      */

241     public void removeElement(AbstractElement element) {
242         getShared().removeElement(element);
243     }
244     
245     /**
246      * Adds an attribute.
247      */

248     public void addAttribute(AbstractAttribute attribute) {
249         getShared().addAttribute(attribute);
250     }
251     
252     /**
253      * Removes an attribute.
254      */

255     public void removeAttribute(AbstractAttribute attribute) {
256         getShared().removeAttribute(attribute);
257     }
258     
259     /**
260      * gets the type of this element.
261      */

262     public AXIType getType() {
263         return getShared().getType();
264     }
265     
266     /**
267      * sets the type of this element.
268      */

269     public void setType(AXIType type) {
270         getShared().setType(type);
271     }
272     
273     /**
274      * Returns the compositor.
275      */

276     public Compositor getCompositor() {
277         return getShared().getCompositor();
278     }
279     
280     Element getShared() {
281         return (Element)getSharedComponent();
282     }
283     
284     /**
285      * Proxy doesn't get refreshed in the UI. We must notify.
286      */

287     void forceFireEvent() {
288         firePropertyChangeEvent(Element.PROP_NAME, null, getName());
289     }
290 }
291
Popular Tags