KickJava   Java API By Example, From Geeks To Geeks.

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


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 SimpleCustomizer
22  * matches the schema element 'SimpleCustomizer'.
23  * The root bean class is ElementProperties
24  *
25  * ===============================================================
26  *
27  * Use the builtin chooser that are available (the names are defined under builtInCustomizerTypes simple type as enumerations,
28  * name: specifies which builtin chooser to use.
29  *
30  * ===============================================================
31  * Generated on Mon Feb 05 17:54:51 PST 2007
32  * @Generated
33  */

34
35 package org.netbeans.modules.xml.wsdl.ui.property.model;
36
37 public class SimpleCustomizer {
38     public static final String JavaDoc NAME = "Name"; // NOI18N
39

40     private java.lang.String JavaDoc _Name = "MessageChooser";
41
42     /**
43      * Normal starting point constructor.
44      */

45     public SimpleCustomizer() {
46     }
47
48     /**
49      * Required parameters constructor
50      */

51     public SimpleCustomizer(java.lang.String JavaDoc name) {
52         _Name = name;
53     }
54
55     /**
56      * Deep copy
57      */

58     public SimpleCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.SimpleCustomizer source) {
59         this(source, false);
60     }
61
62     /**
63      * Deep copy
64      * @param justData just copy the XML relevant data
65      */

66     public SimpleCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.SimpleCustomizer source, boolean justData) {
67         _Name = source._Name;
68     }
69
70     // This attribute is mandatory
71
public void setName(java.lang.String JavaDoc value) {
72         _Name = value;
73     }
74
75     public java.lang.String JavaDoc getName() {
76         return _Name;
77     }
78
79     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
80         String JavaDoc myName;
81         myName = "SimpleCustomizer";
82         writeNode(out, myName, ""); // NOI18N
83
}
84
85     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
86         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
87     }
88
89     /**
90      * It's not recommended to call this method directly.
91      */

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

186     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
187         return nameChild(childObj, returnConstName, returnSchemaName, false);
188     }
189
190     /**
191      * @param childObj The child object to search for
192      * @param returnSchemaName Whether or not the schema name should be returned or the property name
193      * @return null if not found
194      */

195     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
196         if (childObj instanceof java.lang.String JavaDoc) {
197             java.lang.String JavaDoc child = (java.lang.String JavaDoc) childObj;
198             if (child == _Name) {
199                 if (returnConstName) {
200                     return NAME;
201                 } else if (returnSchemaName) {
202                     return "name";
203                 } else if (returnXPathName) {
204                     return "@name";
205                 } else {
206                     return "Name";
207                 }
208             }
209         }
210         return null;
211     }
212
213     /**
214      * Return an array of all of the properties that are beans and are set.
215      */

216     public java.lang.Object JavaDoc[] childBeans(boolean recursive) {
217         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
218         childBeans(recursive, children);
219         java.lang.Object JavaDoc[] result = new java.lang.Object JavaDoc[children.size()];
220         return (java.lang.Object JavaDoc[]) children.toArray(result);
221     }
222
223     /**
224      * Put all child beans into the beans list.
225      */

