KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > component > html > HtmlCommandButton


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.faces.component.html;
17
18 import javax.faces.component.UICommand;
19 import javax.faces.context.FacesContext;
20 import javax.faces.el.ValueBinding;
21
22 /**
23  * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
24  * @version $Revision: 1.6 $ $Date: 2004/07/01 22:01:16 $
25  */

26 public class HtmlCommandButton
27         extends UICommand
28 {
29     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
30

31     public static final String JavaDoc COMPONENT_TYPE = "javax.faces.HtmlCommandButton";
32     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "javax.faces.Button";
33     private static final boolean DEFAULT_DISABLED = false;
34     private static final boolean DEFAULT_READONLY = false;
35     private static final String JavaDoc DEFAULT_TYPE = "submit";
36
37     private String JavaDoc _accesskey = null;
38     private String JavaDoc _alt = null;
39     private String JavaDoc _dir = null;
40     private Boolean JavaDoc _disabled = null;
41     private String JavaDoc _image = null;
42     private String JavaDoc _lang = null;
43     private String JavaDoc _onblur = null;
44     private String JavaDoc _onchange = null;
45     private String JavaDoc _onclick = null;
46     private String JavaDoc _ondblclick = null;
47     private String JavaDoc _onfocus = null;
48     private String JavaDoc _onkeydown = null;
49     private String JavaDoc _onkeypress = null;
50     private String JavaDoc _onkeyup = null;
51     private String JavaDoc _onmousedown = null;
52     private String JavaDoc _onmousemove = null;
53     private String JavaDoc _onmouseout = null;
54     private String JavaDoc _onmouseover = null;
55     private String JavaDoc _onmouseup = null;
56     private String JavaDoc _onselect = null;
57     private Boolean JavaDoc _readonly = null;
58     private String JavaDoc _style = null;
59     private String JavaDoc _styleClass = null;
60     private String JavaDoc _tabindex = null;
61     private String JavaDoc _title = null;
62     private String JavaDoc _type = null;
63
64     public HtmlCommandButton()
65     {
66         setRendererType(DEFAULT_RENDERER_TYPE);
67     }
68
69
70     public void setAccesskey(String JavaDoc accesskey)
71     {
72         _accesskey = accesskey;
73     }
74
75     public String JavaDoc getAccesskey()
76     {
77         if (_accesskey != null) return _accesskey;
78         ValueBinding vb = getValueBinding("accesskey");
79         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
80     }
81
82     public void setAlt(String JavaDoc alt)
83     {
84         _alt = alt;
85     }
86
87     public String JavaDoc getAlt()
88     {
89         if (_alt != null) return _alt;
90         ValueBinding vb = getValueBinding("alt");
91         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
92     }
93
94     public void setDir(String JavaDoc dir)
95     {
96         _dir = dir;
97     }
98
99     public String JavaDoc getDir()
100     {
101         if (_dir != null) return _dir;
102         ValueBinding vb = getValueBinding("dir");
103         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
104     }
105
106     public void setDisabled(boolean disabled)
107     {
108         _disabled = Boolean.valueOf(disabled);
109     }
110
111     public boolean isDisabled()
112     {
113         if (_disabled != null) return _disabled.booleanValue();
114         ValueBinding vb = getValueBinding("disabled");
115         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
116         return v != null ? v.booleanValue() : DEFAULT_DISABLED;
117     }
118
119     public void setImage(String JavaDoc image)
120     {
121         _image = image;
122     }
123
124     public String JavaDoc getImage()
125     {
126         if (_image != null) return _image;
127         ValueBinding vb = getValueBinding("image");
128         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
129     }
130
131     public void setLang(String JavaDoc lang)
132     {
133         _lang = lang;
134     }
135
136     public String JavaDoc getLang()
137     {
138         if (_lang != null) return _lang;
139         ValueBinding vb = getValueBinding("lang");
140         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
141     }
142
143     public void setOnblur(String JavaDoc onblur)
144     {
145         _onblur = onblur;
146     }
147
148     public String JavaDoc getOnblur()
149     {
150         if (_onblur != null) return _onblur;
151         ValueBinding vb = getValueBinding("onblur");
152         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
153     }
154
155     public void setOnchange(String JavaDoc onchange)
156     {
157         _onchange = onchange;
158     }
159
160     public String JavaDoc getOnchange()
161     {
162         if (_onchange != null) return _onchange;
163         ValueBinding vb = getValueBinding("onchange");
164         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
165     }
166
167     public void setOnclick(String JavaDoc onclick)
168     {
169         _onclick = onclick;
170     }
171
172     public String JavaDoc getOnclick()
173     {
174         if (_onclick != null) return _onclick;
175         ValueBinding vb = getValueBinding("onclick");
176         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
177     }
178
179     public void setOndblclick(String JavaDoc ondblclick)
180     {
181         _ondblclick = ondblclick;
182     }
183
184     public String JavaDoc getOndblclick()
185     {
186         if (_ondblclick != null) return _ondblclick;
187         ValueBinding vb = getValueBinding("ondblclick");
188         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
189     }
190
191     public void setOnfocus(String JavaDoc onfocus)
192     {
193         _onfocus = onfocus;
194     }
195
196     public String JavaDoc getOnfocus()
197     {
198         if (_onfocus != null) return _onfocus;
199         ValueBinding vb = getValueBinding("onfocus");
200         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
201     }
202
203     public void setOnkeydown(String JavaDoc onkeydown)
204     {
205         _onkeydown = onkeydown;
206     }
207
208     public String JavaDoc getOnkeydown()
209     {
210         if (_onkeydown != null) return _onkeydown;
211         ValueBinding vb = getValueBinding("onkeydown");
212         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
213     }
214
215     public void setOnkeypress(String JavaDoc onkeypress)
216     {
217         _onkeypress = onkeypress;
218     }
219
220     public String JavaDoc getOnkeypress()
221     {
222         if (_onkeypress != null) return _onkeypress;
223         ValueBinding vb = getValueBinding("onkeypress");
224         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
225     }
226
227     public void setOnkeyup(String JavaDoc onkeyup)
228     {
229         _onkeyup = onkeyup;
230     }
231
232     public String JavaDoc getOnkeyup()
233     {
234         if (_onkeyup != null) return _onkeyup;
235         ValueBinding vb = getValueBinding("onkeyup");
236         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
237     }
238
239     public void setOnmousedown(String JavaDoc onmousedown)
240     {
241         _onmousedown = onmousedown;
242     }
243
244     public String JavaDoc getOnmousedown()
245     {
246         if (_onmousedown != null) return _onmousedown;
247         ValueBinding vb = getValueBinding("onmousedown");
248         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
249     }
250
251     public void setOnmousemove(String JavaDoc onmousemove)
252     {
253         _onmousemove = onmousemove;
254     }
255
256     public String JavaDoc getOnmousemove()
257     {
258         if (_onmousemove != null) return _onmousemove;
259         ValueBinding vb = getValueBinding("onmousemove");
260         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
261     }
262
263     public void setOnmouseout(String JavaDoc onmouseout)
264     {
265         _onmouseout = onmouseout;
266     }
267
268     public String JavaDoc getOnmouseout()
269     {
270         if (_onmouseout != null) return _onmouseout;
271         ValueBinding vb = getValueBinding("onmouseout");
272         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
273     }
274
275     public void setOnmouseover(String JavaDoc onmouseover)
276     {
277         _onmouseover = onmouseover;
278     }
279
280     public String JavaDoc getOnmouseover()
281     {
282         if (_onmouseover != null) return _onmouseover;
283         ValueBinding vb = getValueBinding("onmouseover");
284         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
285     }
286
287     public void setOnmouseup(String JavaDoc onmouseup)
288     {
289         _onmouseup = onmouseup;
290     }
291
292     public String JavaDoc getOnmouseup()
293     {
294         if (_onmouseup != null) return _onmouseup;
295         ValueBinding vb = getValueBinding("onmouseup");
296         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
297     }
298
299     public void setOnselect(String JavaDoc onselect)
300     {
301         _onselect = onselect;
302     }
303
304     public String JavaDoc getOnselect()
305     {
306         if (_onselect != null) return _onselect;
307         ValueBinding vb = getValueBinding("onselect");
308         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
309     }
310
311     public void setReadonly(boolean readonly)
312     {
313         _readonly = Boolean.valueOf(readonly);
314     }
315
316     public boolean isReadonly()
317     {
318         if (_readonly != null) return _readonly.booleanValue();
319         ValueBinding vb = getValueBinding("readonly");
320         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
321         return v != null ? v.booleanValue() : DEFAULT_READONLY;
322     }
323
324     public void setStyle(String JavaDoc style)
325     {
326         _style = style;
327     }
328
329     public String JavaDoc getStyle()
330     {
331         if (_style != null) return _style;
332         ValueBinding vb = getValueBinding("style");
333         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
334     }
335
336     public void setStyleClass(String JavaDoc styleClass)
337     {
338         _styleClass = styleClass;
339     }
340
341     public String JavaDoc getStyleClass()
342     {
343         if (_styleClass != null) return _styleClass;
344         ValueBinding vb = getValueBinding("styleClass");
345         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
346     }
347
348     public void setTabindex(String JavaDoc tabindex)
349     {
350         _tabindex = tabindex;
351     }
352
353     public String JavaDoc getTabindex()
354     {
355         if (_tabindex != null) return _tabindex;
356         ValueBinding vb = getValueBinding("tabindex");
357         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
358     }
359
360     public void setTitle(String JavaDoc title)
361     {
362         _title = title;
363     }
364
365     public String JavaDoc getTitle()
366     {
367         if (_title != null) return _title;
368         ValueBinding vb = getValueBinding("title");
369         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
370     }
371
372     public void setType(String JavaDoc type)
373     {
374         _type = type;
375     }
376
377     public String JavaDoc getType()
378     {
379         if (_type != null) return _type;
380         ValueBinding vb = getValueBinding("type");
381         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : DEFAULT_TYPE;
382     }
383
384
385     public Object JavaDoc saveState(FacesContext context)
386     {
387         Object JavaDoc values[] = new Object JavaDoc[27];
388         values[0] = super.saveState(context);
389         values[1] = _accesskey;
390         values[2] = _alt;
391         values[3] = _dir;
392         values[4] = _disabled;
393         values[5] = _image;
394         values[6] = _lang;
395         values[7] = _onblur;
396         values[8] = _onchange;
397         values[9] = _onclick;
398         values[10] = _ondblclick;
399         values[11] = _onfocus;
400         values[12] = _onkeydown;
401         values[13] = _onkeypress;
402         values[14] = _onkeyup;
403         values[15] = _onmousedown;
404         values[16] = _onmousemove;
405         values[17] = _onmouseout;
406         values[18] = _onmouseover;
407         values[19] = _onmouseup;
408         values[20] = _onselect;
409         values[21] = _readonly;
410         values[22] = _style;
411         values[23] = _styleClass;
412         values[24] = _tabindex;
413         values[25] = _title;
414         values[26] = _type;
415         return ((Object JavaDoc) (values));
416     }
417
418     public void restoreState(FacesContext context, Object JavaDoc state)
419     {
420         Object JavaDoc values[] = (Object JavaDoc[])state;
421         super.restoreState(context, values[0]);
422         _accesskey = (String JavaDoc)values[1];
423         _alt = (String JavaDoc)values[2];
424         _dir = (String JavaDoc)values[3];
425         _disabled = (Boolean JavaDoc)values[4];
426         _image = (String JavaDoc)values[5];
427         _lang = (String JavaDoc)values[6];
428         _onblur = (String JavaDoc)values[7];
429         _onchange = (String JavaDoc)values[8];
430         _onclick = (String JavaDoc)values[9];
431         _ondblclick = (String JavaDoc)values[10];
432         _onfocus = (String JavaDoc)values[11];
433         _onkeydown = (String JavaDoc)values[12];
434         _onkeypress = (String JavaDoc)values[13];
435         _onkeyup = (String JavaDoc)values[14];
436         _onmousedown = (String JavaDoc)values[15];
437         _onmousemove = (String JavaDoc)values[16];
438         _onmouseout = (String JavaDoc)values[17];
439         _onmouseover = (String JavaDoc)values[18];
440         _onmouseup = (String JavaDoc)values[19];
441         _onselect = (String JavaDoc)values[20];
442         _readonly = (Boolean JavaDoc)values[21];
443         _style = (String JavaDoc)values[22];
444         _styleClass = (String JavaDoc)values[23];
445         _tabindex = (String JavaDoc)values[24];
446         _title = (String JavaDoc)values[25];
447         _type = (String JavaDoc)values[26];
448     }
449     //------------------ GENERATED CODE END ---------------------------------------
450
}
451
Popular Tags