KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > property > model > DynamicCustomizer


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  * This generated bean class DynamicCustomizer
22  * matches the schema element 'DynamicCustomizer'.
23  * The root bean class is ElementProperties
24  *
25  * Generated on Tue Jan 30 20:45:13 PST 2007
26  * @Generated
27  */

28
29 package org.netbeans.modules.xml.wsdl.ui.property.model;
30
31 public class DynamicCustomizer {
32     public static final String JavaDoc DEPENDSONATTRIBUTEVALUETYPE = "DependsOnAttributeValueType"; // NOI18N
33
public static final String JavaDoc ATTRIBUTEVALUEPROVIDERCLASS = "AttributeValueProviderClass"; // NOI18N
34

35     private java.lang.String JavaDoc _DependsOnAttributeValueType;
36     private java.lang.String JavaDoc _AttributeValueProviderClass;
37
38     /**
39      * Normal starting point constructor.
40      */

41     public DynamicCustomizer() {
42     }
43
44     /**
45      * Deep copy
46      */

47     public DynamicCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.DynamicCustomizer source) {
48         this(source, false);
49     }
50
51     /**
52      * Deep copy
53      * @param justData just copy the XML relevant data
54      */

55     public DynamicCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.DynamicCustomizer source, boolean justData) {
56         _DependsOnAttributeValueType = source._DependsOnAttributeValueType;
57         _AttributeValueProviderClass = source._AttributeValueProviderClass;
58     }
59
60     // This attribute is optional
61
public void setDependsOnAttributeValueType(java.lang.String JavaDoc value) {
62         _DependsOnAttributeValueType = value;
63     }
64
65     public java.lang.String JavaDoc getDependsOnAttributeValueType() {
66         return _DependsOnAttributeValueType;
67     }
68
69     // This attribute is optional
70
public void setAttributeValueProviderClass(java.lang.String JavaDoc value) {
71         _AttributeValueProviderClass = value;
72     }
73
74     public java.lang.String JavaDoc getAttributeValueProviderClass() {
75         return _AttributeValueProviderClass;
76     }
77
78     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
79         String JavaDoc myName;
80         myName = "DynamicCustomizer";
81         writeNode(out, myName, ""); // NOI18N
82
}
83
84     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
85         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
86     }
87
88     /**
89      * It's not recommended to call this method directly.
90      */

91     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
92         out.write(indent);
93         out.write("<");
94         if (namespace != null) {
95             out.write((String JavaDoc)namespaceMap.get(namespace));
96             out.write(":");
97         }
98         out.write(nodeName);
99         writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap);
100         writeNodeChildren(out, nodeName, namespace, indent, namespaceMap);
101         out.write("/>\n");
102     }
103
104     protected void writeNodeAttributes(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
105         // dependsOnAttributeValueType is an attribute with namespace http://xml.netbeans.org/schema/wsdlui/property
106
if (_DependsOnAttributeValueType != null) {
107             out.write(" dependsOnAttributeValueType='");
108             org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _DependsOnAttributeValueType, true);
109             out.write("'"); // NOI18N
110
}
111         // attributeValueProviderClass is an attribute with namespace http://xml.netbeans.org/schema/wsdlui/property
112
if (_AttributeValueProviderClass != null) {
113             out.write(" attributeValueProviderClass='");
114             org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _AttributeValueProviderClass, true);
115             out.write("'"); // NOI18N
116
}
117     }
118
119     protected void writeNodeChildren(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc namespace, String JavaDoc indent, java.util.Map JavaDoc namespaceMap) throws java.io.IOException JavaDoc {
120     }
121
122     public void readNode(org.w3c.dom.Node JavaDoc node) {
123         readNode(node, new java.util.HashMap JavaDoc());
124     }
125
126     public void readNode(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
127         if (node.hasAttributes()) {
128             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
129             org.w3c.dom.Attr JavaDoc attr;
130             java.lang.String JavaDoc attrValue;
131             boolean firstNamespaceDef = true;
132             for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
133                 attr = (org.w3c.dom.Attr JavaDoc) attrs.item(attrNum);
134                 String JavaDoc attrName = attr.getName();
135                 if (attrName.startsWith("xmlns:")) {
136                     if (firstNamespaceDef) {
137                         firstNamespaceDef = false;
138                         // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
139
namespacePrefixes = new java.util.HashMap JavaDoc(namespacePrefixes);
140                     }
141                     String JavaDoc attrNSPrefix = attrName.substring(6, attrName.length());
142                     namespacePrefixes.put(attrNSPrefix, attr.getValue());
143                 }
144             }
145             readNodeAttributes(node, namespacePrefixes, attrs);
146         }
147         readNodeChildren(node, namespacePrefixes);
148     }
149
150     protected void readNodeAttributes(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes, org.w3c.dom.NamedNodeMap JavaDoc attrs) {
151         org.w3c.dom.Attr JavaDoc attr;
152         java.lang.String JavaDoc attrValue;
153         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("dependsOnAttributeValueType");
154         if (attr != null) {
155             attrValue = attr.getValue();
156             _DependsOnAttributeValueType = attrValue;
157         }
158         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("attributeValueProviderClass");
159         if (attr != null) {
160             attrValue = attr.getValue();
161             _AttributeValueProviderClass = attrValue;
162         }
163     }
164
165     protected void readNodeChildren(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
166     }
167
168     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
169         if (name == null) return;
170         name = name.intern();
171         if (name == "dependsOnAttributeValueType")
172             setDependsOnAttributeValueType((java.lang.String JavaDoc)value);
173         else if (name == "attributeValueProviderClass")
174             setAttributeValueProviderClass((java.lang.String JavaDoc)value);
175         else
176             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for DynamicCustomizer");
177     }
178
179     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
180         if (name == "dependsOnAttributeValueType")
181             return getDependsOnAttributeValueType();
182         if (name == "attributeValueProviderClass")
183             return getAttributeValueProviderClass();
184         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for DynamicCustomizer");
185     }
186
187     public String JavaDoc nameSelf() {
188         return "DynamicCustomizer";
189     }
190
191     public String JavaDoc nameChild(Object JavaDoc childObj) {
192         return nameChild(childObj, false, false);
193     }
194
195     /**
196      * @param childObj The child object to search for
197      * @param returnSchemaName Whether or not the schema name should be returned or the property name
198      * @return null if not found
199      */

