1 58 package org.apache.ecs.xhtml; 59 60 import org.apache.ecs.*; 61 62 70 public class input extends SinglePartElement implements Printable, 71 FormEvents, PageEvents, FocusEvents, MouseEvents, KeyEvents 72 { 73 public static final String text = "text"; 74 public static final String password = "password"; 75 public static final String checkbox = "checkbox"; 76 public static final String radio = "radio"; 77 public static final String file = "file"; 78 public static final String button = "button"; 79 public static final String image = "image"; 80 public static final String hidden = "hidden"; 81 public static final String submit = "submit"; 82 public static final String reset = "reset"; 83 84 87 { 88 setElementType("input"); 89 setCase(LOWERCASE); 90 setAttributeQuote(true); 91 setBeginEndModifier('/'); 92 } 93 94 98 public input() 99 { 100 } 101 102 106 public input(String type, String name, String value) 107 { 108 setType(type); 109 setName(name); 110 setValue(value); 111 } 112 113 117 public input(String type, String name, int value) 118 { 119 setType(type); 120 setName(name); 121 setValue(value); 122 } 123 124 128 public input(String type, String name, Integer value) 129 { 130 setType(type); 131 setName(name); 132 setValue(value); 133 } 134 135 139 public input(String type, String name, double value) 140 { 141 setType(type); 142 setName(name); 143 setValue(value); 144 } 145 146 150 public input setType(String type) 151 { 152 addAttribute("type",type); 153 return this; 154 } 155 156 160 public input setSrc(String src) 161 { 162 addAttribute("src",src); 163 return this; 164 } 165 166 170 public input setBorder(int border) 171 { 172 addAttribute("border", Integer.toString(border)); 173 return this; 174 } 175 176 180 public input setAlt(String alt) 181 { 182 addAttribute("alt",alt); 183 return this; 184 } 185 186 190 public input setName(String name) 191 { 192 addAttribute("name",name); 193 return this; 194 } 195 196 200 public input setValue(String value) 201 { 202 addAttribute("value",value); 203 return this; 204 } 205 206 210 public input setValue(int value) 211 { 212 addAttribute("value",Integer.toString(value)); 213 return this; 214 } 215 216 220 public input setValue(Integer value) 221 { 222 addAttribute("value",value.toString()); 223 return this; 224 } 225 226 230 public input setValue(double value) 231 { 232 addAttribute("value",Double.toString(value)); 233 return this; 234 } 235 236 240 public input setAccept(String accept) 241 { 242 addAttribute("accept",accept); 243 return this; 244 } 245 246 250 public input setSize(String size) 251 { 252 addAttribute("size",size); 253 return this; 254 } 255 256 260 public input setSize(int size) 261 { 262 setSize(Integer.toString(size)); 263 return this; 264 } 265 266 270 public input setMaxlength(String maxlength) 271 { 272 addAttribute("maxlength",maxlength); 273 return this; 274 } 275 276 280 public input setMaxlength(int maxlength) 281 { 282 setMaxlength(Integer.toString(maxlength)); 283 return this; 284 } 285 286 290 public input setUsemap(String usemap) 291 { 292 addAttribute("usemap",usemap); 293 return this; 294 } 295 296 300 public input setTabindex(String index) 301 { 302 addAttribute("tabindex",index); 303 return this; 304 } 305 306 310 public input setTabindex(int index) 311 { 312 setTabindex(Integer.toString(index)); 313 return this; 314 } 315 316 320 public input setChecked(boolean checked) 321 { 322 if ( checked == true ) 323 addAttribute("checked", "checked"); 324 else 325 removeAttribute("checked"); 326 327 return(this); 328 } 329 330 334 public input setReadOnly(boolean readonly) 335 { 336 if ( readonly == true ) 337 addAttribute("readonly", "readonly"); 338 else 339 removeAttribute("readonly"); 340 341 return(this); 342 } 343 344 348 public input setDisabled(boolean disabled) 349 { 350 if ( disabled == true ) 351 addAttribute("disabled", "disabled"); 352 else 353 removeAttribute("disabled"); 354 355 return(this); 356 } 357 358 362 public Element setLang(String lang) 363 { 364 addAttribute("lang",lang); 365 addAttribute("xml:lang",lang); 366 return this; 367 } 368 369 374 public input addElement(String hashcode,Element element) 375 { 376 addElementToRegistry(hashcode,element); 377 return(this); 378 } 379 380 385 public input addElement(String hashcode,String element) 386 { 387 addElementToRegistry(hashcode,element); 388 return(this); 389 } 390 394 public input addElement(Element element) 395 { 396 addElementToRegistry(element); 397 return(this); 398 } 399 400 404 public input addElement(String element) 405 { 406 addElementToRegistry(element); 407 return(this); 408 } 409 413 public input removeElement(String hashcode) 414 { 415 removeElementFromRegistry(hashcode); 416 return(this); 417 } 418 419 425 public void setOnSubmit(String script) 426 { 427 addAttribute ( "onsubmit", script ); 428 } 429 430 436 public void setOnReset(String script) 437 { 438 addAttribute ( "onreset", script ); 439 } 440 441 447 public void setOnSelect(String script) 448 { 449 addAttribute ( "onselect", script ); 450 } 451 452 459 public void setOnChange(String script) 460 { 461 addAttribute ( "onchange", script ); 462 } 463 464 471 public void setOnLoad(String script) 472 { 473 addAttribute ( "onload", script ); 474 } 475 476 483 public void setOnUnload(String script) 484 { 485 addAttribute ( "onunload", script ); 486 } 487 488 496 public void setOnFocus(String script) 497 { 498 addAttribute ( "onfocus", script ); 499 } 500 501 508 public void setOnBlur(String script) 509 { 510 addAttribute ( "onblur", script ); 511 } 512 513 519 public void setOnClick(String script) 520 { 521 addAttribute ( "onclick", script ); 522 } 523 529 public void setOnDblClick(String script) 530 { 531 addAttribute ( "ondblclick", script ); 532 } 533 539 public void setOnMouseDown(String script) 540 { 541 addAttribute ( "onmousedown", script ); 542 } 543 549 public void setOnMouseUp(String script) 550 { 551 addAttribute ( "onmouseup", script ); 552 } 553 559 public void setOnMouseOver(String script) 560 { 561 addAttribute ( "onmouseover", script ); 562 } 563 569 public void setOnMouseMove(String script) 570 { 571 addAttribute ( "onmousemove", script ); 572 } 573 579 public void setOnMouseOut(String script) 580 { 581 addAttribute ( "onmouseout", script ); 582 } 583 584 590 public void setOnKeyPress(String script) 591 { 592 addAttribute ( "onkeypress", script ); 593 } 594 595 601 public void setOnKeyDown(String script) 602 { 603 addAttribute ( "onkeydown", script ); 604 } 605 606 612 public void setOnKeyUp(String script) 613 { 614 addAttribute ( "onkeyup", script ); 615 } 616 } 617 | Popular Tags |