1 58 package org.apache.ecs.html; 59 60 import org.apache.ecs.*; 61 68 69 public class Button extends MultiPartElement implements Printable, FocusEvents, MouseEvents, KeyEvents 70 { 71 public final static String RESET = "reset"; 73 public final static String SUBMIT = "submit"; 74 public final static String BUTTON = "button"; 75 public final static String reset = "reset"; 76 public final static String submit = "submit"; 77 public final static String button = "button"; 78 79 82 { 83 setElementType("button"); 84 } 85 86 public Button() 87 { 88 } 89 90 94 public Button setName(String name) 95 { 96 addAttribute("name",name); 97 return(this); 98 } 99 100 104 public Button setValue(String value) 105 { 106 addAttribute("value",value); 107 return(this); 108 } 109 110 115 public Button setType(String type) 116 { 117 addAttribute("type",type); 118 return(this); 119 } 120 121 125 public Button setDisabled(boolean disabled) 126 { 127 if(disabled) 128 addAttribute("disabled",NO_ATTRIBUTE_VALUE); 129 else 130 removeAttribute("disabled"); 131 return(this); 132 } 133 134 138 public Button setTabIndex(int number) 139 { 140 addAttribute("tabindex",Integer.toString(number)); 141 return(this); 142 } 143 144 148 public Button setTabIndex(String number) 149 { 150 addAttribute("tabindex",number); 151 return(this); 152 } 153 154 159 public Button addElement(String hashcode,Element element) 160 { 161 addElementToRegistry(hashcode,element); 162 return(this); 163 } 164 165 170 public Button addElement(String hashcode,String element) 171 { 172 addElementToRegistry(hashcode,element); 173 return(this); 174 } 175 176 180 public Button addElement(Element element) 181 { 182 addElementToRegistry(element); 183 return(this); 184 } 185 186 190 public Button addElement(String element) 191 { 192 addElementToRegistry(element); 193 return(this); 194 } 195 199 public Button removeElement(String hashcode) 200 { 201 removeElementFromRegistry(hashcode); 202 return(this); 203 } 204 205 213 public void setOnFocus(String script) 214 { 215 addAttribute ( "onFocus", script ); 216 } 217 218 225 public void setOnBlur(String script) 226 { 227 addAttribute ( "onBlur", script ); 228 } 229 230 236 public void setOnClick(String script) 237 { 238 addAttribute ( "onClick", script ); 239 } 240 246 public void setOnDblClick(String script) 247 { 248 addAttribute ( "onDblClick", script ); 249 } 250 256 public void setOnMouseDown(String script) 257 { 258 addAttribute ( "onMouseDown", script ); 259 } 260 266 public void setOnMouseUp(String script) 267 { 268 addAttribute ( "onMouseUp", script ); 269 } 270 276 public void setOnMouseOver(String script) 277 { 278 addAttribute ( "onMouseOver", script ); 279 } 280 286 public void setOnMouseMove(String script) 287 { 288 addAttribute ( "onMouseMove", script ); 289 } 290 296 public void setOnMouseOut(String script) 297 { 298 addAttribute ( "onMouseOut", script ); 299 } 300 301 307 public void setOnKeyPress(String script) 308 { 309 addAttribute ( "onKeyPress", script ); 310 } 311 312 318 public void setOnKeyDown(String script) 319 { 320 addAttribute ( "onKeyDown", script ); 321 } 322 323 329 public void setOnKeyUp(String script) 330 { 331 addAttribute ( "onKeyUp", script ); 332 } 333 } 334 | Popular Tags |