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