1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package javax.faces.component.html; |
20 | |
|
21 | |
import javax.faces.el.ValueBinding; |
22 | |
import javax.el.ValueExpression; |
23 | |
import javax.faces.context.FacesContext; |
24 | |
import javax.faces.component.UIComponent; |
25 | |
import javax.el.MethodExpression; |
26 | |
import javax.faces.el.MethodBinding; |
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class HtmlCommandButton extends javax.faces.component.UICommand |
34 | |
implements javax.faces.component.behavior.ClientBehaviorHolder |
35 | |
{ |
36 | |
|
37 | |
static public final String COMPONENT_FAMILY = |
38 | |
"javax.faces.Command"; |
39 | |
static public final String COMPONENT_TYPE = |
40 | |
"javax.faces.HtmlCommandButton"; |
41 | |
|
42 | |
|
43 | |
public HtmlCommandButton() |
44 | 0 | { |
45 | 0 | setRendererType("javax.faces.Button"); |
46 | 0 | } |
47 | |
|
48 | |
@Override |
49 | |
public String getFamily() |
50 | |
{ |
51 | 0 | return COMPONENT_FAMILY; |
52 | |
} |
53 | |
|
54 | |
|
55 | 0 | static private final java.util.Collection<String> CLIENT_EVENTS_LIST = |
56 | |
java.util.Collections.unmodifiableCollection( |
57 | |
java.util.Arrays.asList( |
58 | |
"blur" |
59 | |
, "focus" |
60 | |
, "change" |
61 | |
, "select" |
62 | |
, "click" |
63 | |
, "dblclick" |
64 | |
, "keydown" |
65 | |
, "keypress" |
66 | |
, "keyup" |
67 | |
, "mousedown" |
68 | |
, "mousemove" |
69 | |
, "mouseout" |
70 | |
, "mouseover" |
71 | |
, "mouseup" |
72 | |
, "action" |
73 | |
)); |
74 | |
|
75 | |
public java.util.Collection<String> getEventNames() |
76 | |
{ |
77 | 0 | return CLIENT_EVENTS_LIST; |
78 | |
} |
79 | |
|
80 | |
@Override |
81 | |
public void addClientBehavior(String eventName, javax.faces.component.behavior.ClientBehavior behavior) |
82 | |
{ |
83 | 0 | super.addClientBehavior(eventName, behavior); |
84 | 0 | _CommonEventConstants.markEvent(this, eventName); |
85 | 0 | } |
86 | |
|
87 | |
|
88 | |
public String getDefaultEventName() |
89 | |
{ |
90 | 0 | return "action"; |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public String getImage() |
97 | |
{ |
98 | 0 | return (String) getStateHelper().eval(PropertyKeys.image); |
99 | |
} |
100 | |
|
101 | |
public void setImage(String image) |
102 | |
{ |
103 | 0 | getStateHelper().put(PropertyKeys.image, image ); |
104 | 0 | } |
105 | |
|
106 | |
|
107 | |
public String getType() |
108 | |
{ |
109 | 0 | return (String) getStateHelper().eval(PropertyKeys.type, "submit"); |
110 | |
} |
111 | |
|
112 | |
public void setType(String type) |
113 | |
{ |
114 | 0 | getStateHelper().put(PropertyKeys.type, type ); |
115 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.TYPE_PROP); |
116 | 0 | } |
117 | |
|
118 | |
|
119 | |
public String getLabel() |
120 | |
{ |
121 | 0 | return (String) getStateHelper().eval(PropertyKeys.label); |
122 | |
} |
123 | |
|
124 | |
public void setLabel(String label) |
125 | |
{ |
126 | 0 | getStateHelper().put(PropertyKeys.label, label ); |
127 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.LABEL_PROP); |
128 | 0 | } |
129 | |
|
130 | |
|
131 | |
public String getStyle() |
132 | |
{ |
133 | 0 | return (String) getStateHelper().eval(PropertyKeys.style); |
134 | |
} |
135 | |
|
136 | |
public void setStyle(String style) |
137 | |
{ |
138 | 0 | getStateHelper().put(PropertyKeys.style, style ); |
139 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.STYLE_PROP); |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
public String getStyleClass() |
144 | |
{ |
145 | 0 | return (String) getStateHelper().eval(PropertyKeys.styleClass); |
146 | |
} |
147 | |
|
148 | |
public void setStyleClass(String styleClass) |
149 | |
{ |
150 | 0 | getStateHelper().put(PropertyKeys.styleClass, styleClass ); |
151 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.STYLECLASS_PROP); |
152 | 0 | } |
153 | |
|
154 | |
|
155 | |
public String getAlt() |
156 | |
{ |
157 | 0 | return (String) getStateHelper().eval(PropertyKeys.alt); |
158 | |
} |
159 | |
|
160 | |
public void setAlt(String alt) |
161 | |
{ |
162 | 0 | getStateHelper().put(PropertyKeys.alt, alt ); |
163 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ALT_PROP); |
164 | 0 | } |
165 | |
|
166 | |
|
167 | |
public String getTabindex() |
168 | |
{ |
169 | 0 | return (String) getStateHelper().eval(PropertyKeys.tabindex); |
170 | |
} |
171 | |
|
172 | |
public void setTabindex(String tabindex) |
173 | |
{ |
174 | 0 | getStateHelper().put(PropertyKeys.tabindex, tabindex ); |
175 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.TABINDEX_PROP); |
176 | 0 | } |
177 | |
|
178 | |
|
179 | |
public String getOnblur() |
180 | |
{ |
181 | 0 | return (String) getStateHelper().eval(PropertyKeys.onblur); |
182 | |
} |
183 | |
|
184 | |
public void setOnblur(String onblur) |
185 | |
{ |
186 | 0 | getStateHelper().put(PropertyKeys.onblur, onblur ); |
187 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONBLUR_PROP); |
188 | 0 | } |
189 | |
|
190 | |
|
191 | |
public String getOnfocus() |
192 | |
{ |
193 | 0 | return (String) getStateHelper().eval(PropertyKeys.onfocus); |
194 | |
} |
195 | |
|
196 | |
public void setOnfocus(String onfocus) |
197 | |
{ |
198 | 0 | getStateHelper().put(PropertyKeys.onfocus, onfocus ); |
199 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONFOCUS_PROP); |
200 | 0 | } |
201 | |
|
202 | |
|
203 | |
public String getAccesskey() |
204 | |
{ |
205 | 0 | return (String) getStateHelper().eval(PropertyKeys.accesskey); |
206 | |
} |
207 | |
|
208 | |
public void setAccesskey(String accesskey) |
209 | |
{ |
210 | 0 | getStateHelper().put(PropertyKeys.accesskey, accesskey ); |
211 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ACCESSKEY_PROP); |
212 | 0 | } |
213 | |
|
214 | |
|
215 | |
public String getRole() |
216 | |
{ |
217 | 0 | return (String) getStateHelper().eval(PropertyKeys.role); |
218 | |
} |
219 | |
|
220 | |
public void setRole(String role) |
221 | |
{ |
222 | 0 | getStateHelper().put(PropertyKeys.role, role ); |
223 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ROLE_PROP); |
224 | 0 | } |
225 | |
|
226 | |
|
227 | |
public String getOnchange() |
228 | |
{ |
229 | 0 | return (String) getStateHelper().eval(PropertyKeys.onchange); |
230 | |
} |
231 | |
|
232 | |
public void setOnchange(String onchange) |
233 | |
{ |
234 | 0 | getStateHelper().put(PropertyKeys.onchange, onchange ); |
235 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONCHANGE_PROP); |
236 | 0 | } |
237 | |
|
238 | |
|
239 | |
public String getOnselect() |
240 | |
{ |
241 | 0 | return (String) getStateHelper().eval(PropertyKeys.onselect); |
242 | |
} |
243 | |
|
244 | |
public void setOnselect(String onselect) |
245 | |
{ |
246 | 0 | getStateHelper().put(PropertyKeys.onselect, onselect ); |
247 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONSELECT_PROP); |
248 | 0 | } |
249 | |
|
250 | |
|
251 | |
public String getOnclick() |
252 | |
{ |
253 | 0 | return (String) getStateHelper().eval(PropertyKeys.onclick); |
254 | |
} |
255 | |
|
256 | |
public void setOnclick(String onclick) |
257 | |
{ |
258 | 0 | getStateHelper().put(PropertyKeys.onclick, onclick ); |
259 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONCLICK_PROP); |
260 | 0 | } |
261 | |
|
262 | |
|
263 | |
public String getOndblclick() |
264 | |
{ |
265 | 0 | return (String) getStateHelper().eval(PropertyKeys.ondblclick); |
266 | |
} |
267 | |
|
268 | |
public void setOndblclick(String ondblclick) |
269 | |
{ |
270 | 0 | getStateHelper().put(PropertyKeys.ondblclick, ondblclick ); |
271 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONDBLCLICK_PROP); |
272 | 0 | } |
273 | |
|
274 | |
|
275 | |
public String getOnkeydown() |
276 | |
{ |
277 | 0 | return (String) getStateHelper().eval(PropertyKeys.onkeydown); |
278 | |
} |
279 | |
|
280 | |
public void setOnkeydown(String onkeydown) |
281 | |
{ |
282 | 0 | getStateHelper().put(PropertyKeys.onkeydown, onkeydown ); |
283 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYDOWN_PROP); |
284 | 0 | } |
285 | |
|
286 | |
|
287 | |
public String getOnkeypress() |
288 | |
{ |
289 | 0 | return (String) getStateHelper().eval(PropertyKeys.onkeypress); |
290 | |
} |
291 | |
|
292 | |
public void setOnkeypress(String onkeypress) |
293 | |
{ |
294 | 0 | getStateHelper().put(PropertyKeys.onkeypress, onkeypress ); |
295 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYPRESS_PROP); |
296 | 0 | } |
297 | |
|
298 | |
|
299 | |
public String getOnkeyup() |
300 | |
{ |
301 | 0 | return (String) getStateHelper().eval(PropertyKeys.onkeyup); |
302 | |
} |
303 | |
|
304 | |
public void setOnkeyup(String onkeyup) |
305 | |
{ |
306 | 0 | getStateHelper().put(PropertyKeys.onkeyup, onkeyup ); |
307 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYUP_PROP); |
308 | 0 | } |
309 | |
|
310 | |
|
311 | |
public String getOnmousedown() |
312 | |
{ |
313 | 0 | return (String) getStateHelper().eval(PropertyKeys.onmousedown); |
314 | |
} |
315 | |
|
316 | |
public void setOnmousedown(String onmousedown) |
317 | |
{ |
318 | 0 | getStateHelper().put(PropertyKeys.onmousedown, onmousedown ); |
319 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEDOWN_PROP); |
320 | 0 | } |
321 | |
|
322 | |
|
323 | |
public String getOnmousemove() |
324 | |
{ |
325 | 0 | return (String) getStateHelper().eval(PropertyKeys.onmousemove); |
326 | |
} |
327 | |
|
328 | |
public void setOnmousemove(String onmousemove) |
329 | |
{ |
330 | 0 | getStateHelper().put(PropertyKeys.onmousemove, onmousemove ); |
331 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEMOVE_PROP); |
332 | 0 | } |
333 | |
|
334 | |
|
335 | |
public String getOnmouseout() |
336 | |
{ |
337 | 0 | return (String) getStateHelper().eval(PropertyKeys.onmouseout); |
338 | |
} |
339 | |
|
340 | |
public void setOnmouseout(String onmouseout) |
341 | |
{ |
342 | 0 | getStateHelper().put(PropertyKeys.onmouseout, onmouseout ); |
343 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEOUT_PROP); |
344 | 0 | } |
345 | |
|
346 | |
|
347 | |
public String getOnmouseover() |
348 | |
{ |
349 | 0 | return (String) getStateHelper().eval(PropertyKeys.onmouseover); |
350 | |
} |
351 | |
|
352 | |
public void setOnmouseover(String onmouseover) |
353 | |
{ |
354 | 0 | getStateHelper().put(PropertyKeys.onmouseover, onmouseover ); |
355 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEOVER_PROP); |
356 | 0 | } |
357 | |
|
358 | |
|
359 | |
public String getOnmouseup() |
360 | |
{ |
361 | 0 | return (String) getStateHelper().eval(PropertyKeys.onmouseup); |
362 | |
} |
363 | |
|
364 | |
public void setOnmouseup(String onmouseup) |
365 | |
{ |
366 | 0 | getStateHelper().put(PropertyKeys.onmouseup, onmouseup ); |
367 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEUP_PROP); |
368 | 0 | } |
369 | |
|
370 | |
|
371 | |
public String getDir() |
372 | |
{ |
373 | 0 | return (String) getStateHelper().eval(PropertyKeys.dir); |
374 | |
} |
375 | |
|
376 | |
public void setDir(String dir) |
377 | |
{ |
378 | 0 | getStateHelper().put(PropertyKeys.dir, dir ); |
379 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.DIR_PROP); |
380 | 0 | } |
381 | |
|
382 | |
|
383 | |
public String getLang() |
384 | |
{ |
385 | 0 | return (String) getStateHelper().eval(PropertyKeys.lang); |
386 | |
} |
387 | |
|
388 | |
public void setLang(String lang) |
389 | |
{ |
390 | 0 | getStateHelper().put(PropertyKeys.lang, lang ); |
391 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.LANG_PROP); |
392 | 0 | } |
393 | |
|
394 | |
|
395 | |
public String getTitle() |
396 | |
{ |
397 | 0 | return (String) getStateHelper().eval(PropertyKeys.title); |
398 | |
} |
399 | |
|
400 | |
public void setTitle(String title) |
401 | |
{ |
402 | 0 | getStateHelper().put(PropertyKeys.title, title ); |
403 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.TITLE_PROP); |
404 | 0 | } |
405 | |
|
406 | |
|
407 | |
public boolean isDisabled() |
408 | |
{ |
409 | 0 | return (Boolean) getStateHelper().eval(PropertyKeys.disabled, false); |
410 | |
} |
411 | |
|
412 | |
public void setDisabled(boolean disabled) |
413 | |
{ |
414 | 0 | getStateHelper().put(PropertyKeys.disabled, disabled ); |
415 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.DISABLED_PROP); |
416 | 0 | } |
417 | |
|
418 | |
|
419 | |
public boolean isReadonly() |
420 | |
{ |
421 | 0 | return (Boolean) getStateHelper().eval(PropertyKeys.readonly, false); |
422 | |
} |
423 | |
|
424 | |
public void setReadonly(boolean readonly) |
425 | |
{ |
426 | 0 | getStateHelper().put(PropertyKeys.readonly, readonly ); |
427 | 0 | _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.READONLY_PROP); |
428 | 0 | } |
429 | |
|
430 | |
public void setValueBinding(String name, ValueBinding binding) |
431 | |
{ |
432 | 0 | super.setValueBinding(name, binding); |
433 | 0 | _CommonPropertyConstants.markProperty(this, name); |
434 | 0 | } |
435 | |
|
436 | |
public void setValueExpression(String name, ValueExpression expression) |
437 | |
{ |
438 | 0 | super.setValueExpression(name, expression); |
439 | 0 | _CommonPropertyConstants.markProperty(this, name); |
440 | 0 | } |
441 | |
|
442 | 0 | protected enum PropertyKeys |
443 | |
{ |
444 | 0 | image |
445 | 0 | , type |
446 | 0 | , label |
447 | 0 | , style |
448 | 0 | , styleClass |
449 | 0 | , alt |
450 | 0 | , tabindex |
451 | 0 | , onblur |
452 | 0 | , onfocus |
453 | 0 | , accesskey |
454 | 0 | , role |
455 | 0 | , onchange |
456 | 0 | , onselect |
457 | 0 | , onclick |
458 | 0 | , ondblclick |
459 | 0 | , onkeydown |
460 | 0 | , onkeypress |
461 | 0 | , onkeyup |
462 | 0 | , onmousedown |
463 | 0 | , onmousemove |
464 | 0 | , onmouseout |
465 | 0 | , onmouseover |
466 | 0 | , onmouseup |
467 | 0 | , dir |
468 | 0 | , lang |
469 | 0 | , title |
470 | 0 | , disabled |
471 | 0 | , readonly |
472 | |
} |
473 | |
|
474 | |
} |