KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > monitor > data > ServletData


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.web.monitor.data;
21
22 import org.w3c.dom.*;
23 import org.netbeans.modules.schema2beans.*;
24 import java.beans.*;
25 import java.util.*;
26
27 public class ServletData extends BaseBean {
28
29     static Vector comparators = new Vector();
30
31     static public final String JavaDoc PARAM = "Param"; //NOI18N
32

33     public ServletData() {
34     this(Common.USE_DEFAULT_VALUES);
35     }
36
37     public ServletData(int options) {
38     super(ServletData.comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 6));
39     // Properties (see root bean comments for the bean graph)
40
this.createProperty("Param", PARAM, //NOI18N
41
Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
42                 Param.class);
43     this.createAttribute(PARAM, "name", "Name", //NOI18N
44
AttrProp.CDATA | AttrProp.REQUIRED,
45                  null, null);
46     this.createAttribute(PARAM, "value", "Value", //NOI18N
47
AttrProp.CDATA | AttrProp.IMPLIED,
48                  null, null);
49
50     this.initialize(options);
51     }
52
53     // Setting the default values of the properties
54
void initialize(int options) {
55     }
56
57
58     // This attribute is an array, possibly empty
59
public void setParam(int index, Param value) {
60     this.setValue(PARAM, index, value);
61     }
62
63     //
64
public Param getParam(int index) {
65     return (Param)this.getValue(PARAM, index);
66     }
67
68     // This attribute is an array, possibly empty
69
public void setParam(Param[] value) {
70     this.setValue(PARAM, value);
71     }
72
73     //
74
public Param[] getParam() {
75     return (Param[])this.getValues(PARAM);
76     }
77
78     // Return the number of properties
79
public int sizeParam() {
80     return this.size(PARAM);
81     }
82
83     // Add a new element returning its index in the list
84
public int addParam(Param value) {
85     return this.addValue(PARAM, value);
86     }
87
88     //
89
// Remove an element using its reference
90
// Returns the index the element had in the list
91
//
92
public int removeParam(Param value) {
93     return this.removeValue(PARAM, value);
94     }
95
96     // This method verifies that the mandatory properties are set
97
public boolean verify() {
98     return true;
99     }
100
101     //
102
static public void addComparator(BeanComparator c) {
103     ServletData.comparators.add(c);
104     }
105
106     //
107
static public void removeComparator(BeanComparator c) {
108     ServletData.comparators.remove(c);
109     }
110     //
111
public void addPropertyChangeListener(PropertyChangeListener l) {
112     BeanProp p = this.beanProp();
113     if (p != null)
114         p.addPCListener(l);
115     }
116
117     //
118
public void removePropertyChangeListener(PropertyChangeListener l) {
119     BeanProp p = this.beanProp();
120     if (p != null)
121         p.removePCListener(l);
122     }
123
124     //
125
public void addPropertyChangeListener(String JavaDoc n, PropertyChangeListener l) {
126     BeanProp p = this.beanProp(n);
127     if (p != null)
128         p.addPCListener(l);
129     }
130
131     //
132
public void removePropertyChangeListener(String JavaDoc n,
133                          PropertyChangeListener l) {
134     BeanProp p = this.beanProp(n);
135     if (p != null)
136         p.removePCListener(l);
137     }
138
139     // Dump the content of this bean returning it as a String
140
public void dump(StringBuffer JavaDoc str, String JavaDoc indent) {
141     String JavaDoc s;
142     BaseBean n;
143     str.append(indent);
144     str.append("Param["+this.sizeParam()+"]"); //NOI18N
145
for(int i=0; i<this.sizeParam(); i++)
146         {
147         str.append(indent+"\t"); //NOI18N
148
str.append("#"+i+":"); //NOI18N
149
n = this.getParam(i);
150         if (n != null)
151             n.dump(str, indent + "\t"); //NOI18N
152
else
153             str.append(indent+"\tnull"); //NOI18N
154
this.dumpAttributes(PARAM, i, str, indent);
155         }
156
157     }
158
159     public String JavaDoc dumpBeanNode() {
160     StringBuffer JavaDoc str = new StringBuffer JavaDoc();
161     str.append("ServletData\n"); //NOI18N
162
this.dump(str, "\n "); //NOI18N
163
return str.toString();
164     }
165 }
166
167
168
Popular Tags