KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > component > UISelectItem


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.faces.component;
17
18 import javax.faces.context.FacesContext;
19 import javax.faces.el.ValueBinding;
20
21 /**
22  * see Javadoc of JSF Specification
23  *
24  * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
25  * @version $Revision: 1.5 $ $Date: 2004/07/01 22:00:50 $
26  */

27 public class UISelectItem
28         extends UIComponentBase
29 {
30     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
31

32     public static final String JavaDoc COMPONENT_TYPE = "javax.faces.SelectItem";
33     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.SelectItem";
34     private static final boolean DEFAULT_ITEMDISABLED = false;
35
36     private String JavaDoc _itemDescription = null;
37     private Boolean JavaDoc _itemDisabled = null;
38     private String JavaDoc _itemLabel = null;
39     private Object JavaDoc _itemValue = null;
40     private Object JavaDoc _value = null;
41
42     public UISelectItem()
43     {
44     }
45
46     public String JavaDoc getFamily()
47     {
48         return COMPONENT_FAMILY;
49     }
50
51     public void setItemDescription(String JavaDoc itemDescription)
52     {
53         _itemDescription = itemDescription;
54     }
55
56     public String JavaDoc getItemDescription()
57     {
58         if (_itemDescription != null) return _itemDescription;
59         ValueBinding vb = getValueBinding("itemDescription");
60         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
61     }
62
63     public void setItemDisabled(boolean itemDisabled)
64     {
65         _itemDisabled = Boolean.valueOf(itemDisabled);
66     }
67
68     public boolean isItemDisabled()
69     {
70         if (_itemDisabled != null) return _itemDisabled.booleanValue();
71         ValueBinding vb = getValueBinding("itemDisabled");
72         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
73         return v != null ? v.booleanValue() : DEFAULT_ITEMDISABLED;
74     }
75
76     public void setItemLabel(String JavaDoc itemLabel)
77     {
78         _itemLabel = itemLabel;
79     }
80
81     public String JavaDoc getItemLabel()
82     {
83         if (_itemLabel != null) return _itemLabel;
84         ValueBinding vb = getValueBinding("itemLabel");
85         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
86     }
87
88     public void setItemValue(Object JavaDoc itemValue)
89     {
90         _itemValue = itemValue;
91     }
92
93     public Object JavaDoc getItemValue()
94     {
95         if (_itemValue != null) return _itemValue;
96         ValueBinding vb = getValueBinding("itemValue");
97         return vb != null ? (Object JavaDoc)vb.getValue(getFacesContext()) : null;
98     }
99
100     public void setValue(Object JavaDoc value)
101     {
102         _value = value;
103     }
104
105     public Object JavaDoc getValue()
106     {
107         if (_value != null) return _value;
108         ValueBinding vb = getValueBinding("value");
109         return vb != null ? (Object JavaDoc)vb.getValue(getFacesContext()) : null;
110     }
111
112
113     public Object JavaDoc saveState(FacesContext context)
114     {
115         Object JavaDoc values[] = new Object JavaDoc[6];
116         values[0] = super.saveState(context);
117         values[1] = _itemDescription;
118         values[2] = _itemDisabled;
119         values[3] = _itemLabel;
120         values[4] = _itemValue;
121         values[5] = _value;
122         return ((Object JavaDoc) (values));
123     }
124
125     public void restoreState(FacesContext context, Object JavaDoc state)
126     {
127         Object JavaDoc values[] = (Object JavaDoc[])state;
128         super.restoreState(context, values[0]);
129         _itemDescription = (String JavaDoc)values[1];
130         _itemDisabled = (Boolean JavaDoc)values[2];
131         _itemLabel = (String JavaDoc)values[3];
132         _itemValue = (Object JavaDoc)values[4];
133         _value = (Object JavaDoc)values[5];
134     }
135     //------------------ GENERATED CODE END ---------------------------------------
136
}
137
Popular Tags