1 58 package org.apache.ecs.html; 59 60 import org.apache.ecs.*; 61 62 68 public class TD extends MultiPartElement implements Printable, MouseEvents, KeyEvents 69 { 70 73 { 74 setElementType("td"); 75 } 76 77 81 public TD() 82 { 83 } 84 85 90 public TD(Element element) 91 { 92 addElement(element); 93 } 94 95 100 public TD(String element) 101 { 102 addElement(element); 103 } 104 105 110 public TD(boolean close) 111 { 112 setNeedClosingTag(close); 113 } 114 115 119 public TD setAbbr(String cdata) 120 { 121 addAttribute("abbr",cdata); 122 return(this); 123 } 124 125 129 public TD setAxis(String cdata) 130 { 131 addAttribute("axis",cdata); 132 return(this); 133 } 134 135 139 public TD setAxes(String id_refs) 140 { 141 addAttribute("axes",id_refs); 142 return(this); 143 } 144 145 149 public TD setRowSpan(int rowspan) 150 { 151 addAttribute("rowspan",Integer.toString(rowspan)); 152 return(this); 153 } 154 155 159 public TD setRowSpan(String rowspan) 160 { 161 addAttribute("rowspan",rowspan); 162 return(this); 163 } 164 165 169 public TD setColSpan(int colspan) 170 { 171 addAttribute("colspan",Integer.toString(colspan)); 172 return(this); 173 } 174 175 179 public TD setColSpan(String colspan) 180 { 181 addAttribute("colspan",colspan); 182 return(this); 183 } 184 185 189 public TD setNoWrap(boolean wrap) 190 { 191 if ( wrap == true ) 192 addAttribute("nowrap", NO_ATTRIBUTE_VALUE); 193 else 194 removeAttribute("nowrap"); 195 196 return(this); 197 } 198 199 203 public TD setWidth(int width) 204 { 205 addAttribute("width",Integer.toString(width)); 206 return(this); 207 } 208 209 213 public TD setWidth(String width) 214 { 215 addAttribute("width",width); 216 return(this); 217 } 218 219 223 public TD setHeight(int height) 224 { 225 addAttribute("height",Integer.toString(height)); 226 return(this); 227 } 228 229 233 public TD setHeight(String height) 234 { 235 addAttribute("height",height); 236 return(this); 237 } 238 239 243 public TD setAlign(String align) 244 { 245 addAttribute("align",align); 246 return(this); 247 } 248 249 253 public TD setVAlign(String valign) 254 { 255 addAttribute("valign",valign); 256 return(this); 257 } 258 259 263 public TD setChar(String character) 264 { 265 addAttribute("char",character); 266 return(this); 267 } 268 269 274 public TD setCharOff(int char_off) 275 { 276 addAttribute("charoff",Integer.toString(char_off)); 277 return(this); 278 } 279 280 285 public TD setCharOff(String char_off) 286 { 287 addAttribute("charoff",char_off); 288 return(this); 289 } 290 291 295 public TD setBgColor(String color) 296 { 297 addAttribute("bgcolor",HtmlColor.convertColor(color)); 298 return(this); 299 } 300 301 305 public TD setBackground(String url) 306 { 307 addAttribute("background",url); 308 return(this); 309 } 310 311 316 public TD addElement(String hashcode,Element element) 317 { 318 addElementToRegistry(hashcode,element); 319 return(this); 320 } 321 322 327 public TD addElement(String hashcode,String element) 328 { 329 addElementToRegistry(hashcode,element); 330 return(this); 331 } 332 333 337 public TD addElement(Element element) 338 { 339 addElementToRegistry(element); 340 return(this); 341 } 342 343 347 public TD addElement(String element) 348 { 349 addElementToRegistry(element); 350 return(this); 351 } 352 356 public TD removeElement(String hashcode) 357 { 358 removeElementFromRegistry(hashcode); 359 return(this); 360 } 361 362 368 public void setOnClick(String script) 369 { 370 addAttribute ( "onClick", script ); 371 } 372 378 public void setOnDblClick(String script) 379 { 380 addAttribute ( "onDblClick", script ); 381 } 382 388 public void setOnMouseDown(String script) 389 { 390 addAttribute ( "onMouseDown", script ); 391 } 392 398 public void setOnMouseUp(String script) 399 { 400 addAttribute ( "onMouseUp", script ); 401 } 402 408 public void setOnMouseOver(String script) 409 { 410 addAttribute ( "onMouseOver", script ); 411 } 412 418 public void setOnMouseMove(String script) 419 { 420 addAttribute ( "onMouseMove", script ); 421 } 422 428 public void setOnMouseOut(String script) 429 { 430 addAttribute ( "onMouseOut", script ); 431 } 432 433 439 public void setOnKeyPress(String script) 440 { 441 addAttribute ( "onKeyPress", script ); 442 } 443 444 450 public void setOnKeyDown(String script) 451 { 452 addAttribute ( "onKeyDown", script ); 453 } 454 455 461 public void setOnKeyUp(String script) 462 { 463 addAttribute ( "onKeyUp", script ); 464 } 465 466 469 public boolean getNeedLineBreak() 470 { 471 java.util.Enumeration enum = elements(); 472 int i=0; 473 int j=0; 474 while(enum.hasMoreElements()) 475 { 476 j++; 477 Object obj = enum.nextElement(); 478 if( obj instanceof IMG || obj instanceof A ) 479 i++; 480 } 481 if ( i==j) 482 return false; 483 return true; 484 } 485 486 } 487 | Popular Tags |