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