1 19 20 42 43 package org.netbeans.modules.xml.wsdl.ui.property.model; 44 45 public class Property { 46 public static final String ATTRIBUTENAME = "AttributeName"; public static final String ISNAMEABLEATTRIBUTE = "IsNameableAttribute"; public static final String DECORATORATTRIBUTE = "DecoratorAttribute"; public static final String GROUPNAME = "GroupName"; public static final String PROPERTYORDER = "PropertyOrder"; public static final String SCHEMACUSTOMIZER = "SchemaCustomizer"; public static final String BUILTINCUSTOMIZER = "BuiltInCustomizer"; public static final String NEWCUSTOMIZER = "NewCustomizer"; 55 private java.lang.String _AttributeName; 56 private boolean _IsNameableAttribute = false; 57 private javax.xml.namespace.QName _DecoratorAttribute; 58 private java.lang.String _GroupName; 59 private int _PropertyOrder; 60 private java.lang.Boolean _SchemaCustomizer; 61 private BuiltInCustomizer _BuiltInCustomizer; 62 private String _NewCustomizer; 63 64 67 public Property() { 68 _AttributeName = ""; 69 } 70 71 74 public Property(java.lang.String attributeName, boolean isNameableAttribute) { 75 _AttributeName = attributeName; 76 _IsNameableAttribute = isNameableAttribute; 77 } 78 79 82 public Property(org.netbeans.modules.xml.wsdl.ui.property.model.Property source) { 83 this(source, false); 84 } 85 86 90 public Property(org.netbeans.modules.xml.wsdl.ui.property.model.Property source, boolean justData) { 91 _AttributeName = source._AttributeName; 92 _IsNameableAttribute = source._IsNameableAttribute; 93 _DecoratorAttribute = source._DecoratorAttribute; 94 _GroupName = source._GroupName; 95 _PropertyOrder = source._PropertyOrder; 96 _SchemaCustomizer = source._SchemaCustomizer; 97 _BuiltInCustomizer = (source._BuiltInCustomizer == null) ? null : newBuiltInCustomizer(source._BuiltInCustomizer, justData); 98 _NewCustomizer = source._NewCustomizer; 99 } 100 101 public void setAttributeName(java.lang.String value) { 103 _AttributeName = value; 104 } 105 106 public java.lang.String getAttributeName() { 107 return _AttributeName; 108 } 109 110 public void setIsNameableAttribute(boolean value) { 112 _IsNameableAttribute = value; 113 } 114 115 public boolean isIsNameableAttribute() { 116 return _IsNameableAttribute; 117 } 118 119 public void setDecoratorAttribute(javax.xml.namespace.QName value) { 121 _DecoratorAttribute = value; 122 } 123 124 public javax.xml.namespace.QName getDecoratorAttribute() { 125 return _DecoratorAttribute; 126 } 127 128 public void setGroupName(java.lang.String value) { 130 _GroupName = value; 131 } 132 133 public java.lang.String getGroupName() { 134 return _GroupName; 135 } 136 137 public void setPropertyOrder(int value) { 139 _PropertyOrder = value; 140 } 141 142 public int getPropertyOrder() { 143 return _PropertyOrder; 144 } 145 146 public void setSchemaCustomizer(java.lang.Boolean value) { 148 _SchemaCustomizer = value; 149 if (value != null) { 150 setBuiltInCustomizer(null); 152 setNewCustomizer(null); 153 } 154 } 155 156 public java.lang.Boolean getSchemaCustomizer() { 157 return _SchemaCustomizer; 158 } 159 160 public void setBuiltInCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer value) { 162 _BuiltInCustomizer = value; 163 if (value != null) { 164 setSchemaCustomizer(null); 166 setNewCustomizer(null); 167 } 168 } 169 170 public org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer getBuiltInCustomizer() { 171 return _BuiltInCustomizer; 172 } 173 174 public void setNewCustomizer(String value) { 176 _NewCustomizer = value; 177 if (value != null) { 178 setSchemaCustomizer(null); 180 setBuiltInCustomizer(null); 181 } 182 } 183 184 public String getNewCustomizer() { 185 return _NewCustomizer; 186 } 187 188 192 public org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer newBuiltInCustomizer() { 193 return new org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer(); 194 } 195 196 200 public org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer newBuiltInCustomizer(BuiltInCustomizer source, boolean justData) { 201 return new org.netbeans.modules.xml.wsdl.ui.property.model.BuiltInCustomizer(source, justData); 202 } 203 204 public void writeNode(java.io.Writer out) throws java.io.IOException { 205 String myName; 206 myName = "Property"; 207 writeNode(out, myName, ""); } 209 210 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 211 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 212 } 213 214 217 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 218 out.write(indent); 219 out.write("<"); 220 if (namespace != null) { 221 out.write((String )namespaceMap.get(namespace)); 222 out.write(":"); 223 } 224 out.write(nodeName); 225 boolean firstNSAddition = true; 227 if (_DecoratorAttribute != null && _DecoratorAttribute.getNamespaceURI() != null && !"".equals(_DecoratorAttribute.getNamespaceURI())) { 228 String prefix = (String ) namespaceMap.get(_DecoratorAttribute.getNamespaceURI()); 229 if (prefix == null || "".equals(prefix)) { 230 prefix = _DecoratorAttribute.getPrefix(); 231 if (prefix == null || "".equals(prefix)) { 232 prefix = "decoratorAttribute_ns__"; 233 } 234 boolean changed; 236 do { 237 changed = false; 238 for (java.util.Iterator valueIt = namespaceMap.values().iterator(); 239 valueIt.hasNext(); ) { 240 String otherPrefix = (String ) valueIt.next(); 241 if (prefix.equals(otherPrefix)) { 242 prefix += "_"; 243 changed = true; 244 } 245 } 246 } while (changed); 247 if (firstNSAddition) { 248 firstNSAddition = false; 249 namespaceMap = new java.util.HashMap (namespaceMap); 251 } 252 namespaceMap.put(_DecoratorAttribute.getNamespaceURI(), prefix); 253 out.write(" xmlns:"); 254 out.write(prefix); 255 out.write("='"); 256 out.write(_DecoratorAttribute.getNamespaceURI()); 257 out.write("'"); 258 } 259 } 260 writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap); 261 out.write(">\n"); 262 writeNodeChildren(out, nodeName, namespace, indent, namespaceMap); 263 out.write(indent); 264 out.write("</"); 265 if (namespace != null) { 266 out.write((String )namespaceMap.get(namespace)); 267 out.write(":"); 268 } 269 out.write(nodeName); 270 out.write(">\n"); 271 } 272 273 protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 274 if (_AttributeName != null) { 276 out.write(" attributeName='"); 277 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _AttributeName, true); 278 out.write("'"); } 280 out.write(" isNameableAttribute='"); 282 out.write(_IsNameableAttribute ? "true" : "false"); 283 out.write("'"); if (_DecoratorAttribute != null) { 286 out.write(" decoratorAttribute='"); 287 if (_DecoratorAttribute.getNamespaceURI() != null && !"".equals(_DecoratorAttribute.getNamespaceURI())) { 288 out.write((String ) namespaceMap.get(_DecoratorAttribute.getNamespaceURI())); 289 out.write(":"); 290 } 291 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _DecoratorAttribute.getLocalPart(), true); 292 out.write("'"); } 294 if (_GroupName != null) { 296 out.write(" groupName='"); 297 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _GroupName, true); 298 out.write("'"); } 300 out.write(" propertyOrder='"); 302 out.write(""+_PropertyOrder); 303 out.write("'"); } 305 306 protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 307 String nextIndent = indent + " "; 308 if (_SchemaCustomizer != null) { 309 out.write(nextIndent); 310 out.write("<SchemaCustomizer"); out.write(">"); out.write(_SchemaCustomizer.toString()); 313 out.write("</SchemaCustomizer>\n"); } 315 if (_BuiltInCustomizer != null) { 316 _BuiltInCustomizer.writeNode(out, "BuiltInCustomizer", null, nextIndent, namespaceMap); 317 } 318 if (_NewCustomizer != null) { 319 out.write(nextIndent); 320 out.write("<NewCustomizer"); out.write(">"); org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _NewCustomizer, false); 323 out.write("</NewCustomizer>\n"); } 325 } 326 327 public void readNode(org.w3c.dom.Node node) { 328 readNode(node, new java.util.HashMap ()); 329 } 330 331 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 332 if (node.hasAttributes()) { 333 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 334 org.w3c.dom.Attr attr; 335 java.lang.String attrValue; 336 boolean firstNamespaceDef = true; 337 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 338 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 339 String attrName = attr.getName(); 340 if (attrName.startsWith("xmlns:")) { 341 if (firstNamespaceDef) { 342 firstNamespaceDef = false; 343 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 345 } 346 String attrNSPrefix = attrName.substring(6, attrName.length()); 347 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 348 } 349 } 350 readNodeAttributes(node, namespacePrefixes, attrs); 351 } 352 readNodeChildren(node, namespacePrefixes); 353 } 354 355 protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) { 356 org.w3c.dom.Attr attr; 357 java.lang.String attrValue; 358 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("attributeName"); 359 if (attr != null) { 360 attrValue = attr.getValue(); 361 _AttributeName = attrValue; 362 } 363 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("isNameableAttribute"); 364 if (attr != null) { 365 attrValue = attr.getValue(); 366 _IsNameableAttribute = java.lang.Boolean.valueOf(attrValue).booleanValue(); 367 } 368 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("decoratorAttribute"); 369 if (attr != null) { 370 attrValue = attr.getValue(); 371 int colonPos = attrValue.indexOf(':'); 372 if (colonPos < 0) { 373 _DecoratorAttribute = new javax.xml.namespace.QName (attrValue); 374 } else { 375 java.util.Map nsPrefixes = new java.util.HashMap (namespacePrefixes); 376 for (int attrNum = 0; attrNum < attrs.getLength(); 377 ++attrNum) { 378 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 379 String attrName = attr.getName(); 380 if (attrName.startsWith("xmlns:")) { 381 String attrNSPrefix = attrName.substring(6, attrName.length()); 382 nsPrefixes.put(attrNSPrefix, attr.getValue()); 383 } 384 } 385 String prefix = attrValue.substring(0, colonPos); 386 String ns = (String ) nsPrefixes.get(prefix); 387 String localPart = attrValue.substring(colonPos+1, attrValue.length()); 388 _DecoratorAttribute = new javax.xml.namespace.QName (ns, localPart, prefix); 389 } 390 } 391 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("groupName"); 392 if (attr != null) { 393 attrValue = attr.getValue(); 394 _GroupName = attrValue; 395 } 396 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("propertyOrder"); 397 if (attr != null) { 398 attrValue = attr.getValue(); 399 _PropertyOrder = Integer.parseInt(attrValue); 400 } 401 } 402 403 protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 404 org.w3c.dom.NodeList children = node.getChildNodes(); 405 for (int i = 0, size = children.getLength(); i < size; ++i) { 406 org.w3c.dom.Node childNode = children.item(i); 407 String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern()); 408 String childNodeValue = ""; 409 if (childNode.getFirstChild() != null) { 410 childNodeValue = childNode.getFirstChild().getNodeValue(); 411 } 412 org.w3c.dom.NamedNodeMap attrs = childNode.getAttributes(); 413 org.w3c.dom.Attr attr; 414 java.lang.String attrValue; 415 if (childNodeName == "SchemaCustomizer") { 416 if (childNode.getFirstChild() == null) 417 _SchemaCustomizer = Boolean.TRUE; 418 else 419 _SchemaCustomizer = java.lang.Boolean.valueOf(childNodeValue); 420 } 421 else if (childNodeName == "BuiltInCustomizer") { 422 _BuiltInCustomizer = newBuiltInCustomizer(); 423 _BuiltInCustomizer.readNode(childNode, namespacePrefixes); 424 } 425 else if (childNodeName == "NewCustomizer") { 426 _NewCustomizer = childNodeValue; 427 } 428 else { 429 } 431 } 432 } 433 434 public void changePropertyByName(String name, Object value) { 435 if (name == null) return; 436 name = name.intern(); 437 if (name == "attributeName") 438 setAttributeName((java.lang.String )value); 439 else if (name == "isNameableAttribute") 440 setIsNameableAttribute(((java.lang.Boolean )value).booleanValue()); 441 else if (name == "decoratorAttribute") 442 setDecoratorAttribute((javax.xml.namespace.QName )value); 443 else if (name == "groupName") 444 setGroupName((java.lang.String )value); 445 else if (name == "propertyOrder") 446 setPropertyOrder(((java.lang.Integer )value).intValue()); 447 else if (name == "schemaCustomizer") 448 setSchemaCustomizer((java.lang.Boolean )value); 449 else if (name == "builtInCustomizer") 450 setBuiltInCustomizer((BuiltInCustomizer)value); 451 else if (name == "newCustomizer") 452 setNewCustomizer((String )value); 453 else 454 throw new IllegalArgumentException (name+" is not a valid property name for Property"); 455 } 456 457 public Object fetchPropertyByName(String name) { 458 if (name == "attributeName") 459 return getAttributeName(); 460 if (name == "isNameableAttribute") 461 return (isIsNameableAttribute() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); 462 if (name == "decoratorAttribute") 463 return getDecoratorAttribute(); 464 if (name == "groupName") 465 return getGroupName(); 466 if (name == "propertyOrder") 467 return new java.lang.Integer (getPropertyOrder()); 468 if (name == "schemaCustomizer") 469 return getSchemaCustomizer(); 470 if (name == "builtInCustomizer") 471 return getBuiltInCustomizer(); 472 if (name == "newCustomizer") 473 return getNewCustomizer(); 474 throw new IllegalArgumentException (name+" is not a valid property name for Property"); 475 } 476 477 public String nameSelf() { 478 return "Property"; 479 } 480 481 public String nameChild(Object childObj) { 482 return nameChild(childObj, false, false); 483 } 484 485 490 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 491 return nameChild(childObj, returnConstName, returnSchemaName, false); 492 } 493 494 499 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 500 if (childObj instanceof BuiltInCustomizer) { 501 BuiltInCustomizer child = (BuiltInCustomizer) childObj; 502 if (child == _BuiltInCustomizer) { 503 if (returnConstName) { 504 return BUILTINCUSTOMIZER; 505 } else if (returnSchemaName) { 506 return "BuiltInCustomizer"; 507 } else if (returnXPathName) { 508 return "BuiltInCustomizer"; 509 } else { 510 return "BuiltInCustomizer"; 511 } 512 } 513 } 514 if (childObj instanceof java.lang.Boolean ) { 515 java.lang.Boolean child = (java.lang.Boolean ) childObj; 516 if (((java.lang.Boolean )child).booleanValue() == _IsNameableAttribute) { 517 if (returnConstName) { 518 return ISNAMEABLEATTRIBUTE; 519 } else if (returnSchemaName) { 520 return "isNameableAttribute"; 521 } else if (returnXPathName) { 522 return "@isNameableAttribute"; 523 } else { 524 return "IsNameableAttribute"; 525 } 526 } 527 if (child == _SchemaCustomizer) { 528 if (returnConstName) { 529 return SCHEMACUSTOMIZER; 530 } else if (returnSchemaName) { 531 return "SchemaCustomizer"; 532 } else if (returnXPathName) { 533 return "SchemaCustomizer"; 534 } else { 535 return "SchemaCustomizer"; 536 } 537 } 538 } 539 if (childObj instanceof javax.xml.namespace.QName ) { 540 javax.xml.namespace.QName child = (javax.xml.namespace.QName ) childObj; 541 if (child == _DecoratorAttribute) { 542 if (returnConstName) { 543 return DECORATORATTRIBUTE; 544 } else if (returnSchemaName) { 545 return "decoratorAttribute"; 546 } else if (returnXPathName) { 547 return "@decoratorAttribute"; 548 } else { 549 return "DecoratorAttribute"; 550 } 551 } 552 } 553 if (childObj instanceof java.lang.Integer ) { 554 java.lang.Integer child = (java.lang.Integer ) childObj; 555 if (((java.lang.Integer )child).intValue() == _PropertyOrder) { 556 if (returnConstName) { 557 return PROPERTYORDER; 558 } else if (returnSchemaName) { 559 return "propertyOrder"; 560 } else if (returnXPathName) { 561 return "@propertyOrder"; 562 } else { 563 return "PropertyOrder"; 564 } 565 } 566 } 567 if (childObj instanceof java.lang.String ) { 568 java.lang.String child = (java.lang.String ) childObj; 569 if (child == _AttributeName) { 570 if (returnConstName) { 571 return ATTRIBUTENAME; 572 } else if (returnSchemaName) { 573 return "attributeName"; 574 } else if (returnXPathName) { 575 return "@attributeName"; 576 } else { 577 return "AttributeName"; 578 } 579 } 580 if (child == _GroupName) { 581 if (returnConstName) { 582 return GROUPNAME; 583 } else if (returnSchemaName) { 584 return "groupName"; 585 } else if (returnXPathName) { 586 return "@groupName"; 587 } else { 588 return "GroupName"; 589 } 590 } 591 if (child == _NewCustomizer) { 592 if (returnConstName) { 593 return NEWCUSTOMIZER; 594 } else if (returnSchemaName) { 595 return "NewCustomizer"; 596 } else if (returnXPathName) { 597 return "NewCustomizer"; 598 } else { 599 return "NewCustomizer"; 600 } 601 } 602 } 603 return null; 604 } 605 606 609 public java.lang.Object [] childBeans(boolean recursive) { 610 java.util.List children = new java.util.LinkedList (); 611 childBeans(recursive, children); 612 java.lang.Object [] result = new java.lang.Object [children.size()]; 613 return (java.lang.Object []) children.toArray(result); 614 } 615 616 619 public void childBeans(boolean recursive, java.util.List beans) { 620 if (_BuiltInCustomizer != null) { 621 if (recursive) { 622 _BuiltInCustomizer.childBeans(true, beans); 623 } 624 beans.add(_BuiltInCustomizer); 625 } 626 } 627 628 public boolean equals(Object o) { 629 return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.Property && equals((org.netbeans.modules.xml.wsdl.ui.property.model.Property) o); 630 } 631 632 public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.Property inst) { 633 if (inst == this) { 634 return true; 635 } 636 if (inst == null) { 637 return false; 638 } 639 if (!(_AttributeName == null ? inst._AttributeName == null : _AttributeName.equals(inst._AttributeName))) { 640 return false; 641 } 642 if (!(_IsNameableAttribute == inst._IsNameableAttribute)) { 643 return false; 644 } 645 if (!(_DecoratorAttribute == null ? inst._DecoratorAttribute == null : _DecoratorAttribute.equals(inst._DecoratorAttribute))) { 646 return false; 647 } 648 if (!(_GroupName == null ? inst._GroupName == null : _GroupName.equals(inst._GroupName))) { 649 return false; 650 } 651 if (!(_PropertyOrder == inst._PropertyOrder)) { 652 return false; 653 } 654 if (!(_SchemaCustomizer == null ? inst._SchemaCustomizer == null : _SchemaCustomizer.equals(inst._SchemaCustomizer))) { 655 return false; 656 } 657 if (!(_BuiltInCustomizer == null ? inst._BuiltInCustomizer == null : _BuiltInCustomizer.equals(inst._BuiltInCustomizer))) { 658 return false; 659 } 660 if (!(_NewCustomizer == null ? inst._NewCustomizer == null : _NewCustomizer.equals(inst._NewCustomizer))) { 661 return false; 662 } 663 return true; 664 } 665 666 public int hashCode() { 667 int result = 17; 668 result = 37*result + (_AttributeName == null ? 0 : _AttributeName.hashCode()); 669 result = 37*result + (_IsNameableAttribute ? 0 : 1); 670 result = 37*result + (_DecoratorAttribute == null ? 0 : _DecoratorAttribute.hashCode()); 671 result = 37*result + (_GroupName == null ? 0 : _GroupName.hashCode()); 672 result = 37*result + (_PropertyOrder); 673 result = 37*result + (_SchemaCustomizer == null ? 0 : _SchemaCustomizer.hashCode()); 674 result = 37*result + (_BuiltInCustomizer == null ? 0 : _BuiltInCustomizer.hashCode()); 675 result = 37*result + (_NewCustomizer == null ? 0 : _NewCustomizer.hashCode()); 676 return result; 677 } 678 679 } 680 681 682 908 | Popular Tags |