200     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
201         return nameChild(childObj, returnConstName, returnSchemaName, false);
202     }
203
204     /**
205      * @param childObj The child object to search for
206      * @param returnSchemaName Whether or not the schema name should be returned or the property name
207      * @return null if not found
208      */

209     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
210         if (childObj instanceof java.lang.String JavaDoc) {
211             java.lang.String JavaDoc child = (java.lang.String JavaDoc) childObj;
212             if (child == _DependsOnAttributeValueType) {
213                 if (returnConstName) {
214                     return DEPENDSONATTRIBUTEVALUETYPE;
215                 } else if (returnSchemaName) {
216                     return "dependsOnAttributeValueType";
217                 } else if (returnXPathName) {
218                     return "@dependsOnAttributeValueType";
219                 } else {
220                     return "DependsOnAttributeValueType";
221                 }
222             }
223             if (child == _AttributeValueProviderClass) {
224                 if (returnConstName) {
225                     return ATTRIBUTEVALUEPROVIDERCLASS;
226                 } else if (returnSchemaName) {
227                     return "attributeValueProviderClass";
228                 } else if (returnXPathName) {
229                     return "@attributeValueProviderClass";
230                 } else {
231                     return "AttributeValueProviderClass";
232                 }
233             }
234         }
235         return null;
236     }
237
238     /**
239      * Return an array of all of the properties that are beans and are set.
240      */

241     public java.lang.Object JavaDoc[] childBeans(boolean recursive) {
242         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
243         childBeans(recursive, children);
244         java.lang.Object JavaDoc[] result = new java.lang.Object JavaDoc[children.size()];
245         return (java.lang.Object JavaDoc[]) children.toArray(result);
246     }
247
248     /**
249      * Put all child beans into the beans list.
250      */

