1 19 20 30 31 package org.netbeans.modules.web.monitor.data; 32 import org.w3c.dom.*; 33 import org.netbeans.modules.schema2beans.*; 34 import java.beans.*; 35 import java.util.*; 36 37 public class RequestAttributesOut extends BaseBean { 38 39 static Vector comparators = new Vector(); 40 41 static public final String PARAM = "Param"; 43 public RequestAttributesOut() { 44 this(Common.USE_DEFAULT_VALUES); 45 } 46 47 public RequestAttributesOut(int options) { 48 super(RequestAttributesOut.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6)); 49 this.createProperty("Param", PARAM, Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 52 Param.class); 53 this.createAttribute(PARAM, "name", "Name", AttrProp.CDATA | AttrProp.REQUIRED, 55 null, null); 56 this.createAttribute(PARAM, "value", "Value", AttrProp.CDATA | AttrProp.IMPLIED, 58 null, null); 59 this.initialize(options); 60 } 61 62 void initialize(int options) { 64 65 } 66 67 public void setParam(int index, Param value) { 69 this.setValue(PARAM, index, value); 70 } 71 72 public Param getParam(int index) { 74 return (Param)this.getValue(PARAM, index); 75 } 76 77 public void setParam(Param[] value) { 79 this.setValue(PARAM, value); 80 } 81 82 public Param[] getParam() { 84 return (Param[])this.getValues(PARAM); 85 } 86 87 public Hashtable getHashtable() { 88 89 Param[] attributes = (Param[])this.getValues(PARAM); 90 int numAttributes = attributes.length; 91 Hashtable ht = new Hashtable(numAttributes); 92 93 for(int i=0; i<numAttributes; ++i) { 94 String name = attributes[i].getAttributeValue("name"); String value = attributes[i].getAttributeValue("value"); ht.put(name, value); 97 } 98 return ht; 99 } 100 101 102 public int sizeParam() { 104 return this.size(PARAM); 105 } 106 107 public int addParam(Param value) { 109 return this.addValue(PARAM, value); 110 } 111 112 public int removeParam(Param value) { 117 return this.removeValue(PARAM, value); 118 } 119 120 public boolean verify() { 122 return true; 123 } 124 125 static public void addComparator(BeanComparator c) { 127 RequestAttributesOut.comparators.add(c); 128 } 129 130 static public void removeComparator(BeanComparator c) { 132 RequestAttributesOut.comparators.remove(c); 133 } 134 public void addPropertyChangeListener(PropertyChangeListener l) { 136 BeanProp p = this.beanProp(); 137 if (p != null) 138 p.addPCListener(l); 139 } 140 141 public void removePropertyChangeListener(PropertyChangeListener l) { 143 BeanProp p = this.beanProp(); 144 if (p != null) 145 p.removePCListener(l); 146 } 147 148 public void addPropertyChangeListener(String n, 150 PropertyChangeListener l) { 151 BeanProp p = this.beanProp(n); 152 if (p != null) 153 p.addPCListener(l); 154 } 155 156 public void removePropertyChangeListener(String n, 158 PropertyChangeListener l) { 159 BeanProp p = this.beanProp(n); 160 if (p != null) 161 p.removePCListener(l); 162 } 163 164 public void dump(StringBuffer str, String indent) { 166 String s; 167 BaseBean n; 168 str.append(indent); 169 str.append("Param["+this.sizeParam()+"]"); for(int i=0; i<this.sizeParam(); i++) 171 { 172 str.append(indent+"\t"); str.append("#"+i+":"); n = this.getParam(i); 175 if (n != null) 176 n.dump(str, indent + "\t"); else 178 str.append(indent+"\tnull"); this.dumpAttributes(PARAM, i, str, indent); 180 } 181 182 } 183 184 public String dumpBeanNode() { 185 StringBuffer str = new StringBuffer (); 186 str.append("RequestAttributesOut\n"); this.dump(str, "\n "); return str.toString(); 189 } 190 191 public String toString() { 192 StringBuffer buf = new StringBuffer ("RequestAttributesOut\n"); 194 Param[] params = getParam(); 195 buf.append(String.valueOf(params.length)); 196 buf.append(" attribute lines\n"); for(int i=0; i<params.length; ++i) { 198 buf.append(String.valueOf(i)); 199 buf.append(". Attribute: "); buf.append(params[i].getAttributeValue("name")); buf.append(", Value: "); buf.append(params[i].getAttributeValue("value")); buf.append("\n"); } 205 return buf.toString(); 206 } 207 } 208 | Popular Tags |