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