251     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
252     }
253
254     public boolean equals(Object JavaDoc o) {
255         return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.DynamicCustomizer && equals((org.netbeans.modules.xml.wsdl.ui.property.model.DynamicCustomizer) o);
256     }
257
258     public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.DynamicCustomizer inst) {
259         if (inst == this) {
260             return true;
261         }
262         if (inst == null) {
263             return false;
264         }
265         if (!(_DependsOnAttributeValueType == null ? inst._DependsOnAttributeValueType == null : _DependsOnAttributeValueType.equals(inst._DependsOnAttributeValueType))) {
266             return false;
267         }
268         if (!(_AttributeValueProviderClass == null ? inst._AttributeValueProviderClass == null : _AttributeValueProviderClass.equals(inst._AttributeValueProviderClass))) {
269             return false;
270         }
271         return true;
272     }
273
274     public int hashCode() {
275         int result = 17;
276         result = 37*result + (_DependsOnAttributeValueType == null ? 0 : _DependsOnAttributeValueType.hashCode());
277         result = 37*result + (_AttributeValueProviderClass == null ? 0 : _AttributeValueProviderClass.hashCode());
278         return result;
279     }
280
281 }
282
283
284 /*
285         The following schema file has been used for generation:
286
287 <?xml version="1.0" encoding="UTF-8"?>
288
289 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
290             targetNamespace="http://xml.netbeans.org/schema/wsdlui/property"
291             xmlns:tns="http://xml.netbeans.org/schema/wsdlui/property"
292             elementFormDefault="qualified">
293     <xsd:element name="ElementProperties">
294         <xsd:complexType>
295             <xsd:sequence>
296                 <xsd:element ref="tns:PropertyGroup" maxOccurs="unbounded" />
297                 <xsd:element ref="tns:Property" maxOccurs="unbounded" />
298             </xsd:sequence>
299         </xsd:complexType>
300     </xsd:element>
301     
302     <xsd:element name="PropertyGroup">
303         <xsd:complexType>
304             <xsd:attribute name="name" type="xsd:string" use="required"/>
305             <xsd:attribute name="groupOrder" type="xsd:int"/>
306         </xsd:complexType>
307     </xsd:element>
308     <xsd:element name="Property">
309         <xsd:complexType>
310             <xsd:choice>
311                 <xsd:element name="SchemaCustomizer">
312                 </xsd:element>
313                 <xsd:element name="BuiltInCustomizer">
314                     <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
315                         <xsd:choice>
316                             <xsd:element name="DependsOnCustomizer">
317                                 <xsd:complexType>
318                                     <xsd:choice>
319                                         <xsd:element name="StaticCustomizer">
320                                             <xsd:complexType>
321                                                 <xsd:attribute name="dependsOnAttributeName" type="xsd:QName"/>
322                                             </xsd:complexType>
323                                         </xsd:element>
324                                         <xsd:element name="DynamicCustomizer">
325                                             <xsd:complexType>
326                                                 <xsd:attribute name="dependsOnAttributeValueType" type="xsd:string"/>
327                                                 <xsd:attribute name="attributeValueProviderClass" type="xsd:string"/>
328                                             </xsd:complexType>
329                                         </xsd:element>
330                                     </xsd:choice>
331                                     <xsd:attribute name="name" type="tns:builtInCustomizerTypes"/>
332                                 </xsd:complexType>
333                             </xsd:element>
334                             <xsd:element name="SimpleCustomizer">
335                                 <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
336                                     <xsd:sequence/>
337                                     <xsd:attribute name="name" type="tns:builtInCustomizerTypes"/>
338                                 </xsd:complexType>
339                             </xsd:element>
340                         </xsd:choice>
341                     </xsd:complexType>
342                 </xsd:element>
343                 <xsd:element ref="tns:NewCustomizer"/>
344             </xsd:choice>
345             <xsd:attribute name="attributeName" type="xsd:string" use="required"/>
346             <xsd:attribute name="groupName" type="xsd:string"/>
347             <xsd:attribute name="propertyOrder" type="xsd:int"/>
348         </xsd:complexType>
349     </xsd:element>
350     <xsd:element name="GroupedProperty">
351         <xsd:complexType>
352             <xsd:choice>
353                 <xsd:element name="BuiltInCustomizer">
354                     <xsd:complexType>
355                         <xsd:attribute name="name" type="tns:GroupedAttributeBuiltInCustomizerTypes"/>
356                         <xsd:attribute name="attributeValueSetterClass" type="xsd:string"/>
357                     </xsd:complexType>
358                 </xsd:element>
359                 <xsd:element ref="tns:NewCustomizer"/>
360             </xsd:choice>
361             <xsd:attribute name="groupedAttributeNames" type="tns:attributeList"/>
362             <xsd:attribute name="groupName" type="xsd:string"/>
363             <xsd:attribute name="propertyOrder" type="xsd:int"/>
364             <xsd:attribute name="groupDisplayName" type="xsd:string"/>
365         </xsd:complexType>
366     </xsd:element>
367     
368     <xsd:element name="NewCustomizer">
369         <xsd:complexType>
370             <xsd:attribute name="className" type="xsd:string"/>
371         </xsd:complexType>
372     </xsd:element>
373                 
374     <xsd:simpleType name="builtInCustomizerTypes">
375         <xsd:restriction base="xsd:string">
376                         <xsd:enumeration value="MessageChooser"/>
377             <xsd:enumeration value="PartChooser"/>
378         </xsd:restriction>
379     </xsd:simpleType>
380     
381     <xsd:simpleType name="GroupedAttributeBuiltInCustomizerTypes">
382         <xsd:restriction base="xsd:string">
383                         <xsd:enumeration value="ElementOrTypeChooser"/>
384         </xsd:restriction>
385     </xsd:simpleType>
386     
387     
388     <xsd:simpleType name="attributeList">
389         <xsd:list itemType="xsd:QName"/>
390     </xsd:simpleType>
391         
392 </xsd:schema>
393
394 */

395
Popular Tags