1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.component;
20
21 import javax.faces.context.FacesContext;
22 import javax.faces.el.ValueBinding;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 public class UISelectItem
47 extends UIComponentBase
48 {
49
50
51 public static final String COMPONENT_TYPE = "javax.faces.SelectItem";
52 public static final String COMPONENT_FAMILY = "javax.faces.SelectItem";
53 private static final boolean DEFAULT_ITEMDISABLED = false;
54
55 private String _itemDescription = null;
56 private Boolean _itemDisabled = null;
57 private String _itemLabel = null;
58 private Object _itemValue = null;
59 private Object _value = null;
60
61 public UISelectItem()
62 {
63 }
64
65 public String getFamily()
66 {
67 return COMPONENT_FAMILY;
68 }
69
70
71
72
73
74
75
76
77
78 public void setRendered(boolean state) {
79
80
81 super.setRendered(state);
82 }
83
84 public boolean isRendered() {
85
86
87 return super.isRendered();
88 }
89
90 public void setItemDescription(String itemDescription)
91 {
92 _itemDescription = itemDescription;
93 }
94
95
96
97
98
99
100
101 public String getItemDescription()
102 {
103
104 if (_itemDescription != null) return _itemDescription;
105 ValueBinding vb = getValueBinding("itemDescription");
106 return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : null;
107 }
108
109
110
111
112
113
114 public void setItemDisabled(boolean itemDisabled)
115 {
116 _itemDisabled = Boolean.valueOf(itemDisabled);
117 }
118
119
120
121
122
123
124 public boolean isItemDisabled()
125 {
126 if (_itemDisabled != null) return _itemDisabled.booleanValue();
127 ValueBinding vb = getValueBinding("itemDisabled");
128 Boolean v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
129 return v != null ? v.booleanValue() : DEFAULT_ITEMDISABLED;
130 }
131
132 public void setItemLabel(String itemLabel)
133 {
134 _itemLabel = itemLabel;
135 }
136
137
138
139
140
141
142 public String getItemLabel()
143 {
144 if (_itemLabel != null) return _itemLabel;
145 ValueBinding vb = getValueBinding("itemLabel");
146 return vb != null ? _ComponentUtils.getStringValue(getFacesContext(), vb) : null;
147 }
148
149 public void setItemValue(Object itemValue)
150 {
151 _itemValue = itemValue;
152 }
153
154
155
156
157
158
159 public Object getItemValue()
160 {
161 if (_itemValue != null) return _itemValue;
162 ValueBinding vb = getValueBinding("itemValue");
163 return vb != null ? vb.getValue(getFacesContext()) : null;
164 }
165
166 public void setValue(Object value)
167 {
168 _value = value;
169 }
170
171
172
173
174
175
176 public Object getValue()
177 {
178 if (_value != null) return _value;
179 ValueBinding vb = getValueBinding("value");
180 return vb != null ? vb.getValue(getFacesContext()) : null;
181 }
182
183
184 public Object saveState(FacesContext context)
185 {
186 Object values[] = new Object[6];
187 values[0] = super.saveState(context);
188 values[1] = _itemDescription;
189 values[2] = _itemDisabled;
190 values[3] = _itemLabel;
191 values[4] = _itemValue;
192 values[5] = _value;
193 return values;
194 }
195
196 public void restoreState(FacesContext context, Object state)
197 {
198 Object values[] = (Object[])state;
199 super.restoreState(context, values[0]);
200 _itemDescription = (String)values[1];
201 _itemDisabled = (Boolean)values[2];
202 _itemLabel = (String)values[3];
203 _itemValue = values[4];
204 _value = values[5];
205 }
206
207 }