KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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