1 58 package org.apache.ecs.xhtml; 59 60 import org.apache.ecs.*; 61 62 70 public class form extends MultiPartElement implements Printable, FormEvents, MouseEvents, KeyEvents 71 { 72 public static final String get = "get"; 73 public static final String post = "post"; 74 75 public static final String ENC_DEFAULT = "application/x-www-form-urlencoded"; 76 public static final String ENC_UPLOAD = "multipart/form-data"; 77 78 81 { 82 setElementType("form"); 83 setCase(LOWERCASE); 84 setAttributeQuote(true); 85 setEncType ( ENC_DEFAULT ); 86 setAcceptCharset("UNKNOWN"); 87 } 88 89 93 public form() 94 { 95 } 96 97 103 public form(Element element) 104 { 105 addElement(element); 106 } 107 108 114 public form(String action) 115 { 116 setAction(action); 117 } 118 119 126 public form(String action, Element element) 127 { 128 addElement(element); 129 setAction(action); 130 } 131 132 140 public form(String action, String method, Element element) 141 { 142 addElement(element); 143 setAction(action); 144 setMethod(method); 145 } 146 147 154 public form(String action, String method) 155 { 156 setAction(action); 157 setMethod(method); 158 } 159 160 168 public form(String action, String method, String enctype) 169 { 170 setAction(action); 171 setMethod(method); 172 setEncType(enctype); 173 } 174 175 179 public form setAction(String action) 180 { 181 addAttribute("action",action); 182 return this; 183 } 184 185 189 public form setMethod(String method) 190 { 191 addAttribute("method",method); 192 return this; 193 } 194 195 199 public form setEncType(String enctype) 200 { 201 addAttribute("enctype",enctype); 202 return this; 203 } 204 205 209 public form setAccept(String accept) 210 { 211 addAttribute("accept",accept); 212 return this; 213 } 214 215 219 public form setName(String name) 220 { 221 addAttribute("name",name); 222 return this; 223 } 224 225 229 public form setTarget(String target) 230 { 231 addAttribute("target",target); 232 return this; 233 } 234 235 239 public form setAcceptCharset(String acceptcharset) 240 { 241 addAttribute("accept-charset",acceptcharset); 242 return this; 243 } 244 245 249 public Element setLang(String lang) 250 { 251 addAttribute("lang",lang); 252 addAttribute("xml:lang",lang); 253 return this; 254 } 255 256 261 public form addElement(String hashcode,Element element) 262 { 263 addElementToRegistry(hashcode,element); 264 return(this); 265 } 266 267 272 public form addElement(String hashcode,String element) 273 { 274 addElementToRegistry(hashcode,element); 275 return(this); 276 } 277 278 282 public form addElement(Element element) 283 { 284 addElementToRegistry(element); 285 return(this); 286 } 287 288 292 public form addElement(String element) 293 { 294 addElementToRegistry(element); 295 return(this); 296 } 297 301 public form removeElement(String hashcode) 302 { 303 removeElementFromRegistry(hashcode); 304 return(this); 305 } 306 307 313 public void setOnSubmit(String script) 314 { 315 addAttribute ( "onsubmit", script ); 316 } 317 318 324 public void setOnReset(String script) 325 { 326 addAttribute ( "onreset", script ); 327 } 328 329 335 public void setOnSelect(String script) 336 { 337 addAttribute ( "onselect", script ); 338 } 339 340 347 public void setOnChange(String script) 348 { 349 addAttribute ( "onchange", script ); 350 } 351 352 358 public void setOnClick(String script) 359 { 360 addAttribute ( "onclick", script ); 361 } 362 368 public void setOnDblClick(String script) 369 { 370 addAttribute ( "ondblclick", script ); 371 } 372 378 public void setOnMouseDown(String script) 379 { 380 addAttribute ( "onmousedown", script ); 381 } 382 388 public void setOnMouseUp(String script) 389 { 390 addAttribute ( "onmouseup", script ); 391 } 392 398 public void setOnMouseOver(String script) 399 { 400 addAttribute ( "onmouseover", script ); 401 } 402 408 public void setOnMouseMove(String script) 409 { 410 addAttribute ( "onmousemove", script ); 411 } 412 418 public void setOnMouseOut(String script) 419 { 420 addAttribute ( "onmouseout", script ); 421 } 422 423 429 public void setOnKeyPress(String script) 430 { 431 addAttribute ( "onkeypress", script ); 432 } 433 434 440 public void setOnKeyDown(String script) 441 { 442 addAttribute ( "onkeydown", script ); 443 } 444 445 451 public void setOnKeyUp(String script) 452 { 453 addAttribute ( "onkeyup", script ); 454 } 455 } 456 | Popular Tags |