1 19 20 34 35 package org.netbeans.modules.xml.wsdl.ui.property.model; 36 37 public class StaticCustomizer { 38 public static final String DEPENDSONATTRIBUTENAME = "DependsOnAttributeName"; 40 private javax.xml.namespace.QName _DependsOnAttributeName; 41 42 45 public StaticCustomizer() { 46 } 47 48 51 public StaticCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.StaticCustomizer source) { 52 this(source, false); 53 } 54 55 59 public StaticCustomizer(org.netbeans.modules.xml.wsdl.ui.property.model.StaticCustomizer source, boolean justData) { 60 _DependsOnAttributeName = source._DependsOnAttributeName; 61 } 62 63 public void setDependsOnAttributeName(javax.xml.namespace.QName value) { 65 _DependsOnAttributeName = value; 66 } 67 68 public javax.xml.namespace.QName getDependsOnAttributeName() { 69 return _DependsOnAttributeName; 70 } 71 72 public void writeNode(java.io.Writer out) throws java.io.IOException { 73 String myName; 74 myName = "StaticCustomizer"; 75 writeNode(out, myName, ""); } 77 78 public void writeNode(java.io.Writer out, String nodeName, String indent) throws java.io.IOException { 79 writeNode(out, nodeName, null, indent, new java.util.HashMap ()); 80 } 81 82 85 public void writeNode(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 86 out.write(indent); 87 out.write("<"); 88 if (namespace != null) { 89 out.write((String )namespaceMap.get(namespace)); 90 out.write(":"); 91 } 92 out.write(nodeName); 93 boolean firstNSAddition = true; 95 if (_DependsOnAttributeName != null && _DependsOnAttributeName.getNamespaceURI() != null && !"".equals(_DependsOnAttributeName.getNamespaceURI())) { 96 String prefix = (String ) namespaceMap.get(_DependsOnAttributeName.getNamespaceURI()); 97 if (prefix == null || "".equals(prefix)) { 98 prefix = _DependsOnAttributeName.getPrefix(); 99 if (prefix == null || "".equals(prefix)) { 100 prefix = "dependsOnAttributeName_ns__"; 101 } 102 boolean changed; 104 do { 105 changed = false; 106 for (java.util.Iterator valueIt = namespaceMap.values().iterator(); 107 valueIt.hasNext(); ) { 108 String otherPrefix = (String ) valueIt.next(); 109 if (prefix.equals(otherPrefix)) { 110 prefix += "_"; 111 changed = true; 112 } 113 } 114 } while (changed); 115 if (firstNSAddition) { 116 firstNSAddition = false; 117 namespaceMap = new java.util.HashMap (namespaceMap); 119 } 120 namespaceMap.put(_DependsOnAttributeName.getNamespaceURI(), prefix); 121 out.write(" xmlns:"); 122 out.write(prefix); 123 out.write("='"); 124 out.write(_DependsOnAttributeName.getNamespaceURI()); 125 out.write("'"); 126 } 127 } 128 writeNodeAttributes(out, nodeName, namespace, indent, namespaceMap); 129 writeNodeChildren(out, nodeName, namespace, indent, namespaceMap); 130 out.write("/>\n"); 131 } 132 133 protected void writeNodeAttributes(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 134 if (_DependsOnAttributeName != null) { 136 out.write(" dependsOnAttributeName='"); 137 if (_DependsOnAttributeName.getNamespaceURI() != null && !"".equals(_DependsOnAttributeName.getNamespaceURI())) { 138 out.write((String ) namespaceMap.get(_DependsOnAttributeName.getNamespaceURI())); 139 out.write(":"); 140 } 141 org.netbeans.modules.xml.wsdl.ui.property.model.ElementProperties.writeXML(out, _DependsOnAttributeName.getLocalPart(), true); 142 out.write("'"); } 144 } 145 146 protected void writeNodeChildren(java.io.Writer out, String nodeName, String namespace, String indent, java.util.Map namespaceMap) throws java.io.IOException { 147 } 148 149 public void readNode(org.w3c.dom.Node node) { 150 readNode(node, new java.util.HashMap ()); 151 } 152 153 public void readNode(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 154 if (node.hasAttributes()) { 155 org.w3c.dom.NamedNodeMap attrs = node.getAttributes(); 156 org.w3c.dom.Attr attr; 157 java.lang.String attrValue; 158 boolean firstNamespaceDef = true; 159 for (int attrNum = 0; attrNum < attrs.getLength(); ++attrNum) { 160 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 161 String attrName = attr.getName(); 162 if (attrName.startsWith("xmlns:")) { 163 if (firstNamespaceDef) { 164 firstNamespaceDef = false; 165 namespacePrefixes = new java.util.HashMap (namespacePrefixes); 167 } 168 String attrNSPrefix = attrName.substring(6, attrName.length()); 169 namespacePrefixes.put(attrNSPrefix, attr.getValue()); 170 } 171 } 172 readNodeAttributes(node, namespacePrefixes, attrs); 173 } 174 readNodeChildren(node, namespacePrefixes); 175 } 176 177 protected void readNodeAttributes(org.w3c.dom.Node node, java.util.Map namespacePrefixes, org.w3c.dom.NamedNodeMap attrs) { 178 org.w3c.dom.Attr attr; 179 java.lang.String attrValue; 180 attr = (org.w3c.dom.Attr ) attrs.getNamedItem("dependsOnAttributeName"); 181 if (attr != null) { 182 attrValue = attr.getValue(); 183 int colonPos = attrValue.indexOf(':'); 184 if (colonPos < 0) { 185 _DependsOnAttributeName = new javax.xml.namespace.QName (attrValue); 186 } else { 187 java.util.Map nsPrefixes = new java.util.HashMap (namespacePrefixes); 188 for (int attrNum = 0; attrNum < attrs.getLength(); 189 ++attrNum) { 190 attr = (org.w3c.dom.Attr ) attrs.item(attrNum); 191 String attrName = attr.getName(); 192 if (attrName.startsWith("xmlns:")) { 193 String attrNSPrefix = attrName.substring(6, attrName.length()); 194 nsPrefixes.put(attrNSPrefix, attr.getValue()); 195 } 196 } 197 String prefix = attrValue.substring(0, colonPos); 198 String ns = (String ) nsPrefixes.get(prefix); 199 String localPart = attrValue.substring(colonPos+1, attrValue.length()); 200 _DependsOnAttributeName = new javax.xml.namespace.QName (ns, localPart, prefix); 201 } 202 } 203 } 204 205 protected void readNodeChildren(org.w3c.dom.Node node, java.util.Map namespacePrefixes) { 206 } 207 208 public void changePropertyByName(String name, Object value) { 209 if (name == null) return; 210 name = name.intern(); 211 if (name == "dependsOnAttributeName") 212 setDependsOnAttributeName((javax.xml.namespace.QName )value); 213 else 214 throw new IllegalArgumentException (name+" is not a valid property name for StaticCustomizer"); 215 } 216 217 public Object fetchPropertyByName(String name) { 218 if (name == "dependsOnAttributeName") 219 return getDependsOnAttributeName(); 220 throw new IllegalArgumentException (name+" is not a valid property name for StaticCustomizer"); 221 } 222 223 public String nameSelf() { 224 return "StaticCustomizer"; 225 } 226 227 public String nameChild(Object childObj) { 228 return nameChild(childObj, false, false); 229 } 230 231 236 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName) { 237 return nameChild(childObj, returnConstName, returnSchemaName, false); 238 } 239 240 245 public String nameChild(Object childObj, boolean returnConstName, boolean returnSchemaName, boolean returnXPathName) { 246 if (childObj instanceof javax.xml.namespace.QName ) { 247 javax.xml.namespace.QName child = (javax.xml.namespace.QName ) childObj; 248 if (child == _DependsOnAttributeName) { 249 if (returnConstName) { 250 return DEPENDSONATTRIBUTENAME; 251 } else if (returnSchemaName) { 252 return "dependsOnAttributeName"; 253 } else if (returnXPathName) { 254 return "@dependsOnAttributeName"; 255 } else { 256 return "DependsOnAttributeName"; 257 } 258 } 259 } 260 return null; 261 } 262 263 266 public java.lang.Object [] childBeans(boolean recursive) { 267 java.util.List children = new java.util.LinkedList (); 268 childBeans(recursive, children); 269 java.lang.Object [] result = new java.lang.Object [children.size()]; 270 return (java.lang.Object []) children.toArray(result); 271 } 272 273 276 public void childBeans(boolean recursive, java.util.List beans) { 277 } 278 279 public boolean equals(Object o) { 280 return o instanceof org.netbeans.modules.xml.wsdl.ui.property.model.StaticCustomizer && equals((org.netbeans.modules.xml.wsdl.ui.property.model.StaticCustomizer) o); 281 } 282 283 public boolean equals(org.netbeans.modules.xml.wsdl.ui.property.model.StaticCustomizer inst) { 284 if (inst == this) { 285 return true; 286 } 287 if (inst == null) { 288 return false; 289 } 290 if (!(_DependsOnAttributeName == null ? inst._DependsOnAttributeName == null : _DependsOnAttributeName.equals(inst._DependsOnAttributeName))) { 291 return false; 292 } 293 return true; 294 } 295 296 public int hashCode() { 297 int result = 17; 298 result = 37*result + (_DependsOnAttributeName == null ? 0 : _DependsOnAttributeName.hashCode()); 299 return result; 300 } 301 302 } 303 304 305 531 | Popular Tags |