KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > sunresources > beans > FieldValue


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  * This generated bean class FieldValue matches the schema element field-value
21  *
22  * Generated on Thu Sep 25 15:18:26 PDT 2003
23  */

24
25 package org.netbeans.modules.j2ee.sun.sunresources.beans;
26
27 import org.w3c.dom.*;
28 import org.netbeans.modules.schema2beans.*;
29 import java.beans.*;
30 import java.util.*;
31
32 // BEGIN_NOI18N
33

34 public class FieldValue extends org.netbeans.modules.schema2beans.BaseBean
35 {
36
37     static Vector comparators = new Vector();
38
39     static public final String JavaDoc DEFAULT_FIELD_VALUE = "DefaultFieldValue"; // NOI18N
40
static public final String JavaDoc OPTION_VALUE_PAIR = "OptionValuePair"; // NOI18N
41

42     public FieldValue() {
43         this(Common.USE_DEFAULT_VALUES);
44     }
45
46     public FieldValue(int options)
47     {
48         super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
49         // Properties (see root bean comments for the bean graph)
50
this.createProperty("default-field-value", // NOI18N
51
DEFAULT_FIELD_VALUE,
52             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
53             String JavaDoc.class);
54         this.createProperty("option-value-pair", // NOI18N
55
OPTION_VALUE_PAIR,
56             Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY,
57             OptionValuePair.class);
58         this.initialize(options);
59     }
60
61     // Setting the default values of the properties
62
void initialize(int options)
63     {
64     
65     }
66
67     // This attribute is mandatory
68
public void setDefaultFieldValue(String JavaDoc value) {
69         this.setValue(DEFAULT_FIELD_VALUE, value);
70     }
71
72     //
73
public String JavaDoc getDefaultFieldValue() {
74         return (String JavaDoc)this.getValue(DEFAULT_FIELD_VALUE);
75     }
76
77     // This attribute is an array, possibly empty
78
public void setOptionValuePair(int index, OptionValuePair value) {
79         this.setValue(OPTION_VALUE_PAIR, index, value);
80     }
81
82     //
83
public OptionValuePair getOptionValuePair(int index) {
84         return (OptionValuePair)this.getValue(OPTION_VALUE_PAIR, index);
85     }
86
87     // This attribute is an array, possibly empty
88
public void setOptionValuePair(OptionValuePair[] value) {
89         this.setValue(OPTION_VALUE_PAIR, value);
90     }
91
92     //
93
public OptionValuePair[] getOptionValuePair() {
94         return (OptionValuePair[])this.getValues(OPTION_VALUE_PAIR);
95     }
96
97     // Return the number of properties
98
public int sizeOptionValuePair() {
99         return this.size(OPTION_VALUE_PAIR);
100     }
101
102     // Add a new element returning its index in the list
103
public int addOptionValuePair(org.netbeans.modules.j2ee.sun.sunresources.beans.OptionValuePair value) {
104         return this.addValue(OPTION_VALUE_PAIR, value);
105     }
106
107     //
108
// Remove an element using its reference
109
// Returns the index the element had in the list
110
//
111
public int removeOptionValuePair(org.netbeans.modules.j2ee.sun.sunresources.beans.OptionValuePair value) {
112         return this.removeValue(OPTION_VALUE_PAIR, value);
113     }
114
115     //
116
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
117         comparators.add(c);
118     }
119
120     //
121
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
122         comparators.remove(c);
123     }
124     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
125         // Validating property defaultFieldValue
126
if (getDefaultFieldValue() == null) {
127             throw new org.netbeans.modules.schema2beans.ValidateException("getDefaultFieldValue() == null", "defaultFieldValue", this); // NOI18N
128
}
129         // Validating property optionValuePair
130
for (int _index = 0; _index < sizeOptionValuePair(); ++_index) {
131             org.netbeans.modules.j2ee.sun.sunresources.beans.OptionValuePair element = getOptionValuePair(_index);
132             if (element != null) {
133                 element.validate();
134             }
135         }
136     }
137
138     // Dump the content of this bean returning it as a String
139
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
140         String JavaDoc s;
141         org.netbeans.modules.schema2beans.BaseBean n;
142         str.append(indent);
143         str.append("DefaultFieldValue"); // NOI18N
144
str.append(indent+"\t"); // NOI18N
145
str.append("<"); // NOI18N
146
s = this.getDefaultFieldValue();
147         str.append((s==null?"null":s.trim())); // NOI18N
148
str.append(">\n"); // NOI18N
149
this.dumpAttributes(DEFAULT_FIELD_VALUE, 0, str, indent);
150
151         str.append(indent);
152         str.append("OptionValuePair["+this.sizeOptionValuePair()+"]"); // NOI18N
153
for(int i=0; i<this.sizeOptionValuePair(); i++)
154         {
155             str.append(indent+"\t");
156             str.append("#"+i+":");
157             n = (org.netbeans.modules.schema2beans.BaseBean) this.getOptionValuePair(i);
158             if (n != null)
159                 n.dump(str, indent + "\t"); // NOI18N
160
else
161                 str.append(indent+"\tnull"); // NOI18N
162
this.dumpAttributes(OPTION_VALUE_PAIR, i, str, indent);
163         }
164
165     }
166     public String JavaDoc dumpBeanNode(){
167         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
168         str.append("FieldValue\n"); // NOI18N
169
this.dump(str, "\n "); // NOI18N
170
return str.toString();
171     }}
172
173 // END_NOI18N
174

175
176 /*
177         The following schema file has been used for generation:
178
179 <!ELEMENT wizard (name, field-group+)>
180 <!ELEMENT field-group (name, field+)>
181 <!ELEMENT field (name, field-value, tag?)>
182 <!ATTLIST field field-type CDATA "string"
183                  required CDATA "true">
184 <!ELEMENT field-value (default-field-value, option-value-pair*)>
185 <!ELEMENT option-value-pair (option-name, conditional-value)>
186 <!ELEMENT name (#PCDATA)>
187 <!ELEMENT default-field-value (#PCDATA)>
188 <!ELEMENT option-name (#PCDATA)>
189 <!ELEMENT conditional-value (#PCDATA)>
190 <!ELEMENT tag (tag-item*)>
191 <!ELEMENT tag-item (#PCDATA)>
192
193
194
195 */

196
Popular Tags