KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > wizard > TemplateGroup


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 TemplateGroup
22  * matches the schema element 'templateGroup'.
23  *
24  * Generated on Thu Sep 14 11:59:06 PDT 2006
25  *
26  * This class matches the root element of the XML Schema,
27  * and is the root of the bean graph.
28  *
29  * templateGroup <templateGroup> : TemplateGroup
30  * [attr: namespace CDATA #IMPLIED : java.lang.String]
31  * [attr: prefix CDATA #IMPLIED : java.lang.String]
32  * template <template> : TemplateType[1,n]
33  * [attr: name CDATA #IMPLIED : java.lang.String]
34  * [attr: default CDATA #IMPLIED : boolean]
35  * wsdlElement <wsdlElement> : WsdlElementType[1,n]
36  * [attr: name CDATA #IMPLIED : java.lang.String]
37  * extensionElement <extensionElement> : ExtensionElementType[1,n]
38  * [attr: name CDATA #IMPLIED : java.lang.String]
39  * extensionAttr <extensionAttr> : ExtensionAttrType[1,n]
40  * [attr: name CDATA #IMPLIED : java.lang.String]
41  * [attr: defaultValue CDATA #IMPLIED : java.lang.String]
42  *
43  * @Generated
44  */

45
46 package org.netbeans.modules.xml.wsdl.ui.view.wizard;
47
48 public class TemplateGroup {
49     public static final String JavaDoc NAMESPACE = "Namespace"; // NOI18N
50
public static final String JavaDoc PREFIX = "Prefix"; // NOI18N
51
public static final String JavaDoc TEMPLATE = "Template"; // NOI18N
52

53     private java.lang.String JavaDoc _Namespace;
54     private java.lang.String JavaDoc _Prefix;
55     private java.util.List JavaDoc _Template = new java.util.ArrayList JavaDoc(); // List<TemplateType>
56
private java.lang.String JavaDoc schemaLocation;
57
58     /**
59      * Normal starting point constructor.
60      */

61     public TemplateGroup() {
62     }
63
64     /**
65      * Required parameters constructor
66      */

67     public TemplateGroup(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType[] template) {
68         if (template!= null) {
69             ((java.util.ArrayList JavaDoc) _Template).ensureCapacity(template.length);
70             for (int i = 0; i < template.length; ++i) {
71                 _Template.add(template[i]);
72             }
73         }
74     }
75
76     /**
77      * Deep copy
78      */

79     public TemplateGroup(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup source) {
80         this(source, false);
81     }
82
83     /**
84      * Deep copy
85      * @param justData just copy the XML relevant data
86      */

87     public TemplateGroup(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup source, boolean justData) {
88         _Namespace = source._Namespace;
89         _Prefix = source._Prefix;
90         for (java.util.Iterator JavaDoc it = source._Template.iterator();
91             it.hasNext(); ) {
92             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType srcElement = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it.next();
93             _Template.add((srcElement == null) ? null : newTemplateType(srcElement, justData));
94         }
95         schemaLocation = source.schemaLocation;
96     }
97
98     // This attribute is optional
99
public void setNamespace(java.lang.String JavaDoc value) {
100         _Namespace = value;
101     }
102
103     public java.lang.String JavaDoc getNamespace() {
104         return _Namespace;
105     }
106
107     // This attribute is optional
108
public void setPrefix(java.lang.String JavaDoc value) {
109         _Prefix = value;
110     }
111
112     public java.lang.String JavaDoc getPrefix() {
113         return _Prefix;
114     }
115
116     // This attribute is an array containing at least one element
117
public void setTemplate(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType[] value) {
118         if (value == null)
119             value = new TemplateType[0];
120         _Template.clear();
121         ((java.util.ArrayList JavaDoc) _Template).ensureCapacity(value.length);
122         for (int i = 0; i < value.length; ++i) {
123             _Template.add(value[i]);
124         }
125     }
126
127     public void setTemplate(int index, org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType value) {
128         _Template.set(index, value);
129     }
130
131     public org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType[] getTemplate() {
132         TemplateType[] arr = new TemplateType[_Template.size()];
133         return (TemplateType[]) _Template.toArray(arr);
134     }
135
136     public java.util.List JavaDoc fetchTemplateList() {
137         return _Template;
138     }
139
140     public org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType getTemplate(int index) {
141         return (TemplateType)_Template.get(index);
142     }
143
144     // Return the number of template
145
public int sizeTemplate() {
146         return _Template.size();
147     }
148
149     public int addTemplate(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType value) {
150         _Template.add(value);
151         int positionOfNewItem = _Template.size()-1;
152         return positionOfNewItem;
153     }
154
155     /**
156      * Search from the end looking for @param value, and then remove it.
157      */

158     public int removeTemplate(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType value) {
159         int pos = _Template.indexOf(value);
160         if (pos >= 0) {
161             _Template.remove(pos);
162         }
163         return pos;
164     }
165
166     public void _setSchemaLocation(String JavaDoc location) {
167         schemaLocation = location;
168     }
169
170     public String JavaDoc _getSchemaLocation() {
171         return schemaLocation;
172     }
173
174     /**
175      * Create a new bean using it's default constructor.
176      * This does not add it to any bean graph.
177      */

178     public org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType newTemplateType() {
179         return new org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType();
180     }
181
182     /**
183      * Create a new bean, copying from another one.
184      * This does not add it to any bean graph.
185      */

186     public org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType newTemplateType(TemplateType source, boolean justData) {
187         return new org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType(source, justData);
188     }
189
190     public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException JavaDoc {
191         org.openide.filesystems.FileLock lock = fo.lock();
192         try {
193             java.io.OutputStream JavaDoc out = fo.getOutputStream(lock);
194             write(out);
195             out.close();
196         } finally {
197             lock.releaseLock();
198         }
199     }
200
201     public void write(org.openide.filesystems.FileObject dir, String JavaDoc filename) throws java.io.IOException JavaDoc {
202         org.openide.filesystems.FileObject file = dir.getFileObject(filename);
203         if (file == null) {
204             file = dir.createData(filename);
205         }
206         write(file);
207     }
208
209     public void write(java.io.File JavaDoc f) throws java.io.IOException JavaDoc {
210         java.io.OutputStream JavaDoc out = new java.io.FileOutputStream JavaDoc(f);
211         try {
212             write(out);
213         } finally {
214             out.close();
215         }
216     }
217
218     public void write(java.io.OutputStream JavaDoc out) throws java.io.IOException JavaDoc {
219         write(out, null);
220     }
221
222     public void write(java.io.OutputStream JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
223         java.io.Writer JavaDoc w;
224         if (encoding == null) {
225             encoding = "UTF-8"; // NOI18N
226
}
227         w = new java.io.BufferedWriter JavaDoc(new java.io.OutputStreamWriter JavaDoc(out, encoding));
228         write(w, encoding);
229         w.flush();
230     }
231
232     /**
233      * Print this Java Bean to @param out including an XML header.
234      * @param encoding is the encoding style that @param out was opened with.
235      */

236     public void write(java.io.Writer JavaDoc out, String JavaDoc encoding) throws java.io.IOException JavaDoc {
237         out.write("<?xml version='1.0'"); // NOI18N
238
if (encoding != null)
239             out.write(" encoding='"+encoding+"'"); // NOI18N
240
out.write(" ?>\n"); // NOI18N
241
writeNode(out, "templateGroup", ""); // NOI18N
242
}
243
244     public void writeNode(java.io.Writer JavaDoc out) throws java.io.IOException JavaDoc {
245         String JavaDoc myName;
246         myName = "templateGroup";
247         writeNode(out, myName, ""); // NOI18N
248
}
249
250     public void writeNode(java.io.Writer JavaDoc out, String JavaDoc nodeName, String JavaDoc indent) throws java.io.IOException JavaDoc {
251         writeNode(out, nodeName, null, indent, new java.util.HashMap JavaDoc());
252     }
253
254     /**
255      * It's not recommended to call this method directly.
256      */

257     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 {
258         out.write(indent);
259         out.write("<");
260         if (namespace != null) {
261             out.write((String JavaDoc)namespaceMap.get(namespace));
262             out.write(":");
263         }
264         out.write(nodeName);
265         out.write(" xmlns='"); // NOI18N
266
out.write("http://xml.netbeans.org/schema/templates"); // NOI18N
267
out.write("'"); // NOI18N
268
if (schemaLocation != null) {
269             namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
270             out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='");
271             out.write(schemaLocation);
272             out.write("'"); // NOI18N
273
}
274         writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap);
275         out.write(">\n");
276         writeNodeChildren(out, nodeName, namespace, indent, namespaceMap);
277         out.write(indent);
278         out.write("</");
279         if (namespace != null) {
280             out.write((String JavaDoc)namespaceMap.get(namespace));
281             out.write(":");
282         }
283         out.write(nodeName);
284         out.write(">\n");
285     }
286
287     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 {
288         // namespace is an attribute with namespace http://xml.netbeans.org/schema/templates
289
if (_Namespace != null) {
290             out.write(" namespace='");
291             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup.writeXML(out, _Namespace, true);
292             out.write("'"); // NOI18N
293
}
294         // prefix is an attribute with namespace http://xml.netbeans.org/schema/templates
295
if (_Prefix != null) {
296             out.write(" prefix='");
297             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup.writeXML(out, _Prefix, true);
298             out.write("'"); // NOI18N
299
}
300     }
301
302     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 {
303         String JavaDoc nextIndent = indent + " ";
304         for (java.util.Iterator JavaDoc it = _Template.iterator(); it.hasNext(); ) {
305             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it.next();
306             if (element != null) {
307                 element.writeNode(out, "template", null, nextIndent, namespaceMap);
308             }
309         }
310     }
311
312     public static TemplateGroup read(org.openide.filesystems.FileObject fo) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
313         java.io.InputStream JavaDoc in = fo.getInputStream();
314         try {
315             return read(in);
316         } finally {
317             in.close();
318         }
319     }
320
321     public static TemplateGroup read(java.io.File JavaDoc f) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
322         java.io.InputStream JavaDoc in = new java.io.FileInputStream JavaDoc(f);
323         try {
324             return read(in);
325         } finally {
326             in.close();
327         }
328     }
329
330     public static TemplateGroup read(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
331         return read(new org.xml.sax.InputSource JavaDoc(in), false, null, null);
332     }
333
334     /**
335      * Warning: in readNoEntityResolver character and entity references will
336      * not be read from any DTD in the XML source.
337      * However, this way is faster since no DTDs are looked up
338      * (possibly skipping network access) or parsed.
339      */

340     public static TemplateGroup readNoEntityResolver(java.io.InputStream JavaDoc in) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
341         return read(new org.xml.sax.InputSource JavaDoc(in), false,
342             new org.xml.sax.EntityResolver JavaDoc() {
343             public org.xml.sax.InputSource JavaDoc resolveEntity(String JavaDoc publicId, String JavaDoc systemId) {
344                 java.io.ByteArrayInputStream JavaDoc bin = new java.io.ByteArrayInputStream JavaDoc(new byte[0]);
345                 return new org.xml.sax.InputSource JavaDoc(bin);
346             }
347         }
348             , null);
349     }
350
351     public static TemplateGroup read(org.xml.sax.InputSource JavaDoc in, boolean validate, org.xml.sax.EntityResolver JavaDoc er, org.xml.sax.ErrorHandler JavaDoc eh) throws javax.xml.parsers.ParserConfigurationException JavaDoc, org.xml.sax.SAXException JavaDoc, java.io.IOException JavaDoc {
352         javax.xml.parsers.DocumentBuilderFactory JavaDoc dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
353         dbf.setValidating(validate);
354         dbf.setNamespaceAware(true);
355         javax.xml.parsers.DocumentBuilder JavaDoc db = dbf.newDocumentBuilder();
356         if (er != null) db.setEntityResolver(er);
357         if (eh != null) db.setErrorHandler(eh);
358         org.w3c.dom.Document JavaDoc doc = db.parse(in);
359         return read(doc);
360     }
361
362     public static TemplateGroup read(org.w3c.dom.Document JavaDoc document) {
363         TemplateGroup aTemplateGroup = new TemplateGroup();
364         aTemplateGroup.readFromDocument(document);
365         return aTemplateGroup;
366     }
367
368     protected void readFromDocument(org.w3c.dom.Document JavaDoc document) {
369         readNode(document.getDocumentElement());
370     }
371
372     public void readNode(org.w3c.dom.Node JavaDoc node) {
373         readNode(node, new java.util.HashMap JavaDoc());
374     }
375
376     public void readNode(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
377         if (node.hasAttributes()) {
378             org.w3c.dom.NamedNodeMap JavaDoc attrs = node.getAttributes();
379             org.w3c.dom.Attr JavaDoc attr;
380             java.lang.String JavaDoc attrValue;
381             boolean firstNamespaceDef = true;
382             for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) {
383                 attr = (org.w3c.dom.Attr JavaDoc) attrs.item(attrNum);
384                 String JavaDoc attrName = attr.getName();
385                 if (attrName.startsWith("xmlns:")) {
386                     if (firstNamespaceDef) {
387                         firstNamespaceDef = false;
388                         // Dup prefix map, so as to not write over previous values, and to make it easy to clear out our entries.
389
namespacePrefixes = new java.util.HashMap JavaDoc(namespacePrefixes);
390                     }
391                     String JavaDoc attrNSPrefix = attrName.substring(6, attrName.length());
392                     namespacePrefixes.put(attrNSPrefix, attr.getValue());
393                 }
394             }
395             String JavaDoc xsiPrefix = "xsi";
396             for (java.util.Iterator JavaDoc it = namespacePrefixes.keySet().iterator();
397                 it.hasNext(); ) {
398                 String JavaDoc prefix = (String JavaDoc) it.next();
399                 String JavaDoc ns = (String JavaDoc) namespacePrefixes.get(prefix);
400                 if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) {
401                     xsiPrefix = prefix;
402                     break;
403                 }
404             }
405             attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem(""+xsiPrefix+":schemaLocation");
406             if (attr != null) {
407                 attrValue = attr.getValue();
408                 schemaLocation = attrValue;
409             }
410             readNodeAttributes(node, namespacePrefixes, attrs);
411         }
412         readNodeChildren(node, namespacePrefixes);
413     }
414
415     protected void readNodeAttributes(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes, org.w3c.dom.NamedNodeMap JavaDoc attrs) {
416         org.w3c.dom.Attr JavaDoc attr;
417         java.lang.String JavaDoc attrValue;
418         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("namespace");
419         if (attr != null) {
420             attrValue = attr.getValue();
421             _Namespace = attrValue;
422         }
423         attr = (org.w3c.dom.Attr JavaDoc) attrs.getNamedItem("prefix");
424         if (attr != null) {
425             attrValue = attr.getValue();
426             _Prefix = attrValue;
427         }
428     }
429
430     protected void readNodeChildren(org.w3c.dom.Node JavaDoc node, java.util.Map JavaDoc namespacePrefixes) {
431         org.w3c.dom.NodeList JavaDoc children = node.getChildNodes();
432         for (int i = 0, size = children.getLength(); i < size; ++i) {
433             org.w3c.dom.Node JavaDoc childNode = children.item(i);
434             String JavaDoc childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern());
435             String JavaDoc childNodeValue = "";
436             if (childNode.getFirstChild() != null) {
437                 childNodeValue = childNode.getFirstChild().getNodeValue();
438             }
439             if (childNodeName == "template") {
440                 TemplateType aTemplate = newTemplateType();
441                 aTemplate.readNode(childNode, namespacePrefixes);
442                 _Template.add(aTemplate);
443             }
444             else {
445                 // Found extra unrecognized childNode
446
}
447         }
448     }
449
450     /**
451      * Takes some text to be printed into an XML stream and escapes any
452      * characters that might make it invalid XML (like '<').
453      */

454     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg) throws java.io.IOException JavaDoc {
455         writeXML(out, msg, true);
456     }
457
458     public static void writeXML(java.io.Writer JavaDoc out, String JavaDoc msg, boolean attribute) throws java.io.IOException JavaDoc {
459         if (msg == null)
460             return;
461         int msgLength = msg.length();
462         for (int i = 0; i < msgLength; ++i) {
463             char c = msg.charAt(i);
464             writeXML(out, c, attribute);
465         }
466     }
467
468     public static void writeXML(java.io.Writer JavaDoc out, char msg, boolean attribute) throws java.io.IOException JavaDoc {
469         if (msg == '&')
470             out.write("&amp;");
471         else if (msg == '<')
472             out.write("&lt;");
473         else if (msg == '>')
474             out.write("&gt;");
475         else if (attribute) {
476             if (msg == '"')
477                 out.write("&quot;");
478             else if (msg == '\'')
479                 out.write("&apos;");
480             else if (msg == '\n')
481                 out.write("&#xA;");
482             else if (msg == '\t')
483                 out.write("&#x9;");
484             else
485                 out.write(msg);
486         }
487         else
488             out.write(msg);
489     }
490
491     public void changePropertyByName(String JavaDoc name, Object JavaDoc value) {
492         if (name == null) return;
493         name = name.intern();
494         if (name == "namespace")
495             setNamespace((java.lang.String JavaDoc)value);
496         else if (name == "prefix")
497             setPrefix((java.lang.String JavaDoc)value);
498         else if (name == "template")
499             addTemplate((TemplateType)value);
500         else if (name == "template[]")
501             setTemplate((TemplateType[]) value);
502         else
503             throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for TemplateGroup");
504     }
505
506     public Object JavaDoc fetchPropertyByName(String JavaDoc name) {
507         if (name == "namespace")
508             return getNamespace();
509         if (name == "prefix")
510             return getPrefix();
511         if (name == "template[]")
512             return getTemplate();
513         throw new IllegalArgumentException JavaDoc(name+" is not a valid property name for TemplateGroup");
514     }
515
516     public String JavaDoc nameSelf() {
517         return "/TemplateGroup";
518     }
519
520     public String JavaDoc nameChild(Object JavaDoc childObj) {
521         return nameChild(childObj, false, false);
522     }
523
524     /**
525      * @param childObj The child object to search for
526      * @param returnSchemaName Whether or not the schema name should be returned or the property name
527      * @return null if not found
528      */

529     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName) {
530         return nameChild(childObj, returnConstName, returnSchemaName, false);
531     }
532
533     /**
534      * @param childObj The child object to search for
535      * @param returnSchemaName Whether or not the schema name should be returned or the property name
536      * @return null if not found
537      */

