1 58 package org.apache.ecs.html; 59 60 import org.apache.ecs.*; 61 62 69 public class Area extends SinglePartElement implements Printable, FocusEvents, MouseEvents, KeyEvents 70 { 71 72 public static final String DEFAULT = "DEFAULT"; 73 74 public static final String RECT = "RECT"; 75 public static final String CIRCLE = "CIRCLE"; 76 public static final String POLY = "POLY"; 77 78 public static final String rect = "rect"; 79 public static final String circle = "circle"; 80 public static final String poly = "poly"; 81 82 85 { 86 setElementType("area"); 87 setNoHref(true); 88 } 89 90 94 public Area() 95 { 96 } 97 98 104 public Area(String shape) 105 { 106 setShape(shape); 107 } 108 109 116 public Area(String shape, String coords) 117 { 118 setShape(shape); 119 setCoords(coords); 120 } 121 122 129 public Area(String shape, int[] coords) 130 { 131 setShape(shape); 132 setCoords(coords); 133 } 134 135 143 public Area(String shape, String coords, String href) 144 { 145 setShape(shape); 146 setCoords(coords); 147 setHref(href); 148 } 149 150 158 public Area(String shape, int[] coords, String href) 159 { 160 setShape(shape); 161 setCoords(coords); 162 setHref(href); 163 } 164 165 169 public Area setShape(String shape) 170 { 171 addAttribute("shape",shape); 172 return this; 173 } 174 175 179 public Area setCoords(String coords) 180 { 181 addAttribute("coords",coords); 182 return this; 183 } 184 185 189 public Area setCoords(int[] coords) 190 { 191 addAttribute("coords", coords[0] + "," + coords[1] + "," + 192 coords[2] + "," + coords[3]); 193 return this; 194 } 195 196 200 public Area setHref(String href) 201 { 202 addAttribute("href",href); 203 setNoHref(false); 204 return this; 205 } 206 207 211 public Area setAlt(String alt) 212 { 213 addAttribute("alt",alt); 214 return this; 215 } 216 217 221 public Area setTabindex(String index) 222 { 223 addAttribute("tabindex",index); 224 return this; 225 } 226 227 231 public Area setTabindex(int index) 232 { 233 setTabindex(Integer.toString(index)); 234 return this; 235 } 236 237 241 public Area setNoHref(boolean href) 242 { 243 if ( href == true ) 244 addAttribute("nohref", NO_ATTRIBUTE_VALUE); 245 else 246 removeAttribute("nohref"); 247 248 return(this); 249 } 250 251 256 public Area addElement(String hashcode,Element element) 257 { 258 addElementToRegistry(hashcode,element); 259 return(this); 260 } 261 262 267 public Area addElement(String hashcode,String element) 268 { 269 addElementToRegistry(hashcode,element); 270 return(this); 271 } 272 273 277 public Area addElement(String element) 278 { 279 addElementToRegistry(element); 280 return(this); 281 } 282 283 287 public Area addElement(Element element) 288 { 289 addElementToRegistry(element); 290 return(this); 291 } 292 296 public Area removeElement(String hashcode) 297 { 298 removeElementFromRegistry(hashcode); 299 return(this); 300 } 301 302 310 public void setOnFocus(String script) 311 { 312 addAttribute ( "onFocus", script ); 313 } 314 315 322 public void setOnBlur(String script) 323 { 324 addAttribute ( "onBlur", script ); 325 } 326 327 333 public void setOnClick(String script) 334 { 335 addAttribute ( "onClick", script ); 336 } 337 343 public void setOnDblClick(String script) 344 { 345 addAttribute ( "onDblClick", script ); 346 } 347 353 public void setOnMouseDown(String script) 354 { 355 addAttribute ( "onMouseDown", script ); 356 } 357 363 public void setOnMouseUp(String script) 364 { 365 addAttribute ( "onMouseUp", script ); 366 } 367 373 public void setOnMouseOver(String script) 374 { 375 addAttribute ( "onMouseOver", script ); 376 } 377 383 public void setOnMouseMove(String script) 384 { 385 addAttribute ( "onMouseMove", script ); 386 } 387 393 public void setOnMouseOut(String script) 394 { 395 addAttribute ( "onMouseOut", script ); 396 } 397 398 404 public void setOnKeyPress(String script) 405 { 406 addAttribute ( "onKeyPress", script ); 407 } 408 409 415 public void setOnKeyDown(String script) 416 { 417 addAttribute ( "onKeyDown", script ); 418 } 419 420 426 public void setOnKeyUp(String script) 427 { 428 addAttribute ( "onKeyUp", script ); 429 } 430 } 431 | Popular Tags |