1 58 package org.apache.ecs.html; 59 60 import org.apache.ecs.*; 61 62 69 public class IMG extends SinglePartElement implements Printable, MouseEvents, KeyEvents 70 { 71 74 75 { 76 setElementType("img"); 77 } 78 79 82 public IMG() 83 { 84 } 85 86 91 public IMG(String src) 92 { 93 setSrc(src); 94 } 95 96 102 public IMG(String src, int border) 103 { 104 setSrc(src); 105 setBorder(border); 106 } 107 108 114 public IMG(String src, String name) 115 { 116 setSrc(src); 117 setName(name); 118 } 119 120 127 public IMG(String src, String name, int border) 128 { 129 setSrc(src); 130 setName(name); 131 setBorder(border); 132 } 133 134 138 public IMG setSrc(String src) 139 { 140 addAttribute("src",src); 141 return this; 142 } 143 144 148 public IMG setBorder(int border) 149 { 150 addAttribute("border",Integer.toString(border)); 151 return this; 152 } 153 154 158 public IMG setName(String name) 159 { 160 addAttribute("name",name); 161 return this; 162 } 163 164 168 public IMG setHeight(String height) 169 { 170 addAttribute("height",height); 171 return this; 172 } 173 174 178 public IMG setHeight(int height) 179 { 180 addAttribute("height",Integer.toString(height)); 181 return this; 182 } 183 184 188 public IMG setWidth(String width) 189 { 190 addAttribute("width",width); 191 return this; 192 } 193 194 198 public IMG setWidth(int width) 199 { 200 addAttribute("width",Integer.toString(width)); 201 return this; 202 } 203 204 208 public IMG setAlt(String alt) 209 { 210 addAttribute("alt",alt); 211 return this; 212 } 213 214 218 public IMG setIsMap(boolean ismap) 219 { 220 if(ismap == true) 221 addAttribute("ismap",NO_ATTRIBUTE_VALUE); 222 else 223 removeAttribute("ismap"); 224 225 return this; 226 } 227 228 232 public IMG setUseMap(String usemap) 233 { 234 addAttribute("usemap",usemap); 235 return this; 236 } 237 238 242 public IMG setAlign(String align) 243 { 244 addAttribute("align",align); 245 return this; 246 } 247 248 252 public IMG setHspace(String hspace) 253 { 254 addAttribute("hspace",hspace); 255 return this; 256 } 257 258 262 public IMG setHspace(int hspace) 263 { 264 addAttribute("hspace",Integer.toString(hspace)); 265 return this; 266 } 267 268 272 public IMG setVspace(String vspace) 273 { 274 addAttribute("vspace",vspace); 275 return this; 276 } 277 278 282 public IMG setVspace(int vspace) 283 { 284 addAttribute("vspace",Integer.toString(vspace)); 285 return this; 286 } 287 288 293 public IMG addElement(String hashcode,Element element) 294 { 295 addElementToRegistry(hashcode,element); 296 return(this); 297 } 298 299 304 public IMG addElement(String hashcode,String element) 305 { 306 addElementToRegistry(hashcode,element); 307 return(this); 308 } 309 310 314 public IMG addElement(Element element) 315 { 316 addElementToRegistry(element); 317 return(this); 318 } 319 320 324 public IMG addElement(String element) 325 { 326 addElementToRegistry(element); 327 return(this); 328 } 329 333 public IMG removeElement(String hashcode) 334 { 335 removeElementFromRegistry(hashcode); 336 return(this); 337 } 338 339 345 public void setOnClick(String script) 346 { 347 addAttribute ( "onClick", script ); 348 } 349 355 public void setOnDblClick(String script) 356 { 357 addAttribute ( "onDblClick", script ); 358 } 359 365 public void setOnMouseDown(String script) 366 { 367 addAttribute ( "onMouseDown", script ); 368 } 369 375 public void setOnMouseUp(String script) 376 { 377 addAttribute ( "onMouseUp", script ); 378 } 379 385 public void setOnMouseOver(String script) 386 { 387 addAttribute ( "onMouseOver", script ); 388 } 389 395 public void setOnMouseMove(String script) 396 { 397 addAttribute ( "onMouseMove", script ); 398 } 399 405 public void setOnMouseOut(String script) 406 { 407 addAttribute ( "onMouseOut", script ); 408 } 409 410 416 public void setOnKeyPress(String script) 417 { 418 addAttribute ( "onKeyPress", script ); 419 } 420 421 427 public void setOnKeyDown(String script) 428 { 429 addAttribute ( "onKeyDown", script ); 430 } 431 432 438 public void setOnKeyUp(String script) 439 { 440 addAttribute ( "onKeyUp", script ); 441 } 442 } 443 | Popular Tags |