1 58 package org.apache.ecs.xhtml; 59 60 import org.apache.ecs.*; 61 62 73 public class option extends MultiPartElement implements Printable, FocusEvents, FormEvents, MouseEvents, KeyEvents 74 75 { 76 77 80 { 81 setElementType("option"); 82 setCase(LOWERCASE); 83 setAttributeQuote(true); 84 } 85 86 90 public option() 91 { 92 } 93 94 100 public option(String value) 101 { 102 setValue(value); 103 } 104 105 112 public option(String label, String value) 113 { 114 setLabel(label); 115 setValue(value); 116 } 117 118 125 public option(String label, int value) 126 { 127 setLabel(label); 128 setValue(value); 129 } 130 131 138 public option(String label, double value) 139 { 140 setLabel(label); 141 setValue(value); 142 } 143 144 148 public option setLabel(String label) 149 { 150 addAttribute("label",label); 151 return this; 152 } 153 154 158 public option setValue(String value) 159 { 160 addAttribute("value",value); 161 return this; 162 } 163 164 168 public option setValue(int value) 169 { 170 addAttribute("value",Integer.toString(value)); 171 return this; 172 } 173 174 178 public option setValue(double value) 179 { 180 addAttribute("value",Double.toString(value)); 181 return this; 182 } 183 184 188 public option setSelected(boolean selected) 189 { 190 if ( selected == true ) 191 addAttribute("selected", "selected"); 192 else 193 removeAttribute("selected"); 194 195 return(this); 196 } 197 198 202 public option setDisabled(boolean disabled) 203 { 204 if ( disabled == true ) 205 addAttribute("disabled", "disabled"); 206 else 207 removeAttribute("disabled"); 208 209 return(this); 210 } 211 212 216 public Element setLang(String lang) 217 { 218 addAttribute("lang",lang); 219 addAttribute("xml:lang",lang); 220 return this; 221 } 222 223 228 public option addElement(String hashcode,Element element) 229 { 230 addElementToRegistry(hashcode,element); 231 return(this); 232 } 233 234 239 public option addElement(String hashcode,String element) 240 { 241 addElementToRegistry(hashcode,element); 242 return(this); 243 } 244 245 249 public option addElement(Element element) 250 { 251 addElementToRegistry(element); 252 return(this); 253 } 254 255 259 public option addElement(String element) 260 { 261 addElementToRegistry(element); 262 return(this); 263 } 264 265 269 public option[] addElement(String [] element) 270 { 271 option[] option = new option[element.length]; 272 for(int x = 0; x < element.length; x++) 273 { 274 option[x]= new option().addElement(element[x]); 275 } 276 return(option); 277 } 278 282 public option removeElement(String hashcode) 283 { 284 removeElementFromRegistry(hashcode); 285 return(this); 286 } 287 288 296 public void setOnFocus(String script) 297 { 298 addAttribute ( "onfocus", script ); 299 } 300 301 308 public void setOnBlur(String script) 309 { 310 addAttribute ( "onblur", script ); 311 } 312 313 319 public void setOnSubmit(String script) 320 { 321 addAttribute ( "onsubmit", script ); 322 } 323 324 330 public void setOnReset(String script) 331 { 332 addAttribute ( "onreset", script ); 333 } 334 335 341 public void setOnSelect(String script) 342 { 343 addAttribute ( "onselect", script ); 344 } 345 346 353 public void setOnChange(String script) 354 { 355 addAttribute ( "onchange", script ); 356 } 357 358 364 public void setOnClick(String script) 365 { 366 addAttribute ( "onclick", script ); 367 } 368 374 public void setOnDblClick(String script) 375 { 376 addAttribute ( "ondblclick", script ); 377 } 378 384 public void setOnMouseDown(String script) 385 { 386 addAttribute ( "onmousedown", script ); 387 } 388 394 public void setOnMouseUp(String script) 395 { 396 addAttribute ( "onmouseup", script ); 397 } 398 404 public void setOnMouseOver(String script) 405 { 406 addAttribute ( "onmouseover", script ); 407 } 408 414 public void setOnMouseMove(String script) 415 { 416 addAttribute ( "onmousemove", script ); 417 } 418 424 public void setOnMouseOut(String script) 425 { 426 addAttribute ( "onmouseout", script ); 427 } 428 429 435 public void setOnKeyPress(String script) 436 { 437 addAttribute ( "onkeypress", script ); 438 } 439 440 446 public void setOnKeyDown(String script) 447 { 448 addAttribute ( "onkeydown", script ); 449 } 450 451 457 public void setOnKeyUp(String script) 458 { 459 addAttribute ( "onkeyup", script ); 460 } 461 } 462 | Popular Tags |