1 19 20 72 73 package org.netbeans.modules.xml.wsdl.ui.property.model; 74 75 public class ElementProperties { 76 public static final String PROPERTYGROUP = "PropertyGroup"; public static final String PROPERTY = "Property"; public static final String GROUPEDPROPERTY = "GroupedProperty"; 80 private java.util.List _PropertyGroup = new java.util.ArrayList (); private java.util.List _Property = new java.util.ArrayList (); private java.util.List _GroupedProperty = new java.util.ArrayList (); private java.lang.String schemaLocation; 84 85 88 public ElementProperties() { 89 } 90 91 94 public ElementProperties(org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup[] propertyGroup, org.netbeans.modules.xml.wsdl.ui.property.model.Property[] property, org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty[] groupedProperty) { 95 if (propertyGroup!= null) { 96 ((java.util.ArrayList ) _PropertyGroup).ensureCapacity(propertyGroup.length); 97 for (int i = 0; i < propertyGroup.length; ++i) { 98 _PropertyGroup.add(propertyGroup[i]); 99 } 100 } 101 if (property!= null) { 102 ((java.util.ArrayList ) _Property).ensureCapacity(property.length); 103 for (int i = 0; i < property.length; ++i) { 104 _Property.add(property[i]); 105 } 106 } 107 if (groupedProperty!= null) { 108 ((java.util.ArrayList ) _GroupedProperty).ensureCapacity(groupedProperty.length); 109 for (int i = 0; i < groupedProperty.length; ++i) { 110 _GroupedProperty.add(groupedProperty[i]); 111 } 112 } 113 } 114 115 118 public ElementProperties(org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties source) { 119 this(source, false); 120 } 121 122 126 public ElementProperties(org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties source, boolean justData) { 127 for (java.util.Iterator it = source._PropertyGroup.iterator(); 128 it.hasNext(); ) { 129 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup srcElement = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it.next(); 130 _PropertyGroup.add((srcElement == null) ? null : newPropertyGroup(srcElement, justData)); 131 } 132 for (java.util.Iterator it = source._Property.iterator(); 133 it.hasNext(); ) { 134 org.netbeans.modules.xml.wsdl.ui.property.model.Property srcElement = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it.next(); 135 _Property.add((srcElement == null) ? null : newProperty(srcElement, justData)); 136 } 137 for (java.util.Iterator it = source._GroupedProperty.iterator(); 138 it.hasNext(); ) { 139 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty srcElement = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it.next(); 140 _GroupedProperty.add((srcElement == null) ? null : newGroupedProperty(srcElement, justData)); 141 } 142 schemaLocation = source.schemaLocation; 143 } 144 145 public void setPropertyGroup(org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup[] value) { 147 if (value == null) 148 value = new PropertyGroup[0]; 149 _PropertyGroup.clear(); 150 ((java.util.ArrayList ) _PropertyGroup).ensureCapacity(value.length); 151 for (int i = 0; i < value.length; ++i) { 152 _PropertyGroup.add(value[i]); 153 } 154 } 155 156 public void setPropertyGroup(int index, org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup value) { 157 _PropertyGroup.set(index, value); 158 } 159 160 public org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup[] getPropertyGroup() { 161 PropertyGroup[] arr = new PropertyGroup[_PropertyGroup.size()]; 162 return (PropertyGroup[]) _PropertyGroup.toArray(arr); 163 } 164 165 public java.util.List fetchPropertyGroupList() { 166 return _PropertyGroup; 167 } 168 169 public org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup getPropertyGroup(int index) { 170 return (PropertyGroup)_PropertyGroup.get(index); 171 } 172 173 public int sizePropertyGroup() { 175 return _PropertyGroup.size(); 176 } 177 178 public int addPropertyGroup(org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup value) { 179 _PropertyGroup.add(value); 180 int positionOfNewItem = _PropertyGroup.size()-1; 181 return positionOfNewItem; 182 } 183 184 187 public int removePropertyGroup(org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup value) { 188 int pos = _PropertyGroup.indexOf(value); 189 if (pos >= 0) { 190 _PropertyGroup.remove(pos); 191 } 192 return pos; 193 } 194 195 public void setProperty(org.netbeans.modules.xml.wsdl.ui.property.model.Property[] value) { 197 if (value == null) 198 value = new Property[0]; 199 _Property.clear(); 200 ((java.util.ArrayList ) _Property).ensureCapacity(value.length); 201 for (int i = 0; i < value.length; ++i) { 202 _Property.add(value[i]); 203 } 204 } 205 206 public void setProperty(int index, org.netbeans.modules.xml.wsdl.ui.property.model.Property value) { 207 _Property.set(index, value); 208 } 209 210 public org.netbeans.modules.xml.wsdl.ui.property.model.Property[] getProperty() { 211 Property[] arr = new Property[_Property.size()]; 212 return (Property[]) _Property.toArray(arr); 213 } 214 215 public java.util.List fetchPropertyList() { 216 return _Property; 217 } 218 219 public org.netbeans.modules.xml.wsdl.ui.property.model.Property getProperty(int index) { 220 return (Property)_Property.get(index); 221 } 222 223 public int sizeProperty() { 225 return _Property.size(); 226 } 227 228 public int addProperty(org.netbeans.modules.xml.wsdl.ui.property.model.Property value) { 229 _Property.add(value); 230 int positionOfNewItem = _Property.size()-1; 231 return positionOfNewItem; 232 } 233 234 237 public int removeProperty(org.netbeans.modules.xml.wsdl.ui.property.model.Property value) { 238 int pos = _Property.indexOf(value); 239 if (pos >= 0) { 240 _Property.remove(pos); 241 } 242 return pos; 243 } 244 245 public void setGroupedProperty(org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty[] value) { 247 if (value == null) 248 value = new GroupedProperty[0]; 249 _GroupedProperty.clear(); 250 ((java.util.ArrayList ) _GroupedProperty).ensureCapacity(value.length); 251 for (int i = 0; i < value.length; ++i) { 252 _GroupedProperty.add(value[i]); 253 } 254 } 255 256 public void setGroupedProperty(int index, org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty value) { 257 _GroupedProperty.set(index, value); 258 } 259 260 public org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty[] getGroupedProperty() { 261 GroupedProperty[] arr = new GroupedProperty[_GroupedProperty.size()]; 262 return (GroupedProperty[]) _GroupedProperty.toArray(arr); 263 } 264 265 public java.util.List fetchGroupedPropertyList() { 266 return _GroupedProperty; 267 } 268 269 public org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty getGroupedProperty(int index) { 270 return (GroupedProperty)_GroupedProperty.get(index); 271 } 272 273 public int sizeGroupedProperty() { 275 return _GroupedProperty.size(); 276 } 277 278 public int addGroupedProperty(org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty value) { 279 _GroupedProperty.add(value); 280 int positionOfNewItem = _GroupedProperty.size()-1; 281 return positionOfNewItem; 282 } 283 284 287 public int removeGroupedProperty(org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty value) { 288 int pos = _GroupedProperty.indexOf(value); 289 if (pos >= 0) { 290 _GroupedProperty.remove(pos); 291 } 292 return pos; 293 } 294 295 public void _setSchemaLocation(String location) { 296 schemaLocation = location; 297 } 298 299 public String _getSchemaLocation() { 300 return schemaLocation; 301 } 302 303 307 public org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup newPropertyGroup() { 308 return new org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup(); 309 } 310 311 315 public org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup newPropertyGroup(PropertyGroup source, boolean justData) { 316 return new org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup(source, justData); 317 } 318 319 323 public org.netbeans.modules.xml.wsdl.ui.property.model.Property newProperty() { 324 return new org.netbeans.modules.xml.wsdl.ui.property.model.Property(); 325 } 326 327 331 public org.netbeans.modules.xml.wsdl.ui.property.model.Property newProperty(Property source, boolean justData) { 332 return new org.netbeans.modules.xml.wsdl.ui.property.model.Property(source, justData); 333 } 334 335 339 public org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty newGroupedProperty() { 340 return new org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty(); 341 } 342 343 347 public org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty newGroupedProperty(GroupedProperty source, boolean justData) { 348 return new org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty(source, justData); 349 } 350 351 public void write(org.openide.filesystems.FileObject fo) throws java.io.IOException { 352 org.openide.filesystems.FileLock lock = fo.lock(); 353 try { 354 java.io.OutputStream out = fo.getOutputStream(lock); 355 write(out); 356 out.close(); 357 } finally { 358 lock.releaseLock(); 359 } 360 } 361 362 public void write(org.openide.filesystems.FileObject dir, String filename) throws java.io.IOException { 363 org.openide.filesystems.FileObject file = dir.getFileObject(filename); 364 if (file == null) { 365 file = dir.createData(filename); 366 } 367 write(file); 368 } 369 370 public void write(java.io.File f) throws java.io.IOException { 371 java.io.OutputStream out = new java.io.FileOutputStream (f); 372 try { 373 write(out); 374 } finally { 375 out.close(); 376 } 377 } 378 379 public void write(java.io.OutputStream out) throws java.io.IOException { 380 write(out, null); 381 } 382 383 public void write(java.io.OutputStream out, String encoding) throws java.io.IOException { 384 java.io.Writer w; 385 if (encoding == null) { 386 encoding = "UTF-8"; } 388 w = new java.io.BufferedWriter (new java.io.OutputStreamWriter (out, encoding)); 389 write(w, encoding); 390 w.flush(); 391 } 392 393 397 public void write(java.io.Writer out, String encoding) throws java.io.IOException { 398 out.write("<?xml version='1.0'"); if (encoding != null) 400 out.write(" encoding='"+encoding+"'"); out.write(" ?>\n"); writeNode(out, "ElementProperties", ""); } 404 405 public void writeNode(java.io.Writer out) throws java.io.IOException { 406 String myName; 407 myName = "ElementProperties"; 408 writeNode(out, myName, ""); } 410 411 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 412 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 413 } 414 415 418 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 419 out.write(indent); 420 out.write("<"); 421 if (namespace != null) { 422 out.write((String )namespaceMap.get(namespace)); 423 out.write(":"); 424 } 425 out.write(nodeName); 426 out.write(" xmlns='"); out.write("http://xml.netbeans.org/schema/wsdlui/property"); out.write("'"); if (schemaLocation != null) { 430 namespaceMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi"); 431 out.write(" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='"); 432 out.write(schemaLocation); 433 out.write("'"); } 435 writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap); 436 out.write(">\n"); 437 writeNodeChildren(out, nodeName, namespace, indent, namespaceMap); 438 out.write(indent); 439 out.write("</"); 440 if (namespace != null) { 441 out.write((String )namespaceMap.get(namespace)); 442 out.write(":"); 443 } 444 out.write(nodeName); 445 out.write(">\n"); 446 } 447 448 protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 449 } 450 451 protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 452 String nextIndent = indent + " "; 453 for (java.util.Iterator it = _PropertyGroup.iterator(); 454 it.hasNext(); ) { 455 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup element = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it.next(); 456 if (element != null) { 457 element.writeNode(out, "PropertyGroup", null, nextIndent, namespaceMap); 458 } 459 } 460 for (java.util.Iterator it = _Property.iterator(); it.hasNext(); ) { 461 org.netbeans.modules.xml.wsdl.ui.property.model.Property element = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it.next(); 462 if (element != null) { 463 element.writeNode(out, "Property", null, nextIndent, namespaceMap); 464 } 465 } 466 for (java.util.Iterator it = _GroupedProperty.iterator(); 467 it.hasNext(); ) { 468 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty element = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it.next(); 469 if (element != null) { 470 element.writeNode(out, "GroupedProperty", null, nextIndent, namespaceMap); 471 } 472 } 473 } 474 475 public static ElementProperties read(org.openide.filesystems.FileObject fo) throws javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException , java.io.IOException { 476 java.io.InputStream in = fo.getInputStream(); 477 try { 478 return read(in); 479 } finally { 480 in.close(); 481 } 482 } 483 484 public static ElementProperties read(java.io.File f) throws javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException , java.io.IOException { 485 java.io.InputStream in = new java.io.FileInputStream (f); 486 try { 487 return read(in); 488 } finally { 489 in.close(); 490 } 491 } 492 493 public static ElementProperties read(java.io.InputStream in) throws javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException , java.io.IOException { 494 return read(new org.xml.sax.InputSource (in), false, null, null); 495 } 496 497 503 public static ElementProperties readNoEntityResolver(java.io.InputStream in) throws javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException , java.io.IOException { 504 return read(new org.xml.sax.InputSource (in), false, 505 new org.xml.sax.EntityResolver () { 506 public org.xml.sax.InputSource resolveEntity(String publicId, String systemId) { 507 java.io.ByteArrayInputStream bin = new java.io.ByteArrayInputStream (new byte[0]); 508 return new org.xml.sax.InputSource (bin); 509 } 510 } 511 , null); 512 } 513 514 public static ElementProperties read(org.xml.sax.InputSource in, boolean validate, org.xml.sax.EntityResolver er, org.xml.sax.ErrorHandler eh) throws javax.xml.parsers.ParserConfigurationException , org.xml.sax.SAXException , java.io.IOException { 515 javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance(); 516 dbf.setValidating(validate); 517 dbf.setNamespaceAware(true); 518 javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder(); 519 if (er != null) db.setEntityResolver(er); 520 if (eh != null) db.setErrorHandler(eh); 521 org.w3c.dom.Document doc = db.parse(in); 522 return read(doc); 523 } 524 525 public static ElementProperties read(org.w3c.dom.Document document) { 526 ElementProperties aElementProperties = new ElementProperties(); 527 aElementProperties.readFromDocument(document); 528 return aElementProperties; 529 } 530 531 protected void readFromDocument(org.w3c.dom.Document document) { 532 readNode(document.getDocumentElement()); 533 } 534 535 public void readNode(org.w3c.dom.Node node) { 536 readNode(node, new java.util.HashMap ()); 537 } 538 539 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 540 if (node.hasAttributes()) { 541 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 542 org.w3c.dom.Attr attr; 543 java.lang.String attrValue; 544 boolean firstNamespaceDef = true; 545 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 546 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 547 String attrName = attr.getName(); 548 if (attrName.startsWith("xmlns:")) { 549 if (firstNamespaceDef) { 550 firstNamespaceDef = false; 551 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 553 } 554 String attrNSPrefix = attrName.substring(6, attrName.length()); 555 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 556 } 557 } 558 String xsiPrefix = "xsi"; 559 for (java.util.Iterator it = namespacePrefixes.keySet().iterator(); 560 it.hasNext(); ) { 561 String prefix = (String ) it.next(); 562 String ns = (String ) namespacePrefixes.get(prefix); 563 if ("http://www.w3.org/2001/XMLSchema-instance".equals(ns)) { 564 xsiPrefix = prefix; 565 break; 566 } 567 } 568 attr = (org.w3c.dom.Attr ) attrs.getNamedItem(""+xsiPrefix+":schemaLocation"); 569 if (attr != null) { 570 attrValue = attr.getValue(); 571 schemaLocation = attrValue; 572 } 573 readNodeAttributes(node, namespacePrefixes, attrs); 574 } 575 readNodeChildren(node, namespacePrefixes); 576 } 577 578 protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) { 579 org.w3c.dom.Attr attr; 580 java.lang.String attrValue; 581 } 582 583 protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 584 org.w3c.dom.NodeList children = node.getChildNodes(); 585 for (int i = 0, size = children.getLength(); i < size; ++i) { 586 org.w3c.dom.Node childNode = children.item(i); 587 String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern()); 588 String childNodeValue = ""; 589 if (childNode.getFirstChild() != null) { 590 childNodeValue = childNode.getFirstChild().getNodeValue(); 591 } 592 if (childNodeName == "PropertyGroup") { 593 PropertyGroup aPropertyGroup = newPropertyGroup(); 594 aPropertyGroup.readNode(childNode, namespacePrefixes); 595 _PropertyGroup.add(aPropertyGroup); 596 } 597 else if (childNodeName == "Property") { 598 Property aProperty = newProperty(); 599 aProperty.readNode(childNode, namespacePrefixes); 600 _Property.add(aProperty); 601 } 602 else if (childNodeName == "GroupedProperty") { 603 GroupedProperty aGroupedProperty = newGroupedProperty(); 604 aGroupedProperty.readNode(childNode, namespacePrefixes); 605 _GroupedProperty.add(aGroupedProperty); 606 } 607 else { 608 } 610 } 611 } 612 613 617 public static void writeXML(java.io.Writer out, String msg) throws java.io.IOException { 618 writeXML(out, msg, true); 619 } 620 621 public static void writeXML(java.io.Writer out, String msg, boolean attribute) throws java.io.IOException { 622 if (msg == null) 623 return; 624 int msgLength = msg.length(); 625 for (int i = 0; i < msgLength; ++i) { 626 char c = msg.charAt(i); 627 writeXML(out, c, attribute); 628 } 629 } 630 631 public static void writeXML(java.io.Writer out, char msg, boolean attribute) throws java.io.IOException { 632 if (msg == '&') 633 out.write("&"); 634 else if (msg == '<') 635 out.write("<"); 636 else if (msg == '>') 637 out.write(">"); 638 else if (attribute) { 639 if (msg == '"') 640 out.write("""); 641 else if (msg == '\'') 642 out.write("'"); 643 else if (msg == '\n') 644 out.write("
"); 645 else if (msg == '\t') 646 out.write("	"); 647 else 648 out.write(msg); 649 } 650 else 651 out.write(msg); 652 } 653 654 public void changePropertyByName(String name, Object value) { 655 if (name == null) return; 656 name = name.intern(); 657 if (name == "propertyGroup") 658 addPropertyGroup((PropertyGroup)value); 659 else if (name == "propertyGroup[]") 660 setPropertyGroup((PropertyGroup[]) value); 661 else if (name == "property") 662 addProperty((Property)value); 663 else if (name == "property[]") 664 setProperty((Property[]) value); 665 else if (name == "groupedProperty") 666 addGroupedProperty((GroupedProperty)value); 667 else if (name == "groupedProperty[]") 668 setGroupedProperty((GroupedProperty[]) value); 669 else 670 throw new IllegalArgumentException (name+" is not a valid property name for ElementProperties"); 671 } 672 673 public Object fetchPropertyByName(String name) { 674 if (name == "propertyGroup[]") 675 return getPropertyGroup(); 676 if (name == "property[]") 677 return getProperty(); 678 if (name == "groupedProperty[]") 679 return getGroupedProperty(); 680 throw new IllegalArgumentException (name+" is not a valid property name for ElementProperties"); 681 } 682 683 public String nameSelf() { 684 return "/ElementProperties"; 685 } 686 687 public String nameChild(Object childObj) { 688 return nameChild(childObj, false, false); 689 } 690 691 696 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 697 return nameChild(childObj, returnConstName, returnSchemaName, false); 698 } 699 700 705 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 706 if (childObj instanceof GroupedProperty) { 707 GroupedProperty child = (GroupedProperty) childObj; 708 int index = 0; 709 for (java.util.Iterator it = _GroupedProperty.iterator(); 710 it.hasNext(); ) { 711 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty element = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it.next(); 712 if (child == element) { 713 if (returnConstName) { 714 return GROUPEDPROPERTY; 715 } else if (returnSchemaName) { 716 return "GroupedProperty"; 717 } else if (returnXPathName) { 718 return "GroupedProperty[position()="+index+"]"; 719 } else { 720 return "GroupedProperty."+Integer.toHexString(index); 721 } 722 } 723 ++index; 724 } 725 } 726 if (childObj instanceof Property) { 727 Property child = (Property) childObj; 728 int index = 0; 729 for (java.util.Iterator it = _Property.iterator(); 730 it.hasNext(); ) { 731 org.netbeans.modules.xml.wsdl.ui.property.model.Property element = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it.next(); 732 if (child == element) { 733 if (returnConstName) { 734 return PROPERTY; 735 } else if (returnSchemaName) { 736 return "Property"; 737 } else if (returnXPathName) { 738 return "Property[position()="+index+"]"; 739 } else { 740 return "Property."+Integer.toHexString(index); 741 } 742 } 743 ++index; 744 } 745 } 746 if (childObj instanceof PropertyGroup) { 747 PropertyGroup child = (PropertyGroup) childObj; 748 int index = 0; 749 for (java.util.Iterator it = _PropertyGroup.iterator(); 750 it.hasNext(); ) { 751 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup element = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it.next(); 752 if (child == element) { 753 if (returnConstName) { 754 return PROPERTYGROUP; 755 } else if (returnSchemaName) { 756 return "PropertyGroup"; 757 } else if (returnXPathName) { 758 return "PropertyGroup[position()="+index+"]"; 759 } else { 760 return "PropertyGroup."+Integer.toHexString(index); 761 } 762 } 763 ++index; 764 } 765 } 766 return null; 767 } 768 769 772 public java.lang.Object [] childBeans(boolean recursive) { 773 java.util.List children = new java.util.LinkedList (); 774 childBeans(recursive, children); 775 java.lang.Object [] result = new java.lang.Object [children.size()]; 776 return (java.lang.Object []) children.toArray(result); 777 } 778 779 782 public void childBeans(boolean recursive, java.util.List beans) { 783 for (java.util.Iterator it = _PropertyGroup.iterator(); 784 it.hasNext(); ) { 785 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup element = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it.next(); 786 if (element != null) { 787 if (recursive) { 788 element.childBeans(true, beans); 789 } 790 beans.add(element); 791 } 792 } 793 for (java.util.Iterator it = _Property.iterator(); it.hasNext(); ) { 794 org.netbeans.modules.xml.wsdl.ui.property.model.Property element = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it.next(); 795 if (element != null) { 796 if (recursive) { 797 element.childBeans(true, beans); 798 } 799 beans.add(element); 800 } 801 } 802 for (java.util.Iterator it = _GroupedProperty.iterator(); 803 it.hasNext(); ) { 804 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty element = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it.next(); 805 if (element != null) { 806 if (recursive) { 807 element.childBeans(true, beans); 808 } 809 beans.add(element); 810 } 811 } 812 } 813 814 public boolean equals(Object o) { 815 return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties && equals((org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties) o); 816 } 817 818 public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties inst) { 819 if (inst == this) { 820 return true; 821 } 822 if (inst == null) { 823 return false; 824 } 825 if (sizePropertyGroup() != inst.sizePropertyGroup()) 826 return false; 827 for (java.util.Iterator it = _PropertyGroup.iterator(), it2 = inst._PropertyGroup.iterator(); 829 it.hasNext() && it2.hasNext(); ) { 830 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup element = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it.next(); 831 org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup element2 = (org.netbeans.modules.xml.wsdl.ui.property.model.PropertyGroup)it2.next(); 832 if (!(element == null ? element2 == null : element.equals(element2))) { 833 return false; 834 } 835 } 836 if (sizeProperty() != inst.sizeProperty()) 837 return false; 838 for (java.util.Iterator it = _Property.iterator(), it2 = inst._Property.iterator(); 840 it.hasNext() && it2.hasNext(); ) { 841 org.netbeans.modules.xml.wsdl.ui.property.model.Property element = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it.next(); 842 org.netbeans.modules.xml.wsdl.ui.property.model.Property element2 = (org.netbeans.modules.xml.wsdl.ui.property.model.Property)it2.next(); 843 if (!(element == null ? element2 == null : element.equals(element2))) { 844 return false; 845 } 846 } 847 if (sizeGroupedProperty() != inst.sizeGroupedProperty()) 848 return false; 849 for (java.util.Iterator it = _GroupedProperty.iterator(), it2 = inst._GroupedProperty.iterator(); 851 it.hasNext() && it2.hasNext(); ) { 852 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty element = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it.next(); 853 org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty element2 = (org.netbeans.modules.xml.wsdl.ui.property.model.GroupedProperty)it2.next(); 854 if (!(element == null ? element2 == null : element.equals(element2))) { 855 return false; 856 } 857 } 858 return true; 859 } 860 861 public int hashCode() { 862 int result = 17; 863 result = 37*result + (_PropertyGroup == null ? 0 : _PropertyGroup.hashCode()); 864 result = 37*result + (_Property == null ? 0 : _Property.hashCode()); 865 result = 37*result + (_GroupedProperty == null ? 0 : _GroupedProperty.hashCode()); 866 return result; 867 } 868 869 } 870 871 872 1098 | Popular Tags |