226     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
227     }
228
229     public boolean equals(Object JavaDoc o) {
230         return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.SimpleCustomizer && equals((org.netbeans.modules.xml.wsdl.ui.property.model.SimpleCustomizer) o);
231     }
232
233     public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.SimpleCustomizer inst) {
234         if (inst == this) {
235             return true;
236         }
237         if (inst == null) {
238             return false;
239         }
240         if (!(_Name == null ? inst._Name == null : _Name.equals(inst._Name))) {
241             return false;
242         }
243         return true;
244     }
245
246     public int hashCode() {
247         int result = 17;
248         result = 37*result + (_Name == null ? 0 : _Name.hashCode());
249         return result;
250     }
251
252 }
253
254
255 /*
256         The following schema file has been used for generation:
257
258 <?xml version="1.0" encoding="UTF-8"?>
259
260 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
261             targetNamespace="http://xml.netbeans.org/schema/wsdlui/property"
262             xmlns:tns="http://xml.netbeans.org/schema/wsdlui/property"
263             elementFormDefault="qualified">
264     <xsd:element name="ElementProperties">
265         <xsd:annotation>
266             <xsd:documentation xml:lang="en-US">Root node for specifying customizers for a element.
267                 This needs to be on the GlobalElement which would represent the node in the WSDL tree.
268             If this is defined in local elements it is ignored.</xsd:documentation>
269         </xsd:annotation>
270         <xsd:complexType>
271             <xsd:sequence>
272                 <xsd:element ref="tns:PropertyGroup" maxOccurs="unbounded" />
273                 <xsd:element ref="tns:Property" maxOccurs="unbounded" />
274                 <xsd:element ref="tns:GroupedProperty" maxOccurs="unbounded" />
275             </xsd:sequence>
276         </xsd:complexType>
277     </xsd:element>
278     
279     <xsd:element name="PropertyGroup">
280         <xsd:annotation>
281             <xsd:documentation xml:lang="en-US">Used to create groups in the property sheet.
282                 By default, if no groups are defined all the properties will be shown
283                 in the default Property sheet called "Properties".
284                 name : defines the name of the Group.
285                 groupOrder : defines the order in which the groups will be created. The groupOrder starts with 1.
286                 isDefault : overrides the default property sheet to be this group rather than "Properties".
287                 This enables the user to put non-customized properties (which do not have a Property defined in this xml) to go into this property sheet.
288                 
289                 
290             </xsd:documentation>
291         </xsd:annotation>
292         <xsd:complexType>
293             <xsd:attribute name="name" type="xsd:string" use="required"/>
294             <xsd:attribute name="groupOrder" type="xsd:int"/>
295             <xsd:attribute name="isDefault" type="xsd:boolean" default="false"/>
296         </xsd:complexType>
297     </xsd:element>
298     <xsd:element name="Property">
299         <xsd:annotation>
300             <xsd:documentation xml:lang="en-US">Property represents each attribute that would be created for the Node in the wsdleditor tree.
301                 It defines a way to specify customizers for attributes.
302                 There are 3 types of Property customizers:
303                 SchemaCustomizer : The default Customizer is the SchemaCustomizer, which shows drop downs for enumerations and boolean attributes,
304                 and String customizer for all other types. So if there is no Property defined for a attribute, it will have
305                 SchemaCustomizer.
306                 BuiltInCustomizer : specifies a way to put already defined customizer to be shown. Examples are part chooser, message chooser etc.
307                 NewCustomizer : provides a way to create a custom customizer specific to the user requirement. When using this the developer has
308                 to implement the SPI org.netbeans.modules.xml.wsdl.ui.spi.WSDLLookupProvider, and add a implementation of
309                 org.netbeans.modules.xml.wsdl.ui.spi.NewCustomizerProvider, which will provide the custom Node.Property to be shown in the
310                 wsdl editor property sheet.
311             </xsd:documentation>
312         </xsd:annotation>
313         <xsd:complexType>
314             <xsd:choice>
315                 <xsd:element name="SchemaCustomizer"/>
316                 <xsd:element name="BuiltInCustomizer">
317                     <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
318                         <xsd:choice>
319                             <xsd:element name="DependsOnCustomizer">
320                                 <xsd:annotation>
321                                     <xsd:documentation xml:lang="en-US">Use a built-in customizer whose value(s) depend on some other attribute
322                                         of the the same element or some other source.
323                                     </xsd:documentation>
324                                 </xsd:annotation>
325                                 <xsd:complexType>
326                                     <xsd:choice>
327                                         <xsd:element name="StaticCustomizer">
328                                             <xsd:annotation>
329                                                 <xsd:documentation xml:lang="en-US">dependsOnAttributeName : the attribute on which the value(s) of the chooser would depend on.
330                                                     For example: some elements may have a attribute for message and another for part, and the PartsChooser should show parts from the message that is selected in the message attribute.
331                                                     In that the dependsOnAttributeName for PartChooser would be message.
332                                                 </xsd:documentation>
333                                             </xsd:annotation>
334                                             <xsd:complexType>
335                                                 <xsd:attribute name="dependsOnAttributeName" type="xsd:QName"/>
336                                             </xsd:complexType>
337                                         </xsd:element>
338                                         <!--No use case as of yet, xsd:element name="DynamicCustomizer">
339                                             <xsd:annotation>
340                                                 <xsd:documentation xml:lang="en-US">
341                                                     
342                                                 </xsd:documentation>
343                                             </xsd:annotation>
344                                             <xsd:complexType>
345                                                 <xsd:attribute name="dependsOnAttributeValueType" type="xsd:string"/>
346                                                 <xsd:attribute name="attributeValueProviderClass" type="xsd:string"/>
347                                             </xsd:complexType>
348                                         </xsd:element-->
349                                     </xsd:choice>
350                                     <xsd:attribute name="name" type="tns:builtInCustomizerTypes"/>
351                                 </xsd:complexType>
352                             </xsd:element>
353                             <xsd:element name="SimpleCustomizer">
354                                 <xsd:annotation>
355                                     <xsd:documentation xml:lang="en-US">
356                                         Use the builtin chooser that are available (the names are defined under builtInCustomizerTypes simple type as enumerations,
357                                         name: specifies which builtin chooser to use.
358                                     </xsd:documentation>
359                                 </xsd:annotation>
360                                 <xsd:complexType xmlns:xsd="http://www.w3.org/2001/XMLSchema">
361                                     <xsd:sequence/>
362                                     <xsd:attribute name="name" type="tns:builtInCustomizerTypes"/>
363                                 </xsd:complexType>
364                             </xsd:element>
365                         </xsd:choice>
366                     </xsd:complexType>
367                 </xsd:element>
368                 <xsd:element ref="tns:NewCustomizer"/>
369             </xsd:choice>
370             <xsd:attribute name="attributeName" type="xsd:string" use="required"/>
371             <xsd:attribute name="isNameableAttribute" type="xsd:boolean" default="false"/>
372             <xsd:attribute name="decoratorAttribute" type="xsd:QName"/>
373             <xsd:attribute name="groupName" type="xsd:string"/>
374             <xsd:attribute name="propertyOrder" type="xsd:int"/>
375         </xsd:complexType>
376     </xsd:element>
377     <xsd:element name="GroupedProperty">
378         <xsd:annotation>
379             <xsd:documentation xml:lang="en-US">Some attributes in a element are mutually exclusive, so in the UI, for unambiguous usage, the user may want to add a single property chooser for 2 or more attributes, which will set the appropriate attribute depending on some criteria that the customizer may determine.
380                 groupedAttributeNames : specify all the mutually exclusive attributes. There will be a single customizer for all these attributes.
381                 groupName : specifies which PropertyGroup this belongs to.
382                 propertyOrder : specifies the order in the PropertyGroup where this property would be placed.
383                 displayName: specifies the Display name of the combined chooser.
384             </xsd:documentation>
385         </xsd:annotation>
386         <xsd:complexType>
387             <xsd:choice>
388                 <xsd:element name="BuiltInCustomizer" >
389                     <xsd:annotation>
390                         <xsd:documentation xml:lang="en-US">To use pre-built customizers.
391                         </xsd:documentation>
392                     </xsd:annotation>
393                     <xsd:complexType>
394                         <xsd:choice>
395                             <xsd:element name="ElementOrTypeChooser">
396                                 <xsd:annotation>
397                                     <xsd:documentation xml:lang="en-US">Shows a Tree based selector, which shows all the elements/types from Inline/Imported schemas.
398                                         elementAttributeName : the attribute on which GlobalElement data type would be set.
399                                         typeAttributeName : the attribute on which GlobalType data type would be set.
400                                     </xsd:documentation>
401                                 </xsd:annotation>
402                                 <xsd:complexType>
403                                     <xsd:attribute name="elementAttributeName" type="xsd:NCName"/>
404                                     <xsd:attribute name="typeAttributeName" type="xsd:NCName"/>
405                                 </xsd:complexType>
406                             </xsd:element>
407                             <xsd:element name="ElementOrTypeOrMessagePartChooser">
408                                 <xsd:annotation>
409                                     <xsd:documentation xml:lang="en-US">Shows a Tree based selector, which shows all the elements/types from Inline/Imported schemas and also the messages from all imported and existing wsdls.
410                                         elementAttributeName : the attribute on which GlobalElement data type would be set.
411                                         typeAttributeName : the attribute on which GlobalType data type would be set.
412                                         messageAttributeName : the attribute on which Message data type would be set.
413                                         partAttributeName : the attribute on which part would be set.
414                                         This chooser can select between a GlobalElement or GlobalType or a wsdl Part.
415                                         
416                                     </xsd:documentation>
417                                 </xsd:annotation>
418                                 <xsd:complexType>
419                                     <xsd:attribute name="elementAttributeName" type="xsd:NCName"/>
420                                     <xsd:attribute name="typeAttributeName" type="xsd:NCName"/>
421                                     <xsd:attribute name="messageAttributeName" type="xsd:NCName"/>
422                                     <xsd:attribute name="partAttributeName" type="xsd:NCName"/>
423                                 </xsd:complexType>
424                             </xsd:element>
425                         </xsd:choice>
426                     </xsd:complexType>
427                 </xsd:element>
428                 <xsd:element ref="tns:NewCustomizer"/>
429             </xsd:choice>
430             <xsd:attribute name="groupedAttributeNames" type="tns:attributeList" use="required"/>
431             <xsd:attribute name="groupName" type="xsd:string"/>
432             <xsd:attribute name="propertyOrder" type="xsd:int"/>
433             <xsd:attribute name="displayName" type="xsd:NCName" use="required"/>
434         </xsd:complexType>
435     </xsd:element>
436     
437     
438     <xsd:element name="NewCustomizer">
439         <xsd:annotation>
440             <xsd:documentation xml:lang="en-US">Provides a way for developer to provide a custom property customizer for the attribute, if the builtin chooser dont satisfy their requirements.
441 When using this the developer has to implement the SPI org.netbeans.modules.xml.wsdl.ui.spi.WSDLLookupProvider, and add a implementation of org.netbeans.modules.xml.wsdl.ui.spi.NewCustomizerProvider, which will provide the custom Node.Property to be shown in the wsdl editor property sheet.
442             </xsd:documentation>
443         </xsd:annotation>
444     </xsd:element>
445     
446     
447     <xsd:simpleType name="builtInCustomizerTypes">
448         <xsd:restriction base="xsd:string">
449             <xsd:enumeration value="MessageChooser">
450                 <xsd:annotation>
451                     <xsd:documentation xml:lang="en-US">Shows a drop down of all messages in the current WSDL document and also ones in imported WSDL documents.</xsd:documentation>
452                 </xsd:annotation>
453             </xsd:enumeration>
454             <xsd:enumeration value="PartChooser">
455                 <xsd:annotation>
456                     <xsd:documentation xml:lang="en-US">Show a drop down of all parts for a message. By default, the chooser assumes that it is in the binding section under input/output/fault, and shows all the parts for the message selected in the input/output/fault.
457     If not, then the dependsOnCustomizer needs to be used to specify the attribute which represents the message, whose parts will be shown</xsd:documentation>
458                 </xsd:annotation>
459             </xsd:enumeration>
460             <xsd:enumeration value="PortTypeChooser">
461                 <xsd:annotation>
462                     <xsd:documentation xml:lang="en-US">Show a drop down of all port types in the WSDL Document/Imported WSDL Documents.</xsd:documentation>
463                 </xsd:annotation>
464             </xsd:enumeration>
465             <xsd:enumeration value="PartsChooser">
466                 <xsd:annotation>
467                     <xsd:documentation xml:lang="en-US">Show a dialog of all parts for a message, from which multiple parts can be selected. By default, the chooser assumes that it is in the binding section under input/output/fault, and shows all the parts for the message selected in the input/output/fault.
468     If not, then the dependsOnCustomizer needs to be used to specify the attribute which represents the message, whose parts will be shown</xsd:documentation>
469                 </xsd:annotation>
470             </xsd:enumeration>
471         </xsd:restriction>
472     </xsd:simpleType>
473     
474     <xsd:simpleType name="attributeList">
475         <xsd:list itemType="xsd:string"/>
476     </xsd:simpleType>
477     
478 </xsd:schema>
479
480 */

481
Popular Tags