KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
21  * SessionOut.java
22  *
23  *
24  * Created: Wed Feb 7 16:45:50 2001
25  *
26  * @author Ana von Klopp
27  * @version
28  *
29  *
30  * The Param class is used to represent session attributes.
31  */

32
33
34 package org.netbeans.modules.web.monitor.data;
35
36 import org.w3c.dom.*;
37 import org.netbeans.modules.schema2beans.*;
38 import java.beans.*;
39 import java.util.*;
40
41 public class SessionOut extends BaseBean {
42
43     static Vector comparators = new Vector();
44
45     static public final String JavaDoc PARAM = "Param"; //NOI18N
46

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