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