1 19 20 24 25 package org.netbeans.modules.j2ee.sun.validation.data; 26 27 import org.w3c.dom.*; 28 import org.netbeans.modules.schema2beans.*; 29 import java.beans.*; 30 import java.util.*; 31 32 34 public class Element extends org.netbeans.modules.schema2beans.BaseBean 35 { 36 37 static Vector comparators = new Vector(); 38 39 static public final String NAME = "Name"; static public final String CHECK = "Check"; 42 public Element() { 43 this(Common.USE_DEFAULT_VALUES); 44 } 45 46 public Element(int options) 47 { 48 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 49 this.createProperty("name", NAME, 52 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 53 String .class); 54 this.createProperty("check", CHECK, 56 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 57 Check.class); 58 this.initialize(options); 59 } 60 61 void initialize(int options) 63 { 64 65 } 66 67 public void setName(String value) { 69 this.setValue(NAME, value); 70 } 71 72 public String getName() { 74 return (String )this.getValue(NAME); 75 } 76 77 public void setCheck(int index, Check value) { 79 this.setValue(CHECK, index, value); 80 } 81 82 public Check getCheck(int index) { 84 return (Check)this.getValue(CHECK, index); 85 } 86 87 public void setCheck(Check[] value) { 89 this.setValue(CHECK, value); 90 } 91 92 public Check[] getCheck() { 94 return (Check[])this.getValues(CHECK); 95 } 96 97 public int sizeCheck() { 99 return this.size(CHECK); 100 } 101 102 public int addCheck(org.netbeans.modules.j2ee.sun.validation.data.Check value) { 104 return this.addValue(CHECK, value); 105 } 106 107 public int removeCheck(org.netbeans.modules.j2ee.sun.validation.data.Check value) { 112 return this.removeValue(CHECK, value); 113 } 114 115 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 117 comparators.add(c); 118 } 119 120 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 122 comparators.remove(c); 123 } 124 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 125 boolean restrictionFailure = false; 126 if (getName() == null) { 128 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); } 130 for (int _index = 0; _index < sizeCheck(); ++_index) { 132 org.netbeans.modules.j2ee.sun.validation.data.Check element = getCheck(_index); 133 if (element != null) { 134 element.validate(); 135 } 136 } 137 } 138 139 public void dump(StringBuffer str, String indent){ 141 String s; 142 Object o; 143 org.netbeans.modules.schema2beans.BaseBean n; 144 str.append(indent); 145 str.append("Name"); str.append(indent+"\t"); str.append("<"); s = this.getName(); 149 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 152 153 str.append(indent); 154 str.append("Check["+this.sizeCheck()+"]"); for(int i=0; i<this.sizeCheck(); i++) 156 { 157 str.append(indent+"\t"); 158 str.append("#"+i+":"); 159 n = (org.netbeans.modules.schema2beans.BaseBean) this.getCheck(i); 160 if (n != null) 161 n.dump(str, indent + "\t"); else 163 str.append(indent+"\tnull"); this.dumpAttributes(CHECK, i, str, indent); 165 } 166 167 } 168 public String dumpBeanNode(){ 169 StringBuffer str = new StringBuffer (); 170 str.append("Element\n"); this.dump(str, "\n "); return str.toString(); 173 }} 174 175 177 178 255 | Popular Tags |