1 58 package org.apache.ecs.xhtml; 59 60 import org.apache.ecs.*; 61 62 70 public class select extends MultiPartElement implements Printable, PageEvents, FormEvents, MouseEvents, KeyEvents 71 { 72 75 { 76 setElementType("select"); 77 setCase(LOWERCASE); 78 setAttributeQuote(true); 79 } 80 83 public select() 84 { 85 } 86 87 91 public select(String name) 92 { 93 setName(name); 94 } 95 96 101 public select(String name, String size) 102 { 103 setName(name); 104 setSize(size); 105 } 106 107 112 public select(String name, int size) 113 { 114 setName(name); 115 setSize(size); 116 } 117 118 123 public select(String name, String [] element) 124 { 125 setName(name); 126 addElement(element); 127 } 128 129 134 public select(String name, option[] element) 135 { 136 setName(name); 137 addElement(element); 138 } 139 140 144 public Element setLang(String lang) 145 { 146 addAttribute("lang",lang); 147 addAttribute("xml:lang",lang); 148 return this; 149 } 150 151 156 public select addElement(String hashcode,Element element) 157 { 158 addElementToRegistry(hashcode,element); 159 return(this); 160 } 161 162 167 public select addElement(String hashcode,String element) 168 { 169 addElementToRegistry(hashcode,element); 170 return(this); 171 } 172 173 177 public select addElement(Element element) 178 { 179 addElementToRegistry(element); 180 return(this); 181 } 182 183 187 public select addElement(option[] element) 188 { 189 for(int x = 0 ; x < element.length; x++) 190 { 191 addElementToRegistry(element[x]); 192 } 193 return(this); 194 } 195 196 200 public select addElement(String element) 201 { 202 addElementToRegistry(element); 203 return(this); 204 } 205 206 210 public select addElement(String [] element) 211 { 212 option[] options = new option().addElement(element); 213 addElement(options); 214 return(this); 215 } 216 217 221 public select setName(String name) 222 { 223 addAttribute("name",name); 224 return this; 225 } 226 227 231 public select setSize(String size) 232 { 233 addAttribute("size",size); 234 return this; 235 } 236 237 241 public select setSize(int size) 242 { 243 setSize(Integer.toString(size)); 244 return this; 245 } 246 247 251 public select setMultiple(boolean multiple) 252 { 253 if ( multiple == true ) 254 addAttribute("multiple", "multiple"); 255 else 256 removeAttribute("multiple"); 257 258 return(this); 259 } 260 261 265 public select setTabindex(String index) 266 { 267 addAttribute("tabindex",index); 268 return this; 269 } 270 271 275 public select setTabindex(int index) 276 { 277 setTabindex(Integer.toString(index)); 278 return this; 279 } 280 281 285 public select setDisabled(boolean disabled) 286 { 287 if ( disabled == true ) 288 addAttribute("disabled", "disabled"); 289 else 290 removeAttribute("disabled"); 291 292 return(this); 293 } 294 298 public select removeElement(String hashcode) 299 { 300 removeElementFromRegistry(hashcode); 301 return(this); 302 } 303 304 311 public void setOnLoad(String script) 312 { 313 addAttribute ( "onload", script ); 314 } 315 316 323 public void setOnUnload(String script) 324 { 325 addAttribute ( "onunload", script ); 326 } 327 328 334 public void setOnSubmit(String script) 335 { 336 addAttribute ( "onsubmit", script ); 337 } 338 339 345 public void setOnReset(String script) 346 { 347 addAttribute ( "onreset", script ); 348 } 349 350 356 public void setOnSelect(String script) 357 { 358 addAttribute ( "onselect", script ); 359 } 360 361 368 public void setOnChange(String script) 369 { 370 addAttribute ( "onchange", script ); 371 } 372 373 379 public void setOnClick(String script) 380 { 381 addAttribute ( "onclick", script ); 382 } 383 389 public void setOnDblClick(String script) 390 { 391 addAttribute ( "ondblclick", script ); 392 } 393 399 public void setOnMouseDown(String script) 400 { 401 addAttribute ( "onmousedown", script ); 402 } 403 409 public void setOnMouseUp(String script) 410 { 411 addAttribute ( "onmouseup", script ); 412 } 413 419 public void setOnMouseOver(String script) 420 { 421 addAttribute ( "onmouseover", script ); 422 } 423 429 public void setOnMouseMove(String script) 430 { 431 addAttribute ( "onmousemove", script ); 432 } 433 439 public void setOnMouseOut(String script) 440 { 441 addAttribute ( "onmouseout", script ); 442 } 443 444 450 public void setOnKeyPress(String script) 451 { 452 addAttribute ( "onkeypress", script ); 453 } 454 455 461 public void setOnKeyDown(String script) 462 { 463 addAttribute ( "onkeydown", script ); 464 } 465 466 472 public void setOnKeyUp(String script) 473 { 474 addAttribute ( "onkeyup", script ); 475 } 476 } 477 | Popular Tags |