1 19 20 29 30 31 package org.netbeans.modules.web.monitor.data; 32 33 import org.w3c.dom.*; 34 import org.netbeans.modules.schema2beans.*; 35 import java.beans.*; 36 import java.util.*; 37 38 39 public class ContextData extends BaseBean { 40 41 static Vector comparators = new Vector(); 42 43 static public final String PARAM = "Param"; static public final String CONTEXTATTRIBUTES = 45 "ContextAttributes"; 47 public ContextData() { 48 this(Common.USE_DEFAULT_VALUES); 49 } 50 51 public ContextData(int options) { 52 super(ContextData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6)); 53 this.createProperty("Param", PARAM, Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 56 Param.class); 57 this.createAttribute(PARAM, "name", "Name", AttrProp.CDATA | AttrProp.REQUIRED, 59 null, null); 60 this.createAttribute(PARAM, "value", "Value", AttrProp.CDATA | AttrProp.IMPLIED, 62 null, null); 63 64 this.createProperty("ContextAttributes", CONTEXTATTRIBUTES, Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 66 ContextAttributes.class); 67 68 69 this.initialize(options); 70 } 71 72 void initialize(int options) { 74 } 75 76 77 public void setParam(int index, Param value) { 79 this.setValue(PARAM, index, value); 80 } 81 82 public Param getParam(int index) { 84 return (Param)this.getValue(PARAM, index); 85 } 86 87 public void setParam(Param[] value) { 89 this.setValue(PARAM, value); 90 } 91 92 public Param[] getParam() { 94 return (Param[])this.getValues(PARAM); 95 } 96 97 public int sizeParam() { 99 return this.size(PARAM); 100 } 101 102 public int addParam(Param value) { 104 return this.addValue(PARAM, value); 105 } 106 107 public int removeParam(Param value) { 112 return this.removeValue(PARAM, value); 113 } 114 115 116 public void setContextAttributes(ContextAttributes value) { 118 this.setValue(CONTEXTATTRIBUTES, value); 119 } 120 121 public ContextAttributes getContextAttributes() { 123 return (ContextAttributes)this.getValue(CONTEXTATTRIBUTES); 124 } 125 126 127 128 public boolean verify() { 130 return true; 131 } 132 133 static public void addComparator(BeanComparator c) { 135 ContextData.comparators.add(c); 136 } 137 138 static public void removeComparator(BeanComparator c) { 140 ContextData.comparators.remove(c); 141 } 142 public void addPropertyChangeListener(PropertyChangeListener l) { 144 BeanProp p = this.beanProp(); 145 if (p != null) 146 p.addPCListener(l); 147 } 148 149 public void removePropertyChangeListener(PropertyChangeListener l) { 151 BeanProp p = this.beanProp(); 152 if (p != null) 153 p.removePCListener(l); 154 } 155 156 public void addPropertyChangeListener(String n, PropertyChangeListener l) { 158 BeanProp p = this.beanProp(n); 159 if (p != null) 160 p.addPCListener(l); 161 } 162 163 public void removePropertyChangeListener(String n, 165 PropertyChangeListener l) { 166 BeanProp p = this.beanProp(n); 167 if (p != null) 168 p.removePCListener(l); 169 } 170 171 public void dump(StringBuffer str, String indent) { 173 String s; 174 BaseBean n; 175 str.append(indent); 176 str.append("Param["+this.sizeParam()+"]"); for(int i=0; i<this.sizeParam(); i++) 178 { 179 str.append(indent+"\t"); str.append("#"+i+":"); n = this.getParam(i); 182 if (n != null) 183 n.dump(str, indent + "\t"); else 185 str.append(indent+"\tnull"); this.dumpAttributes(PARAM, i, str, indent); 187 } 188 189 } 190 191 public String dumpBeanNode() { 192 StringBuffer str = new StringBuffer (); 193 str.append("ContextData\n"); this.dump(str, "\n "); return str.toString(); 196 } 197 } 198 199 200 | Popular Tags |