1 57 package org.enhydra.xml.lazydom.html; 58 import org.enhydra.xml.lazydom.LazyElement; 59 import org.enhydra.xml.lazydom.LazyElementNoNS; 60 import org.w3c.dom.Node ; 61 import org.w3c.dom.html.HTMLTableCellElement; 62 import org.w3c.dom.html.HTMLTableRowElement; 63 64 65 71 public class HTMLTableCellElementImpl 72 extends LazyHTMLElement 73 implements HTMLTableCellElement 74 { 75 76 77 public int getCellIndex() 78 { 79 Node parent; 80 Node child; 81 int index; 82 83 parent = getParentNode(); 84 index = 0; 85 if ( parent instanceof HTMLTableRowElement ) 86 { 87 child = parent.getFirstChild(); 88 while ( child != null ) 89 { 90 if ( child instanceof HTMLTableCellElement ) 91 { 92 if ( child == this ) 93 return index; 94 ++ index; 95 } 96 child = child.getNextSibling(); 97 } 98 } 99 return -1; 100 } 101 102 103 public void setCellIndex( int cellIndex ) 104 { 105 Node parent; 106 Node child; 107 int index; 108 109 parent = getParentNode(); 110 if ( parent instanceof HTMLTableRowElement ) 111 { 112 child = parent.getFirstChild(); 113 while ( child != null ) 114 { 115 if ( child instanceof HTMLTableCellElement ) 116 { 117 if ( cellIndex == 0 ) 118 { 119 if ( this != child ) 120 parent.insertBefore( this, child ); 121 return; 122 } 123 -- cellIndex; 124 } 125 child = child.getNextSibling(); 126 } 127 } 128 parent.appendChild( this ); 129 } 130 131 132 public String getAbbr() 133 { 134 return getAttribute( "abbr" ); 135 } 136 137 138 public void setAbbr( String abbr ) 139 { 140 setAttribute( "abbr", abbr ); 141 } 142 143 144 public String getAlign() 145 { 146 return capitalize( getAttribute( "align" ) ); 147 } 148 149 150 public void setAlign( String align ) 151 { 152 setAttribute( "align", align ); 153 } 154 155 156 public String getAxis() 157 { 158 return getAttribute( "axis" ); 159 } 160 161 162 public void setAxis( String axis ) 163 { 164 setAttribute( "axis", axis ); 165 } 166 167 public String getBgColor() 168 { 169 return getAttribute( "bgcolor" ); 170 } 171 172 173 public void setBgColor( String bgColor ) 174 { 175 setAttribute( "bgcolor", bgColor ); 176 } 177 178 179 public String getCh() 180 { 181 String ch; 182 183 ch = getAttribute( "char" ); 185 if ( ch != null && ch.length() > 1 ) 186 ch = ch.substring( 0, 1 ); 187 return ch; 188 } 189 190 191 public void setCh( String ch ) 192 { 193 if ( ch != null && ch.length() > 1 ) 195 ch = ch.substring( 0, 1 ); 196 setAttribute( "char", ch ); 197 } 198 199 200 public String getChOff() 201 { 202 return getAttribute( "charoff" ); 203 } 204 205 206 public void setChOff( String chOff ) 207 { 208 setAttribute( "charoff", chOff ); 209 } 210 211 212 public int getColSpan() 213 { 214 return getInteger( getAttribute( "colspan" ) ); 215 } 216 217 218 public void setColSpan( int colspan ) 219 { 220 setAttribute( "colspan", String.valueOf( colspan ) ); 221 } 222 223 224 public String getHeaders() 225 { 226 return getAttribute( "headers" ); 227 } 228 229 230 public void setHeaders( String headers ) 231 { 232 setAttribute( "headers", headers ); 233 } 234 235 236 public String getHeight() 237 { 238 return getAttribute( "height" ); 239 } 240 241 242 public void setHeight( String height ) 243 { 244 setAttribute( "height", height ); 245 } 246 247 248 public boolean getNoWrap() 249 { 250 return getBinary( "nowrap" ); 251 } 252 253 254 public void setNoWrap( boolean noWrap ) 255 { 256 setAttribute( "nowrap", noWrap ); 257 } 258 259 public int getRowSpan() 260 { 261 return getInteger( getAttribute( "rowspan" ) ); 262 } 263 264 265 public void setRowSpan( int rowspan ) 266 { 267 setAttribute( "rowspan", String.valueOf( rowspan ) ); 268 } 269 270 271 public String getScope() 272 { 273 return getAttribute( "scope" ); 274 } 275 276 277 public void setScope( String scope ) 278 { 279 setAttribute( "scope", scope ); 280 } 281 282 283 public String getVAlign() 284 { 285 return capitalize( getAttribute( "valign" ) ); 286 } 287 288 289 public void setVAlign( String vAlign ) 290 { 291 setAttribute( "valign", vAlign ); 292 } 293 294 295 public String getWidth() 296 { 297 return getAttribute( "width" ); 298 } 299 300 301 public void setWidth( String width ) 302 { 303 setAttribute( "width", width ); 304 } 305 306 307 312 public HTMLTableCellElementImpl( LazyHTMLDocument owner, LazyElement template, String name ) 313 { 314 super( owner, template, name ); 315 } 316 317 318 } 319 320 | Popular Tags |