1 23 24 29 30 package com.sun.enterprise.tools.common.validation.data; 31 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 39 public class Element extends org.netbeans.modules.schema2beans.BaseBean 40 { 41 42 static Vector comparators = new Vector(); 43 44 static public final String NAME = "Name"; static public final String CHECK = "Check"; 47 public Element() { 48 this(Common.USE_DEFAULT_VALUES); 49 } 50 51 public Element(int options) 52 { 53 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 54 this.createProperty("name", NAME, 57 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 58 String .class); 59 this.createProperty("check", CHECK, 61 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 62 Check.class); 63 this.initialize(options); 64 } 65 66 void initialize(int options) 68 { 69 70 } 71 72 public void setName(String value) { 74 this.setValue(NAME, value); 75 } 76 77 public String getName() { 79 return (String )this.getValue(NAME); 80 } 81 82 public void setCheck(int index, Check value) { 84 this.setValue(CHECK, index, value); 85 } 86 87 public Check getCheck(int index) { 89 return (Check)this.getValue(CHECK, index); 90 } 91 92 public void setCheck(Check[] value) { 94 this.setValue(CHECK, value); 95 } 96 97 public Check[] getCheck() { 99 return (Check[])this.getValues(CHECK); 100 } 101 102 public int sizeCheck() { 104 return this.size(CHECK); 105 } 106 107 public int addCheck(com.sun.enterprise.tools.common.validation.data.Check value) { 109 return this.addValue(CHECK, value); 110 } 111 112 public int removeCheck(com.sun.enterprise.tools.common.validation.data.Check value) { 117 return this.removeValue(CHECK, value); 118 } 119 120 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 122 comparators.add(c); 123 } 124 125 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 127 comparators.remove(c); 128 } 129 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 130 boolean restrictionFailure = false; 131 if (getName() == null) { 133 throw new org.netbeans.modules.schema2beans.ValidateException("getName() == null", "name", this); } 135 for (int _index = 0; _index < sizeCheck(); ++_index) { 137 com.sun.enterprise.tools.common.validation.data.Check element = getCheck(_index); 138 if (element != null) { 139 element.validate(); 140 } 141 } 142 } 143 144 public void dump(StringBuffer str, String indent){ 146 String s; 147 Object o; 148 org.netbeans.modules.schema2beans.BaseBean n; 149 str.append(indent); 150 str.append("Name"); str.append(indent+"\t"); str.append("<"); s = this.getName(); 154 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(NAME, 0, str, indent); 157 158 str.append(indent); 159 str.append("Check["+this.sizeCheck()+"]"); for(int i=0; i<this.sizeCheck(); i++) 161 { 162 str.append(indent+"\t"); 163 str.append("#"+i+":"); 164 n = (org.netbeans.modules.schema2beans.BaseBean) this.getCheck(i); 165 if (n != null) 166 n.dump(str, indent + "\t"); else 168 str.append(indent+"\tnull"); this.dumpAttributes(CHECK, i, str, indent); 170 } 171 172 } 173 public String dumpBeanNode(){ 174 StringBuffer str = new StringBuffer (); 175 str.append("Element\n"); this.dump(str, "\n "); return str.toString(); 178 }} 179 180 182 183 260 | Popular Tags |