538     public String JavaDoc nameChild(Object JavaDoc childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) {
539         if (childObj instanceof java.lang.String JavaDoc) {
540             java.lang.String JavaDoc child = (java.lang.String JavaDoc) childObj;
541             if (child == _Namespace) {
542                 if (returnConstName) {
543                     return NAMESPACE;
544                 } else if (returnSchemaName) {
545                     return "namespace";
546                 } else if (returnXPathName) {
547                     return "@namespace";
548                 } else {
549                     return "Namespace";
550                 }
551             }
552             if (child == _Prefix) {
553                 if (returnConstName) {
554                     return PREFIX;
555                 } else if (returnSchemaName) {
556                     return "prefix";
557                 } else if (returnXPathName) {
558                     return "@prefix";
559                 } else {
560                     return "Prefix";
561                 }
562             }
563         }
564         if (childObj instanceof TemplateType) {
565             TemplateType child = (TemplateType) childObj;
566             int index = 0;
567             for (java.util.Iterator JavaDoc it = _Template.iterator();
568                 it.hasNext(); ) {
569                 org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it.next();
570                 if (child == element) {
571                     if (returnConstName) {
572                         return TEMPLATE;
573                     } else if (returnSchemaName) {
574                         return "template";
575                     } else if (returnXPathName) {
576                         return "template[position()="+index+"]";
577                     } else {
578                         return "Template."+Integer.toHexString(index);
579                     }
580                 }
581                 ++index;
582             }
583         }
584         return null;
585     }
586
587     /**
588      * Return an array of all of the properties that are beans and are set.
589      */

