1 19 20 38 39 package org.netbeans.modules.xml.wsdl.ui.property.model; 40 41 public class ElementOrTypeOrMessagePartChooser { 42 public static final String ELEMENTATTRIBUTENAME = "ElementAttributeName"; public static final String TYPEATTRIBUTENAME = "TypeAttributeName"; public static final String MESSAGEATTRIBUTENAME = "MessageAttributeName"; public static final String PARTATTRIBUTENAME = "PartAttributeName"; 47 private java.lang.String _ElementAttributeName; 48 private java.lang.String _TypeAttributeName; 49 private java.lang.String _MessageAttributeName; 50 private java.lang.String _PartAttributeName; 51 52 55 public ElementOrTypeOrMessagePartChooser() { 56 } 57 58 61 public ElementOrTypeOrMessagePartChooser(org.netbeans.modules.xml.wsdl.ui.property.model.ElementOrTypeOrMessagePartChooser source) { 62 this(source, false); 63 } 64 65 69 public ElementOrTypeOrMessagePartChooser(org.netbeans.modules.xml.wsdl.ui.property.model.ElementOrTypeOrMessagePartChooser source, boolean justData) { 70 _ElementAttributeName = source._ElementAttributeName; 71 _TypeAttributeName = source._TypeAttributeName; 72 _MessageAttributeName = source._MessageAttributeName; 73 _PartAttributeName = source._PartAttributeName; 74 } 75 76 public void setElementAttributeName(java.lang.String value) { 78 _ElementAttributeName = value; 79 } 80 81 public java.lang.String getElementAttributeName() { 82 return _ElementAttributeName; 83 } 84 85 public void setTypeAttributeName(java.lang.String value) { 87 _TypeAttributeName = value; 88 } 89 90 public java.lang.String getTypeAttributeName() { 91 return _TypeAttributeName; 92 } 93 94 public void setMessageAttributeName(java.lang.String value) { 96 _MessageAttributeName = value; 97 } 98 99 public java.lang.String getMessageAttributeName() { 100 return _MessageAttributeName; 101 } 102 103 public void setPartAttributeName(java.lang.String value) { 105 _PartAttributeName = value; 106 } 107 108 public java.lang.String getPartAttributeName() { 109 return _PartAttributeName; 110 } 111 112 public void writeNode(java.io.Writer out) throws java.io.IOException { 113 String myName; 114 myName = "ElementOrTypeOrMessagePartChooser"; 115 writeNode(out, myName, ""); } 117 118 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 119 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 120 } 121 122 125 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 126 out.write(indent); 127 out.write("<"); 128 if (namespace != null) { 129 out.write((String )namespaceMap.get(namespace)); 130 out.write(":"); 131 } 132 out.write(nodeName); 133 writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap); 134 writeNodeChildren(out, nodeName, namespace, indent, namespaceMap); 135 out.write("/>\n"); 136 } 137 138 protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 139 if (_ElementAttributeName != null) { 141 out.write(" elementAttributeName='"); 142 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _ElementAttributeName, true); 143 out.write("'"); } 145 if (_TypeAttributeName != null) { 147 out.write(" typeAttributeName='"); 148 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _TypeAttributeName, true); 149 out.write("'"); } 151 if (_MessageAttributeName != null) { 153 out.write(" messageAttributeName='"); 154 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _MessageAttributeName, true); 155 out.write("'"); } 157 if (_PartAttributeName != null) { 159 out.write(" partAttributeName='"); 160 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _PartAttributeName, true); 161 out.write("'"); } 163 } 164 165 protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 166 } 167 168 public void readNode(org.w3c.dom.Node node) { 169 readNode(node, new java.util.HashMap ()); 170 } 171 172 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 173 if (node.hasAttributes()) { 174 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 175 org.w3c.dom.Attr attr; 176 java.lang.String attrValue; 177 boolean firstNamespaceDef = true; 178 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 179 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 180 String attrName = attr.getName(); 181 if (attrName.startsWith("xmlns:")) { 182 if (firstNamespaceDef) { 183 firstNamespaceDef = false; 184 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 186 } 187 String attrNSPrefix = attrName.substring(6, attrName.length()); 188 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 189 } 190 } 191 readNodeAttributes(node, namespacePrefixes, attrs); 192 } 193 readNodeChildren(node, namespacePrefixes); 194 } 195 196 protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) { 197 org.w3c.dom.Attr attr; 198 java.lang.String attrValue; 199 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("elementAttributeName"); 200 if (attr != null) { 201 attrValue = attr.getValue(); 202 _ElementAttributeName = attrValue; 203 } 204 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("typeAttributeName"); 205 if (attr != null) { 206 attrValue = attr.getValue(); 207 _TypeAttributeName = attrValue; 208 } 209 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("messageAttributeName"); 210 if (attr != null) { 211 attrValue = attr.getValue(); 212 _MessageAttributeName = attrValue; 213 } 214 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("partAttributeName"); 215 if (attr != null) { 216 attrValue = attr.getValue(); 217 _PartAttributeName = attrValue; 218 } 219 } 220 221 protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 222 } 223 224 public void changePropertyByName(String name, Object value) { 225 if (name == null) return; 226 name = name.intern(); 227 if (name == "elementAttributeName") 228 setElementAttributeName((java.lang.String )value); 229 else if (name == "typeAttributeName") 230 setTypeAttributeName((java.lang.String )value); 231 else if (name == "messageAttributeName") 232 setMessageAttributeName((java.lang.String )value); 233 else if (name == "partAttributeName") 234 setPartAttributeName((java.lang.String )value); 235 else 236 throw new IllegalArgumentException (name+" is not a valid property name for ElementOrTypeOrMessagePartChooser"); 237 } 238 239 public Object fetchPropertyByName(String name) { 240 if (name == "elementAttributeName") 241 return getElementAttributeName(); 242 if (name == "typeAttributeName") 243 return getTypeAttributeName(); 244 if (name == "messageAttributeName") 245 return getMessageAttributeName(); 246 if (name == "partAttributeName") 247 return getPartAttributeName(); 248 throw new IllegalArgumentException (name+" is not a valid property name for ElementOrTypeOrMessagePartChooser"); 249 } 250 251 public String nameSelf() { 252 return "ElementOrTypeOrMessagePartChooser"; 253 } 254 255 public String nameChild(Object childObj) { 256 return nameChild(childObj, false, false); 257 } 258 259 264 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 265 return nameChild(childObj, returnConstName, returnSchemaName, false); 266 } 267 268 273 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 274 if (childObj instanceof java.lang.String ) { 275 java.lang.String child = (java.lang.String ) childObj; 276 if (child == _ElementAttributeName) { 277 if (returnConstName) { 278 return ELEMENTATTRIBUTENAME; 279 } else if (returnSchemaName) { 280 return "elementAttributeName"; 281 } else if (returnXPathName) { 282 return "@elementAttributeName"; 283 } else { 284 return "ElementAttributeName"; 285 } 286 } 287 if (child == _TypeAttributeName) { 288 if (returnConstName) { 289 return TYPEATTRIBUTENAME; 290 } else if (returnSchemaName) { 291 return "typeAttributeName"; 292 } else if (returnXPathName) { 293 return "@typeAttributeName"; 294 } else { 295 return "TypeAttributeName"; 296 } 297 } 298 if (child == _MessageAttributeName) { 299 if (returnConstName) { 300 return MESSAGEATTRIBUTENAME; 301 } else if (returnSchemaName) { 302 return "messageAttributeName"; 303 } else if (returnXPathName) { 304 return "@messageAttributeName"; 305 } else { 306 return "MessageAttributeName"; 307 } 308 } 309 if (child == _PartAttributeName) { 310 if (returnConstName) { 311 return PARTATTRIBUTENAME; 312 } else if (returnSchemaName) { 313 return "partAttributeName"; 314 } else if (returnXPathName) { 315 return "@partAttributeName"; 316 } else { 317 return "PartAttributeName"; 318 } 319 } 320 } 321 return null; 322 } 323 324 327 public java.lang.Object [] childBeans(boolean recursive) { 328 java.util.List children = new java.util.LinkedList (); 329 childBeans(recursive, children); 330 java.lang.Object [] result = new java.lang.Object [children.size()]; 331 return (java.lang.Object []) children.toArray(result); 332 } 333 334 337 public void childBeans(boolean recursive, java.util.List beans) { 338 } 339 340 public boolean equals(Object o) { 341 return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.ElementOrTypeOrMessagePartChooser && equals((org.netbeans.modules.xml.wsdl.ui.property.model.ElementOrTypeOrMessagePartChooser) o); 342 } 343 344 public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.ElementOrTypeOrMessagePartChooser inst) { 345 if (inst == this) { 346 return true; 347 } 348 if (inst == null) { 349 return false; 350 } 351 if (!(_ElementAttributeName == null ? inst._ElementAttributeName == null : _ElementAttributeName.equals(inst._ElementAttributeName))) { 352 return false; 353 } 354 if (!(_TypeAttributeName == null ? inst._TypeAttributeName == null : _TypeAttributeName.equals(inst._TypeAttributeName))) { 355 return false; 356 } 357 if (!(_MessageAttributeName == null ? inst._MessageAttributeName == null : _MessageAttributeName.equals(inst._MessageAttributeName))) { 358 return false; 359 } 360 if (!(_PartAttributeName == null ? inst._PartAttributeName == null : _PartAttributeName.equals(inst._PartAttributeName))) { 361 return false; 362 } 363 return true; 364 } 365 366 public int hashCode() { 367 int result = 17; 368 result = 37*result + (_ElementAttributeName == null ? 0 : _ElementAttributeName.hashCode()); 369 result = 37*result + (_TypeAttributeName == null ? 0 : _TypeAttributeName.hashCode()); 370 result = 37*result + (_MessageAttributeName == null ? 0 : _MessageAttributeName.hashCode()); 371 result = 37*result + (_PartAttributeName == null ? 0 : _PartAttributeName.hashCode()); 372 return result; 373 } 374 375 } 376 377 378 604 | Popular Tags |