1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.shared.taglib; |
20 | |
|
21 | |
import org.apache.myfaces.shared.renderkit.JSFAttr; |
22 | |
|
23 | |
import javax.el.MethodExpression; |
24 | |
import javax.el.ValueExpression; |
25 | |
import javax.faces.component.UIComponent; |
26 | |
import javax.faces.webapp.UIComponentELTag; |
27 | |
|
28 | 0 | public abstract class UIComponentELTagBase extends UIComponentELTag |
29 | |
{ |
30 | |
|
31 | |
|
32 | |
|
33 | |
private ValueExpression _forceId; |
34 | |
|
35 | |
private ValueExpression _forceIdIndex; |
36 | 0 | private static final Boolean DEFAULT_FORCE_ID_INDEX_VALUE = Boolean.TRUE; |
37 | |
|
38 | |
private ValueExpression _javascriptLocation; |
39 | |
private ValueExpression _imageLocation; |
40 | |
private ValueExpression _styleLocation; |
41 | |
|
42 | |
|
43 | |
private ValueExpression _value; |
44 | |
private ValueExpression _converter; |
45 | |
|
46 | |
|
47 | |
|
48 | |
public void release() |
49 | |
{ |
50 | 0 | super.release(); |
51 | |
|
52 | 0 | _forceId = null; |
53 | 0 | _forceIdIndex = null; |
54 | |
|
55 | 0 | _value = null; |
56 | 0 | _converter = null; |
57 | |
|
58 | 0 | _javascriptLocation = null; |
59 | 0 | _imageLocation = null; |
60 | 0 | _styleLocation = null; |
61 | 0 | } |
62 | |
|
63 | |
protected void setProperties(UIComponent component) |
64 | |
{ |
65 | 0 | super.setProperties(component); |
66 | |
|
67 | 0 | setBooleanProperty(component, |
68 | |
org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_ATTR, |
69 | |
_forceId); |
70 | 0 | setBooleanProperty( |
71 | |
component, |
72 | |
org.apache.myfaces.shared.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR, |
73 | |
_forceIdIndex, DEFAULT_FORCE_ID_INDEX_VALUE); |
74 | 0 | if (_javascriptLocation != null) |
75 | |
{ |
76 | 0 | setStringProperty(component, JSFAttr.JAVASCRIPT_LOCATION, |
77 | |
_javascriptLocation); |
78 | |
} |
79 | 0 | if (_imageLocation != null) |
80 | |
{ |
81 | 0 | setStringProperty(component, JSFAttr.IMAGE_LOCATION, _imageLocation); |
82 | |
} |
83 | 0 | if (_styleLocation != null) |
84 | |
{ |
85 | 0 | setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation); |
86 | |
} |
87 | |
|
88 | |
|
89 | |
|
90 | 0 | setValueProperty(component, _value); |
91 | 0 | setConverterProperty(component, _converter); |
92 | 0 | } |
93 | |
|
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public void setForceId(ValueExpression aForceId) |
102 | |
{ |
103 | 0 | _forceId = aForceId; |
104 | 0 | } |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
|
112 | |
public void setForceIdIndex(ValueExpression aForceIdIndex) |
113 | |
{ |
114 | 0 | _forceIdIndex = aForceIdIndex; |
115 | 0 | } |
116 | |
|
117 | |
public void setValue(ValueExpression value) |
118 | |
{ |
119 | 0 | _value = value; |
120 | 0 | } |
121 | |
|
122 | |
public void setConverter(ValueExpression converter) |
123 | |
{ |
124 | 0 | _converter = converter; |
125 | 0 | } |
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
public void setJavascriptLocation(ValueExpression aJavascriptLocation) |
134 | |
{ |
135 | 0 | _javascriptLocation = aJavascriptLocation; |
136 | 0 | } |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
public void setImageLocation(ValueExpression aImageLocation) |
145 | |
{ |
146 | 0 | _imageLocation = aImageLocation; |
147 | 0 | } |
148 | |
|
149 | |
|
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
public void setStyleLocation(ValueExpression aStyleLocation) |
156 | |
{ |
157 | 0 | _styleLocation = aStyleLocation; |
158 | 0 | } |
159 | |
|
160 | |
|
161 | |
|
162 | |
protected void setIntegerProperty(UIComponent component, String propName, |
163 | |
ValueExpression value) |
164 | |
{ |
165 | 0 | UIComponentELTagUtils.setIntegerProperty(component, propName, value); |
166 | 0 | } |
167 | |
|
168 | |
protected void setIntegerProperty(UIComponent component, String propName, |
169 | |
ValueExpression value, Integer defaultValue) |
170 | |
{ |
171 | 0 | UIComponentELTagUtils.setIntegerProperty(component, propName, value, |
172 | |
defaultValue); |
173 | 0 | } |
174 | |
|
175 | |
protected void setLongProperty(UIComponent component, String propName, |
176 | |
ValueExpression value) |
177 | |
{ |
178 | 0 | UIComponentELTagUtils.setLongProperty(component, propName, value); |
179 | 0 | } |
180 | |
|
181 | |
protected void setLongProperty(UIComponent component, String propName, |
182 | |
ValueExpression value, Long defaultValue) |
183 | |
{ |
184 | 0 | UIComponentELTagUtils.setLongProperty(component, propName, value, |
185 | |
defaultValue); |
186 | 0 | } |
187 | |
|
188 | |
@Deprecated |
189 | |
protected void setStringProperty(UIComponent component, String propName, |
190 | |
String value) |
191 | |
{ |
192 | 0 | UIComponentTagUtils.setStringProperty(getFacesContext(), component, |
193 | |
propName, value); |
194 | 0 | } |
195 | |
|
196 | |
protected void setStringProperty(UIComponent component, String propName, |
197 | |
ValueExpression value) |
198 | |
{ |
199 | 0 | UIComponentELTagUtils.setStringProperty(component, propName, value); |
200 | 0 | } |
201 | |
|
202 | |
protected void setStringProperty(UIComponent component, String propName, |
203 | |
ValueExpression value, String defaultValue) |
204 | |
{ |
205 | 0 | UIComponentELTagUtils.setStringProperty(component, propName, value, |
206 | |
defaultValue); |
207 | 0 | } |
208 | |
|
209 | |
@Deprecated |
210 | |
protected void setBooleanProperty(UIComponent component, String propName, |
211 | |
String value) |
212 | |
{ |
213 | 0 | UIComponentTagUtils.setBooleanProperty(getFacesContext(), component, |
214 | |
propName, value); |
215 | 0 | } |
216 | |
|
217 | |
protected void setBooleanProperty(UIComponent component, String propName, |
218 | |
ValueExpression value) |
219 | |
{ |
220 | 0 | UIComponentELTagUtils.setBooleanProperty(component, propName, value); |
221 | 0 | } |
222 | |
|
223 | |
protected void setBooleanProperty(UIComponent component, String propName, |
224 | |
ValueExpression value, Boolean defaultValue) |
225 | |
{ |
226 | 0 | UIComponentELTagUtils.setBooleanProperty(component, propName, value, |
227 | |
defaultValue); |
228 | 0 | } |
229 | |
|
230 | |
private void setValueProperty(UIComponent component, ValueExpression value) |
231 | |
{ |
232 | 0 | UIComponentELTagUtils.setValueProperty(getFacesContext(), component, |
233 | |
value); |
234 | 0 | } |
235 | |
|
236 | |
private void setConverterProperty(UIComponent component, |
237 | |
ValueExpression value) |
238 | |
{ |
239 | 0 | UIComponentELTagUtils.setConverterProperty(getFacesContext(), |
240 | |
component, value); |
241 | 0 | } |
242 | |
|
243 | |
protected void addValidatorProperty(UIComponent component, |
244 | |
MethodExpression value) |
245 | |
{ |
246 | 0 | UIComponentELTagUtils.addValidatorProperty(getFacesContext(), |
247 | |
component, value); |
248 | 0 | } |
249 | |
|
250 | |
@Deprecated |
251 | |
protected void setActionProperty(UIComponent component, String action) |
252 | |
{ |
253 | 0 | UIComponentTagUtils.setActionProperty(getFacesContext(), component, |
254 | |
action); |
255 | 0 | } |
256 | |
|
257 | |
protected void setActionProperty(UIComponent component, |
258 | |
MethodExpression action) |
259 | |
{ |
260 | 0 | UIComponentELTagUtils.setActionProperty(getFacesContext(), component, |
261 | |
action); |
262 | 0 | } |
263 | |
|
264 | |
@Deprecated |
265 | |
protected void setActionListenerProperty(UIComponent component, |
266 | |
String actionListener) |
267 | |
{ |
268 | 0 | UIComponentTagUtils.setActionListenerProperty(getFacesContext(), |
269 | |
component, actionListener); |
270 | 0 | } |
271 | |
|
272 | |
protected void setActionListenerProperty(UIComponent component, |
273 | |
MethodExpression actionListener) |
274 | |
{ |
275 | 0 | UIComponentELTagUtils.addActionListenerProperty(getFacesContext(), |
276 | |
component, actionListener); |
277 | 0 | } |
278 | |
|
279 | |
protected void addValueChangedListenerProperty(UIComponent component, |
280 | |
MethodExpression valueChangedListener) |
281 | |
{ |
282 | 0 | UIComponentELTagUtils.addValueChangedListenerProperty( |
283 | |
getFacesContext(), component, valueChangedListener); |
284 | 0 | } |
285 | |
|
286 | |
protected void setValueBinding(UIComponent component, String propName, |
287 | |
ValueExpression value) |
288 | |
{ |
289 | 0 | UIComponentELTagUtils.setValueBinding(getFacesContext(), component, |
290 | |
propName, value); |
291 | 0 | } |
292 | |
|
293 | |
protected Object evaluateValueExpression(ValueExpression expression) |
294 | |
{ |
295 | 0 | return UIComponentELTagUtils.evaluateValueExpression(getFacesContext() |
296 | |
.getELContext(), expression); |
297 | |
} |
298 | |
|
299 | |
} |