1 19 27 28 package org.netbeans.modules.j2ee.sun.share.configbean.customizers.data; 29 30 public class PropertyList { 31 public static final String EDITABLE = "Editable"; public static final String DESCRIPTION = "Description"; public static final String BUNDLEPATH = "BundlePath"; public static final String PROPERTY_NAME = "PropertyName"; public static final String PROPERTY_PARAM = "PropertyParam"; public static final String HELP_ID = "HelpId"; 38 private java.lang.String _Editable = "false"; 39 private java.lang.String _Description = "true"; 40 private java.lang.String _BundlePath; 41 private String _PropertyName; 42 private java.util.List _PropertyParam = new java.util.ArrayList (); private String _HelpId; 44 45 48 public PropertyList() { 49 _PropertyName = ""; 50 } 51 52 55 public PropertyList(java.lang.String editable, java.lang.String description, String propertyName, org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam[] propertyParam) { 56 _Editable = editable; 57 _Description = description; 58 _PropertyName = propertyName; 59 if (propertyParam!= null) { 60 ((java.util.ArrayList ) _PropertyParam).ensureCapacity(propertyParam.length); 61 for (int i = 0; i < propertyParam.length; ++i) { 62 _PropertyParam.add(propertyParam[i]); 63 } 64 } 65 } 66 67 70 public PropertyList(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList source) { 71 this(source, false); 72 } 73 74 78 public PropertyList(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList source, boolean justData) { 79 _Editable = source._Editable; 80 _Description = source._Description; 81 _BundlePath = source._BundlePath; 82 _PropertyName = source._PropertyName; 83 for (java.util.Iterator it = source._PropertyParam.iterator(); 84 it.hasNext(); ) { 85 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam srcElement = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it.next(); 86 _PropertyParam.add((srcElement == null) ? null : newPropertyParam(srcElement, justData)); 87 } 88 _HelpId = source._HelpId; 89 } 90 91 public void setEditable(java.lang.String value) { 93 _Editable = value; 94 } 95 96 public java.lang.String getEditable() { 97 return _Editable; 98 } 99 100 public void setDescription(java.lang.String value) { 102 _Description = value; 103 } 104 105 public java.lang.String getDescription() { 106 return _Description; 107 } 108 109 public void setBundlePath(java.lang.String value) { 111 _BundlePath = value; 112 } 113 114 public java.lang.String getBundlePath() { 115 return _BundlePath; 116 } 117 118 public void setPropertyName(String value) { 120 _PropertyName = value; 121 } 122 123 public String getPropertyName() { 124 return _PropertyName; 125 } 126 127 public void setPropertyParam(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam[] value) { 129 if (value == null) 130 value = new PropertyParam[0]; 131 _PropertyParam.clear(); 132 ((java.util.ArrayList ) _PropertyParam).ensureCapacity(value.length); 133 for (int i = 0; i < value.length; ++i) { 134 _PropertyParam.add(value[i]); 135 } 136 } 137 138 public void setPropertyParam(int index, org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam value) { 139 _PropertyParam.set(index, value); 140 } 141 142 public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam[] getPropertyParam() { 143 PropertyParam[] arr = new PropertyParam[_PropertyParam.size()]; 144 return (PropertyParam[]) _PropertyParam.toArray(arr); 145 } 146 147 public java.util.List fetchPropertyParamList() { 148 return _PropertyParam; 149 } 150 public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam getPropertyParam(int index) { 151 return (PropertyParam)_PropertyParam.get(index); 152 } 153 154 public int sizePropertyParam() { 156 return _PropertyParam.size(); 157 } 158 159 public int addPropertyParam(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam value) { 160 _PropertyParam.add(value); 161 int positionOfNewItem = _PropertyParam.size()-1; 162 return positionOfNewItem; 163 } 164 165 168 public int removePropertyParam(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam value) { 169 int pos = _PropertyParam.indexOf(value); 170 if (pos >= 0) { 171 _PropertyParam.remove(pos); 172 } 173 return pos; 174 } 175 176 public void setHelpId(String value) { 178 _HelpId = value; 179 } 180 181 public String getHelpId() { 182 return _HelpId; 183 } 184 185 189 public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam newPropertyParam() { 190 return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam(); 191 } 192 193 197 public org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam newPropertyParam(PropertyParam source, boolean justData) { 198 return new org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam(source, justData); 199 } 200 201 public void writeNode(java.io.Writer out) throws java.io.IOException { 202 String myName; 203 myName = "property-list"; 204 writeNode(out, myName, ""); } 206 207 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 208 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 209 } 210 211 214 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 215 out.write(indent); 216 out.write("<"); 217 if (namespace != null) { 218 out.write((String )namespaceMap.get(namespace)); 219 out.write(":"); 220 } 221 out.write(nodeName); 222 if (_Editable != null) { 224 out.write(" editable='"); 225 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties.writeXML(out, _Editable, true); 226 out.write("'"); } 228 if (_Description != null) { 230 out.write(" description='"); 231 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties.writeXML(out, _Description, true); 232 out.write("'"); } 234 if (_BundlePath != null) { 236 out.write(" bundle-path='"); 237 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties.writeXML(out, _BundlePath, true); 238 out.write("'"); } 240 out.write(">\n"); 241 String nextIndent = indent + " "; 242 if (_PropertyName != null) { 243 out.write(nextIndent); 244 out.write("<property-name"); out.write(">"); org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties.writeXML(out, _PropertyName, false); 247 out.write("</property-name>\n"); } 249 for (java.util.Iterator it = _PropertyParam.iterator(); 250 it.hasNext(); ) { 251 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it.next(); 252 if (element != null) { 253 element.writeNode(out, "property-param", null, nextIndent, namespaceMap); 254 } 255 } 256 if (_HelpId != null) { 257 out.write(nextIndent); 258 out.write("<help-id"); out.write(">"); org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.DynamicProperties.writeXML(out, _HelpId, false); 261 out.write("</help-id>\n"); } 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 public void readNode(org.w3c.dom.Node node) { 274 readNode(node, new java.util.HashMap ()); 275 } 276 277 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 278 if (node.hasAttributes()) { 279 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 280 org.w3c.dom.Attr attr; 281 java.lang.String attrValue; 282 boolean firstNamespaceDef = true; 283 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 284 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 285 String attrName = attr.getName(); 286 if (attrName.startsWith("xmlns:")) { 287 if (firstNamespaceDef) { 288 firstNamespaceDef = false; 289 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 291 } 292 String attrNSPrefix = attrName.substring(6, attrName.length()); 293 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 294 } 295 } 296 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("editable"); 297 if (attr != null) { 298 attrValue = attr.getValue(); 299 _Editable = attrValue; 300 } 301 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("description"); 302 if (attr != null) { 303 attrValue = attr.getValue(); 304 _Description = attrValue; 305 } 306 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("bundle-path"); 307 if (attr != null) { 308 attrValue = attr.getValue(); 309 _BundlePath = attrValue; 310 } 311 } 312 org.w3c.dom.NodeList children = node.getChildNodes(); 313 for (int i = 0, size = children.getLength(); i < size; ++i) { 314 org.w3c.dom.Node childNode = children.item(i); 315 String childNodeName = (childNode.getLocalName() == null ? childNode.getNodeName().intern() : childNode.getLocalName().intern()); 316 String childNodeValue = ""; 317 if (childNode.getFirstChild() != null) { 318 childNodeValue = childNode.getFirstChild().getNodeValue(); 319 } 320 if (childNodeName == "property-name") { 321 _PropertyName = childNodeValue; 322 } 323 else if (childNodeName == "property-param") { 324 PropertyParam aPropertyParam = newPropertyParam(); 325 aPropertyParam.readNode(childNode, namespacePrefixes); 326 _PropertyParam.add(aPropertyParam); 327 } 328 else if (childNodeName == "help-id") { 329 _HelpId = childNodeValue; 330 } 331 else { 332 } 334 } 335 } 336 337 public void changePropertyByName(String name, Object value) { 338 if (name == null) return; 339 name = name.intern(); 340 if (name == "editable") 341 setEditable((java.lang.String )value); 342 else if (name == "description") 343 setDescription((java.lang.String )value); 344 else if (name == "bundlePath") 345 setBundlePath((java.lang.String )value); 346 else if (name == "propertyName") 347 setPropertyName((String )value); 348 else if (name == "propertyParam") 349 addPropertyParam((PropertyParam)value); 350 else if (name == "propertyParam[]") 351 setPropertyParam((PropertyParam[]) value); 352 else if (name == "helpId") 353 setHelpId((String )value); 354 else 355 throw new IllegalArgumentException (name+" is not a valid property name for PropertyList"); 356 } 357 358 public Object fetchPropertyByName(String name) { 359 if (name == "editable") 360 return getEditable(); 361 if (name == "description") 362 return getDescription(); 363 if (name == "bundlePath") 364 return getBundlePath(); 365 if (name == "propertyName") 366 return getPropertyName(); 367 if (name == "propertyParam[]") 368 return getPropertyParam(); 369 if (name == "helpId") 370 return getHelpId(); 371 throw new IllegalArgumentException (name+" is not a valid property name for PropertyList"); 372 } 373 374 public String nameSelf() { 375 return "PropertyList"; 376 } 377 378 public String nameChild(Object childObj) { 379 return nameChild(childObj, false, false); 380 } 381 382 387 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 388 return nameChild(childObj, returnConstName, returnSchemaName, false); 389 } 390 391 396 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 397 if (childObj instanceof java.lang.String ) { 398 java.lang.String child = (java.lang.String ) childObj; 399 if (child == _Editable) { 400 if (returnConstName) { 401 return EDITABLE; 402 } else if (returnSchemaName) { 403 return "editable"; 404 } else if (returnXPathName) { 405 return "@editable"; 406 } else { 407 return "Editable"; 408 } 409 } 410 if (child == _Description) { 411 if (returnConstName) { 412 return DESCRIPTION; 413 } else if (returnSchemaName) { 414 return "description"; 415 } else if (returnXPathName) { 416 return "@description"; 417 } else { 418 return "Description"; 419 } 420 } 421 if (child == _BundlePath) { 422 if (returnConstName) { 423 return BUNDLEPATH; 424 } else if (returnSchemaName) { 425 return "bundle-path"; 426 } else if (returnXPathName) { 427 return "@bundle-path"; 428 } else { 429 return "BundlePath"; 430 } 431 } 432 if (child == _PropertyName) { 433 if (returnConstName) { 434 return PROPERTY_NAME; 435 } else if (returnSchemaName) { 436 return "property-name"; 437 } else if (returnXPathName) { 438 return "property-name"; 439 } else { 440 return "PropertyName"; 441 } 442 } 443 if (child == _HelpId) { 444 if (returnConstName) { 445 return HELP_ID; 446 } else if (returnSchemaName) { 447 return "help-id"; 448 } else if (returnXPathName) { 449 return "help-id"; 450 } else { 451 return "HelpId"; 452 } 453 } 454 } 455 if (childObj instanceof PropertyParam) { 456 PropertyParam child = (PropertyParam) childObj; 457 int index = 0; 458 for (java.util.Iterator it = _PropertyParam.iterator(); 459 it.hasNext(); ) { 460 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it.next(); 461 if (child == element) { 462 if (returnConstName) { 463 return PROPERTY_PARAM; 464 } else if (returnSchemaName) { 465 return "property-param"; 466 } else if (returnXPathName) { 467 return "property-param[position()="+index+"]"; 468 } else { 469 return "PropertyParam."+Integer.toHexString(index); 470 } 471 } 472 ++index; 473 } 474 } 475 return null; 476 } 477 478 481 public java.lang.Object [] childBeans(boolean recursive) { 482 java.util.List children = new java.util.LinkedList (); 483 childBeans(recursive, children); 484 java.lang.Object [] result = new java.lang.Object [children.size()]; 485 return (java.lang.Object []) children.toArray(result); 486 } 487 488 491 public void childBeans(boolean recursive, java.util.List beans) { 492 for (java.util.Iterator it = _PropertyParam.iterator(); 493 it.hasNext(); ) { 494 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it.next(); 495 if (element != null) { 496 if (recursive) { 497 element.childBeans(true, beans); 498 } 499 beans.add(element); 500 } 501 } 502 } 503 504 public boolean equals(Object o) { 505 return o instanceof org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList && equals((org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList) o); 506 } 507 508 public boolean equals(org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyList inst) { 509 if (inst == this) { 510 return true; 511 } 512 if (inst == null) { 513 return false; 514 } 515 if (!(_Editable == null ? inst._Editable == null : _Editable.equals(inst._Editable))) { 516 return false; 517 } 518 if (!(_Description == null ? inst._Description == null : _Description.equals(inst._Description))) { 519 return false; 520 } 521 if (!(_BundlePath == null ? inst._BundlePath == null : _BundlePath.equals(inst._BundlePath))) { 522 return false; 523 } 524 if (!(_PropertyName == null ? inst._PropertyName == null : _PropertyName.equals(inst._PropertyName))) { 525 return false; 526 } 527 if (sizePropertyParam() != inst.sizePropertyParam()) 528 return false; 529 for (java.util.Iterator it = _PropertyParam.iterator(), it2 = inst._PropertyParam.iterator(); 531 it.hasNext() && it2.hasNext(); ) { 532 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam element = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it.next(); 533 org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam element2 = (org.netbeans.modules.j2ee.sun.share.configbean.customizers.data.PropertyParam)it2.next(); 534 if (!(element == null ? element2 == null : element.equals(element2))) { 535 return false; 536 } 537 } 538 if (!(_HelpId == null ? inst._HelpId == null : _HelpId.equals(inst._HelpId))) { 539 return false; 540 } 541 return true; 542 } 543 544 public int hashCode() { 545 int result = 17; 546 result = 37*result + (_Editable == null ? 0 : _Editable.hashCode()); 547 result = 37*result + (_Description == null ? 0 : _Description.hashCode()); 548 result = 37*result + (_BundlePath == null ? 0 : _BundlePath.hashCode()); 549 result = 37*result + (_PropertyName == null ? 0 : _PropertyName.hashCode()); 550 result = 37*result + (_PropertyParam == null ? 0 : _PropertyParam.hashCode()); 551 result = 37*result + (_HelpId == null ? 0 : _HelpId.hashCode()); 552 return result; 553 } 554 555 } 556 557 558 693 694 | Popular Tags |