1 19 26 27 package org.netbeans.modules.j2ee.sun.dd.impl.transform; 28 29 import org.w3c.dom.*; 30 import org.netbeans.modules.schema2beans.*; 31 import java.beans.*; 32 import java.util.*; 33 34 36 public class ModElement extends org.netbeans.modules.schema2beans.BaseBean 37 { 38 39 static Vector comparators = new Vector(); 40 private static final org.netbeans.modules.schema2beans.Version runtimeVersion = new org.netbeans.modules.schema2beans.Version(4, 2, 0); 41 42 static public final String NAME = "Name"; static public final String MOD_ATTRIBUTE = "ModAttribute"; static public final String SUB_ELEMENT = "SubElement"; 46 public ModElement() { 47 this(Common.USE_DEFAULT_VALUES); 48 } 49 50 public ModElement(int options) 51 { 52 super(comparators, runtimeVersion); 53 initPropertyTables(3); 55 this.createProperty("name", NAME, 57 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 58 String .class); 59 this.createProperty("mod-attribute", MOD_ATTRIBUTE, 61 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 62 ModAttribute.class); 63 this.createProperty("sub-element", SUB_ELEMENT, 65 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 66 SubElement.class); 67 this.initialize(options); 68 } 69 70 void initialize(int options) { 72 73 } 74 75 public void setName(String value) { 77 this.setValue(NAME, value); 78 } 79 80 public String getName() { 82 return (String )this.getValue(NAME); 83 } 84 85 public void setModAttribute(int index, ModAttribute value) { 87 this.setValue(MOD_ATTRIBUTE, index, value); 88 } 89 90 public ModAttribute getModAttribute(int index) { 92 return (ModAttribute)this.getValue(MOD_ATTRIBUTE, index); 93 } 94 95 public int sizeModAttribute() { 97 return this.size(MOD_ATTRIBUTE); 98 } 99 100 public void setModAttribute(ModAttribute[] value) { 102 this.setValue(MOD_ATTRIBUTE, value); 103 } 104 105 public ModAttribute[] getModAttribute() { 107 return (ModAttribute[])this.getValues(MOD_ATTRIBUTE); 108 } 109 110 public int addModAttribute(ModAttribute value) { 112 int positionOfNewItem = this.addValue(MOD_ATTRIBUTE, value); 113 return positionOfNewItem; 114 } 115 116 public int removeModAttribute(ModAttribute value) { 121 return this.removeValue(MOD_ATTRIBUTE, value); 122 } 123 124 public void setSubElement(int index, SubElement value) { 126 this.setValue(SUB_ELEMENT, index, value); 127 } 128 129 public SubElement getSubElement(int index) { 131 return (SubElement)this.getValue(SUB_ELEMENT, index); 132 } 133 134 public int sizeSubElement() { 136 return this.size(SUB_ELEMENT); 137 } 138 139 public void setSubElement(SubElement[] value) { 141 this.setValue(SUB_ELEMENT, value); 142 } 143 144 public SubElement[] getSubElement() { 146 return (SubElement[])this.getValues(SUB_ELEMENT); 147 } 148 149 public int addSubElement(SubElement value) { 151 int positionOfNewItem = this.addValue(SUB_ELEMENT, value); 152 return positionOfNewItem; 153 } 154 155 public int removeSubElement(SubElement value) { 160 return this.removeValue(SUB_ELEMENT, value); 161 } 162 163 167 public ModAttribute newModAttribute() { 168 return new ModAttribute(); 169 } 170 171 175 public SubElement newSubElement() { 176 return new SubElement(); 177 } 178 179 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 181 comparators.add(c); 182 } 183 184 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 186 comparators.remove(c); 187 } 188 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 189 boolean restrictionFailure = false; 190 boolean restrictionPassed = false; 191 if (getName() == null) { 193 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, "name", this); } 195 for (int _index = 0; _index < sizeModAttribute(); ++_index) { 197 ModAttribute element = getModAttribute(_index); 198 if (element != null) { 199 element.validate(); 200 } 201 } 202 for (int _index = 0; _index < sizeSubElement(); ++_index) { 204 SubElement element = getSubElement(_index); 205 if (element != null) { 206 element.validate(); 207 } 208 } 209 } 210 211 public void dump(StringBuffer str, String indent){ 213 String s; 214 Object o; 215 org.netbeans.modules.schema2beans.BaseBean n; 216 str.append(indent); 217 str.append("Name"); str.append(indent+"\t"); str.append("<"); o = this.getName(); 221 str.append((o==null?"null":o.toString().trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 224 225 str.append(indent); 226 str.append("ModAttribute["+this.sizeModAttribute()+"]"); for(int i=0; i<this.sizeModAttribute(); i++) 228 { 229 str.append(indent+"\t"); 230 str.append("#"+i+":"); 231 n = (org.netbeans.modules.schema2beans.BaseBean) this.getModAttribute(i); 232 if (n != null) 233 n.dump(str, indent + "\t"); else 235 str.append(indent+"\tnull"); this.dumpAttributes(MOD_ATTRIBUTE, i, str, indent); 237 } 238 239 str.append(indent); 240 str.append("SubElement["+this.sizeSubElement()+"]"); for(int i=0; i<this.sizeSubElement(); i++) 242 { 243 str.append(indent+"\t"); 244 str.append("#"+i+":"); 245 n = (org.netbeans.modules.schema2beans.BaseBean) this.getSubElement(i); 246 if (n != null) 247 n.dump(str, indent + "\t"); else 249 str.append(indent+"\tnull"); this.dumpAttributes(SUB_ELEMENT, i, str, indent); 251 } 252 253 } 254 public String dumpBeanNode(){ 255 StringBuffer str = new StringBuffer (); 256 str.append("ModElement\n"); this.dump(str, "\n "); return str.toString(); 259 }} 260 261 263 264 289 | Popular Tags |