590     public java.lang.Object JavaDoc[] childBeans(boolean recursive) {
591         java.util.List JavaDoc children = new java.util.LinkedList JavaDoc();
592         childBeans(recursive, children);
593         java.lang.Object JavaDoc[] result = new java.lang.Object JavaDoc[children.size()];
594         return (java.lang.Object JavaDoc[]) children.toArray(result);
595     }
596
597     /**
598      * Put all child beans into the beans list.
599      */

600     public void childBeans(boolean recursive, java.util.List JavaDoc beans) {
601         for (java.util.Iterator JavaDoc it = _Template.iterator(); it.hasNext(); ) {
602             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it.next();
603             if (element != null) {
604                 if (recursive) {
605                     element.childBeans(true, beans);
606                 }
607                 beans.add(element);
608             }
609         }
610     }
611
612     public boolean equals(Object JavaDoc o) {
613         return o instanceof org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup && equals((org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup) o);
614     }
615
616     public boolean equals(org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateGroup inst) {
617         if (inst == this) {
618             return true;
619         }
620         if (inst == null) {
621             return false;
622         }
623         if (!(_Namespace == null ? inst._Namespace == null : _Namespace.equals(inst._Namespace))) {
624             return false;
625         }
626         if (!(_Prefix == null ? inst._Prefix == null : _Prefix.equals(inst._Prefix))) {
627             return false;
628         }
629         if (sizeTemplate() != inst.sizeTemplate())
630             return false;
631         // Compare every element.
632
for (java.util.Iterator JavaDoc it = _Template.iterator(), it2 = inst._Template.iterator();
633             it.hasNext() && it2.hasNext(); ) {
634             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType element = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it.next();
635             org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType element2 = (org.netbeans.modules.xml.wsdl.ui.view.wizard.TemplateType)it2.next();
636             if (!(element == null ? element2 == null : element.equals(element2))) {
637                 return false;
638             }
639         }
640         return true;
641     }
642
643     public int hashCode() {
644         int result = 17;
645         result = 37*result + (_Namespace == null ? 0 : _Namespace.hashCode());
646         result = 37*result + (_Prefix == null ? 0 : _Prefix.hashCode());
647         result = 37*result + (_Template == null ? 0 : _Template.hashCode());
648         return result;
649     }
650
651 }
652
653
654 /*
655         The following schema file has been used for generation:
656
657 <?xml version="1.0" encoding="UTF-8"?>
658
659 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
660             targetNamespace="http://xml.netbeans.org/schema/templates"
661             xmlns:tns="http://xml.netbeans.org/schema/templates"
662             elementFormDefault="qualified">
663     <xsd:element name="templateGroup">
664         <xsd:complexType>
665             <xsd:sequence>
666                 <xsd:element name="template" type="tns:templateType" maxOccurs="unbounded"/>
667             </xsd:sequence>
668             <xsd:attribute name="namespace" type="xsd:string"/>
669             <xsd:attribute name="prefix" type="xsd:string"/>
670         </xsd:complexType>
671     </xsd:element>
672     <xsd:complexType name="templateType">
673         <xsd:sequence>
674             <xsd:element name="wsdlElement" type="tns:wsdlElementType" maxOccurs="unbounded"/>
675         </xsd:sequence>
676         <xsd:attribute name="name" type="xsd:string"/>
677         <xsd:attribute name="default" type="xsd:boolean"/>
678     </xsd:complexType>
679     <xsd:complexType name="wsdlElementType">
680         <xsd:sequence>
681             <xsd:element name="extensionElement" type="tns:extensionElementType" maxOccurs="unbounded"/>
682         </xsd:sequence>
683         <xsd:attribute name="name" type="xsd:string"/>
684     </xsd:complexType>
685     <xsd:complexType name="extensionElementType">
686         <xsd:sequence>
687             <xsd:element name="extensionAttr" type="tns:extensionAttrType" maxOccurs="unbounded"/>
688         </xsd:sequence>
689         <xsd:attribute name="name" type="xsd:string"/>
690     </xsd:complexType>
691     <xsd:complexType name="extensionAttrType">
692         <xsd:attribute name="name" type="xsd:string"/>
693         <xsd:attribute name="defaultValue" type="xsd:string"/>
694     </xsd:complexType>
695 </xsd:schema>
696
697
698 */

699
Popular Tags