KickJava   Java API By Example, From Geeks To Geeks.

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


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 OptionValuePair matches the schema element option-value-pair
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 OptionValuePair extends org.netbeans.modules.schema2beans.BaseBean
35 {
36
37     static Vector comparators = new Vector();
38
39     static public final String JavaDoc OPTION_NAME = "OptionName"; // NOI18N
40
static public final String JavaDoc CONDITIONAL_VALUE = "ConditionalValue"; // NOI18N
41

42     public OptionValuePair() {
43         this(Common.USE_DEFAULT_VALUES);
44     }
45
46     public OptionValuePair(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("option-name", // NOI18N
51
OPTION_NAME,
52             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
53             String JavaDoc.class);
54         this.createProperty("conditional-value", // NOI18N
55
CONDITIONAL_VALUE,
56             Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY,
57             String JavaDoc.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 setOptionName(String JavaDoc value) {
69         this.setValue(OPTION_NAME, value);
70     }
71
72     //
73
public String JavaDoc getOptionName() {
74         return (String JavaDoc)this.getValue(OPTION_NAME);
75     }
76
77     // This attribute is mandatory
78
public void setConditionalValue(String JavaDoc value) {
79         this.setValue(CONDITIONAL_VALUE, value);
80     }
81
82     //
83
public String JavaDoc getConditionalValue() {
84         return (String JavaDoc)this.getValue(CONDITIONAL_VALUE);
85     }
86
87     //
88
public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
89         comparators.add(c);
90     }
91
92     //
93
public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) {
94         comparators.remove(c);
95     }
96     public void validate() throws org.netbeans.modules.schema2beans.ValidateException {
97         // Validating property optionName
98
if (getOptionName() == null) {
99             throw new org.netbeans.modules.schema2beans.ValidateException("getOptionName() == null", "optionName", this); // NOI18N
100
}
101         // Validating property conditionalValue
102
if (getConditionalValue() == null) {
103             throw new org.netbeans.modules.schema2beans.ValidateException("getConditionalValue() == null", "conditionalValue", this); // NOI18N
104
}
105     }
106
107     // Dump the content of this bean returning it as a String
108
public void dump(StringBuffer JavaDoc str, String JavaDoc indent){
109         String JavaDoc s;
110         str.append(indent);
111         str.append("OptionName"); // NOI18N
112
str.append(indent+"\t"); // NOI18N
113
str.append("<"); // NOI18N
114
s = this.getOptionName();
115         str.append((s==null?"null":s.trim())); // NOI18N
116
str.append(">\n"); // NOI18N
117
this.dumpAttributes(OPTION_NAME, 0, str, indent);
118
119         str.append(indent);
120         str.append("ConditionalValue"); // NOI18N
121
str.append(indent+"\t"); // NOI18N
122
str.append("<"); // NOI18N
123
s = this.getConditionalValue();
124         str.append((s==null?"null":s.trim())); // NOI18N
125
str.append(">\n"); // NOI18N
126
this.dumpAttributes(CONDITIONAL_VALUE, 0, str, indent);
127
128     }
129     public String JavaDoc dumpBeanNode(){
130         StringBuffer JavaDoc str = new StringBuffer JavaDoc();
131         str.append("OptionValuePair\n"); // NOI18N
132
this.dump(str, "\n "); // NOI18N
133
return str.toString();
134     }}
135
136 // END_NOI18N
137

138
139 /*
140         The following schema file has been used for generation:
141
142 <!ELEMENT wizard (name, field-group+)>
143 <!ELEMENT field-group (name, field+)>
144 <!ELEMENT field (name, field-value, tag?)>
145 <!ATTLIST field field-type CDATA "string"
146                  required CDATA "true">
147 <!ELEMENT field-value (default-field-value, option-value-pair*)>
148 <!ELEMENT option-value-pair (option-name, conditional-value)>
149 <!ELEMENT name (#PCDATA)>
150 <!ELEMENT default-field-value (#PCDATA)>
151 <!ELEMENT option-name (#PCDATA)>
152 <!ELEMENT conditional-value (#PCDATA)>
153 <!ELEMENT tag (tag-item*)>
154 <!ELEMENT tag-item (#PCDATA)>
155
156
157
158 */

159
Popular Tags