1 58 package org.apache.ecs.xhtml; 59 60 import org.apache.ecs.*; 61 62 69 public class td extends MultiPartElement implements Printable, MouseEvents, KeyEvents 70 { 71 74 { 75 setElementType("td"); 76 setCase(LOWERCASE); 77 setAttributeQuote(true); 78 } 79 80 83 public td() 84 { 85 } 86 87 90 public td(Element element) 91 { 92 addElement(element); 93 } 94 95 98 public td(String element) 99 { 100 addElement(element); 101 } 102 103 111 112 116 public td setAbbr(String cdata) 117 { 118 addAttribute("abbr",cdata); 119 return(this); 120 } 121 122 126 public td setAxis(String cdata) 127 { 128 addAttribute("axis",cdata); 129 return(this); 130 } 131 132 136 public td setAxes(String id_refs) 137 { 138 addAttribute("axes",id_refs); 139 return(this); 140 } 141 142 146 public td setRowSpan(int rowspan) 147 { 148 addAttribute("rowspan",Integer.toString(rowspan)); 149 return(this); 150 } 151 152 156 public td setRowSpan(String rowspan) 157 { 158 addAttribute("rowspan",rowspan); 159 return(this); 160 } 161 162 166 public td setColSpan(int colspan) 167 { 168 addAttribute("colspan",Integer.toString(colspan)); 169 return(this); 170 } 171 172 176 public td setColSpan(String colspan) 177 { 178 addAttribute("colspan",colspan); 179 return(this); 180 } 181 182 186 public td setNoWrap(boolean wrap) 187 { 188 if ( wrap == true ) 189 addAttribute("nowrap", "nowrap"); 190 else 191 removeAttribute("nowrap"); 192 193 return(this); 194 } 195 196 200 public td setWidth(int width) 201 { 202 addAttribute("width",Integer.toString(width)); 203 return(this); 204 } 205 206 210 public td setWidth(String width) 211 { 212 addAttribute("width",width); 213 return(this); 214 } 215 216 220 public td setHeight(int height) 221 { 222 addAttribute("height",Integer.toString(height)); 223 return(this); 224 } 225 226 230 public td setHeight(String height) 231 { 232 addAttribute("height",height); 233 return(this); 234 } 235 236 240 public td setAlign(String align) 241 { 242 addAttribute("align",align); 243 return(this); 244 } 245 246 250 public td setVAlign(String valign) 251 { 252 addAttribute("valign",valign); 253 return(this); 254 } 255 256 260 public td setChar(String character) 261 { 262 addAttribute("char",character); 263 return(this); 264 } 265 266 271 public td setCharOff(int char_off) 272 { 273 addAttribute("charoff",Integer.toString(char_off)); 274 return(this); 275 } 276 277 282 public td setCharOff(String char_off) 283 { 284 addAttribute("charoff",char_off); 285 return(this); 286 } 287 288 292 public td setBgColor(String color) 293 { 294 addAttribute("bgcolor",HtmlColor.convertColor(color)); 295 return(this); 296 } 297 298 302 public Element setLang(String lang) 303 { 304 addAttribute("lang",lang); 305 addAttribute("xml:lang",lang); 306 return this; 307 } 308 309 314 public td addElement(String hashcode,Element element) 315 { 316 addElementToRegistry(hashcode,element); 317 return(this); 318 } 319 320 325 public td addElement(String hashcode,String element) 326 { 327 addElementToRegistry(hashcode,element); 328 return(this); 329 } 330 331 335 public td addElement(Element element) 336 { 337 addElementToRegistry(element); 338 return(this); 339 } 340 341 345 public td addElement(String element) 346 { 347 addElementToRegistry(element); 348 return(this); 349 } 350 354 public td removeElement(String hashcode) 355 { 356 removeElementFromRegistry(hashcode); 357 return(this); 358 } 359 360 366 public void setOnClick(String script) 367 { 368 addAttribute ( "onclick", script ); 369 } 370 376 public void setOnDblClick(String script) 377 { 378 addAttribute ( "ondblclick", script ); 379 } 380 386 public void setOnMouseDown(String script) 387 { 388 addAttribute ( "onmousedown", script ); 389 } 390 396 public void setOnMouseUp(String script) 397 { 398 addAttribute ( "onmouseup", script ); 399 } 400 406 public void setOnMouseOver(String script) 407 { 408 addAttribute ( "onmouseover", script ); 409 } 410 416 public void setOnMouseMove(String script) 417 { 418 addAttribute ( "onmousemove", script ); 419 } 420 426 public void setOnMouseOut(String script) 427 { 428 addAttribute ( "onmouseout", script ); 429 } 430 431 437 public void setOnKeyPress(String script) 438 { 439 addAttribute ( "onkeypress", script ); 440 } 441 442 448 public void setOnKeyDown(String script) 449 { 450 addAttribute ( "onkeydown", script ); 451 } 452 453 459 public void setOnKeyUp(String script) 460 { 461 addAttribute ( "onkeyup", script ); 462 } 463 464 467 public boolean getNeedLineBreak() 468 { 469 java.util.Enumeration enum = elements(); 470 int i=0; 471 int j=0; 472 while(enum.hasMoreElements()) 473 { 474 j++; 475 Object obj = enum.nextElement(); 476 if( obj instanceof img || obj instanceof a ) 477 i++; 478 } 479 if ( i==j) 480 return false; 481 return true; 482 } 483 484 } 485 | Popular Tags |