KickJava   Java API By Example, From Geeks To Geeks.

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


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 Dispatches extends BaseBean {
28
29     static Vector comparators = new Vector();
30
31     static public final String JavaDoc DISPATCHDATA = "DispatchData"; // NOI18N
32

33     public Dispatches() {
34     this(Common.USE_DEFAULT_VALUES);
35     }
36
37     public Dispatches(int options) {
38     super(comparators, new org.netbeans.modules.schema2beans.Version(1, 0, 8));
39     // Properties (see root bean comments for the bean graph)
40
this.createProperty("DispatchData", // NOI18N
41
DISPATCHDATA,
42                 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
43                 DispatchData.class);
44     this.createAttribute(DISPATCHDATA, "resource", "Resource", //NOI18N
45
AttrProp.CDATA | AttrProp.REQUIRED,
46                  null, null);
47     this.initialize(options);
48     }
49
50     // Setting the default values of the properties
51
void initialize(int options) { }
52
53     // This attribute is an array, possibly empty
54
public void setDispatchData(int index, DispatchData value) {
55     this.setValue(DISPATCHDATA, index, value);
56     }
57
58     //
59
public DispatchData getDispatchData(int index) {
60     return (DispatchData)this.getValue(DISPATCHDATA, index);
61     }
62
63     // This attribute is an array, possibly empty
64
public void setDispatchData(DispatchData[] value) {
65     this.setValue(DISPATCHDATA, value);
66     }
67
68     //
69
public DispatchData[] getDispatchData() {
70     return (DispatchData[])this.getValues(DISPATCHDATA);
71     }
72
73     // Return the number of properties
74
public int sizeDispatchData() {
75     return this.size(DISPATCHDATA);
76     }
77
78     // Add a new element returning its index in the list
79
public int addDispatchData(DispatchData value) {
80     return this.addValue(DISPATCHDATA, value);
81     }
82
83     // Remove an element using its reference
84
// Returns the index the element had in the list
85
public int removeDispatchData(DispatchData value) {
86     return this.removeValue(DISPATCHDATA, value);
87     }
88
89     // This method verifies that the mandatory properties are set
90
public boolean verify() {
91     return true;
92     }
93
94     //
95
static public void addComparator(BeanComparator c) {
96     comparators.add(c);
97     }
98
99     //
100
static public void removeComparator(BeanComparator c) {
101     comparators.remove(c);
102     }
103     // Dump the content of this bean returning it as a String
104
public void dump(StringBuffer JavaDoc str, String JavaDoc indent) {
105     String JavaDoc s;
106     Object JavaDoc o;
107     BaseBean n;
108     str.append(indent);
109     str.append("DispatchData["+this.sizeDispatchData()+"]"); // NOI18N
110
for(int i=0; i<this.sizeDispatchData(); i++) {
111         str.append(indent+"\t"); // NOI18N
112
str.append("#"+i+":"); // NOI18N
113
n = this.getDispatchData(i);
114         if (n != null)
115         n.dump(str, indent + "\t"); // NOI18N
116
else
117         str.append(indent+"\tnull"); // NOI18N
118
this.dumpAttributes(DISPATCHDATA, i, str, indent);
119     }
120
121     }
122     public String JavaDoc dumpBeanNode() {
123     StringBuffer JavaDoc str = new StringBuffer JavaDoc();
124     str.append("Dispatches\n"); // NOI18N
125
this.dump(str, "\n "); // NOI18N
126
return str.toString();
127     }
128 }
129
130
131
132
Popular Tags