Source code: javax/faces/component/UISelectItem.java
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: 166994 $ $Date: 2004-07-01 18:12:40 -0400 (Thu, 01 Jul 2004) $
26 */
27 public class UISelectItem
28 extends UIComponentBase
29 {
30 //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
31
32 public static final String COMPONENT_TYPE = "javax.faces.SelectItem";
33 public static final String COMPONENT_FAMILY = "javax.faces.SelectItem";
34 private static final boolean DEFAULT_ITEMDISABLED = false;
35
36 private String _itemDescription = null;
37 private Boolean _itemDisabled = null;
38 private String _itemLabel = null;
39 private Object _itemValue = null;
40 private Object _value = null;
41
42 public UISelectItem()
43 {
44 }
45
46 public String getFamily()
47 {
48 return COMPONENT_FAMILY;
49 }
50
51 public void setItemDescription(String itemDescription)
52 {
53 _itemDescription = itemDescription;
54 }
55
56 public String getItemDescription()
57 {
58 if (_itemDescription != null) return _itemDescription;
59 ValueBinding vb = getValueBinding("itemDescription");
60 return vb != null ? (String)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 v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
73 return v != null ? v.booleanValue() : DEFAULT_ITEMDISABLED;
74 }
75
76 public void setItemLabel(String itemLabel)
77 {
78 _itemLabel = itemLabel;
79 }
80
81 public String getItemLabel()
82 {
83 if (_itemLabel != null) return _itemLabel;
84 ValueBinding vb = getValueBinding("itemLabel");
85 return vb != null ? (String)vb.getValue(getFacesContext()) : null;
86 }
87
88 public void setItemValue(Object itemValue)
89 {
90 _itemValue = itemValue;
91 }
92
93 public Object getItemValue()
94 {
95 if (_itemValue != null) return _itemValue;
96 ValueBinding vb = getValueBinding("itemValue");
97 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
98 }
99
100 public void setValue(Object value)
101 {
102 _value = value;
103 }
104
105 public Object getValue()
106 {
107 if (_value != null) return _value;
108 ValueBinding vb = getValueBinding("value");
109 return vb != null ? (Object)vb.getValue(getFacesContext()) : null;
110 }
111
112
113 public Object saveState(FacesContext context)
114 {
115 Object values[] = new Object[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) (values));
123 }
124
125 public void restoreState(FacesContext context, Object state)
126 {
127 Object values[] = (Object[])state;
128 super.restoreState(context, values[0]);
129 _itemDescription = (String)values[1];
130 _itemDisabled = (Boolean)values[2];
131 _itemLabel = (String)values[3];
132 _itemValue = (Object)values[4];
133 _value = (Object)values[5];
134 }
135 //------------------ GENERATED CODE END ---------------------------------------
136 }