1 24 25 package org.enhydra.xml.xhtml.dom.xerces; 26 27 import org.w3c.dom.Node ; 28 import org.w3c.dom.NodeList ; 29 import org.w3c.dom.html.HTMLCollection; 30 import org.w3c.dom.html.HTMLElement; 31 import org.w3c.dom.html.HTMLTableCellElement; 32 import org.w3c.dom.html.HTMLTableElement; 33 import org.w3c.dom.html.HTMLTableSectionElement; 34 35 public class XHTMLTableRowElementImpl 36 extends XHTMLElementImpl 37 implements org.enhydra.xml.xhtml.dom.XHTMLTableRowElement 38 { 39 40 public XHTMLTableRowElementImpl (XHTMLDocumentBase owner, String namespaceURI, String tagName) { 41 super( owner, namespaceURI, tagName); 42 } 43 44 public void setId (String newValue) { 45 setAttribute("id", newValue); 46 } 47 48 public String getId () { 49 return getAttribute ("id"); 50 } 51 public void setLang (String newValue) { 52 setAttribute("lang", newValue); 53 } 54 55 public String getLang () { 56 return getAttribute ("lang"); 57 } 58 public void setDir (String newValue) { 59 setAttribute("dir", newValue); 60 } 61 62 public String getDir () { 63 return getAttribute ("dir"); 64 } 65 public void setClassName (String newValue) { 66 setAttribute("class", newValue); 67 } 68 69 public String getClassName () { 70 return getAttribute ("class"); 71 } 72 public void setTitle (String newValue) { 73 setAttribute("title", newValue); 74 } 75 76 public String getTitle () { 77 return getAttribute ("title"); 78 } 79 public void setAlign (String newValue) { 80 setAttribute("align", newValue); 81 } 82 83 public String getAlign () { 84 return getAttribute ("align"); 85 } 86 public void setBgColor (String newValue) { 87 setAttribute("bgcolor", newValue); 88 } 89 90 public String getBgColor () { 91 return getAttribute ("bgcolor"); 92 } 93 94 public void setVAlign (String newValue) { 95 setAttribute("valign", newValue); 96 } 97 98 public String getVAlign () { 99 return getAttribute ("valign"); 100 } 101 public void setOnKeyUp (String newValue) { 102 setAttribute("onkeyup", newValue); 103 } 104 105 public String getOnKeyUp () { 106 return getAttribute ("onkeyup"); 107 } 108 public void setStyle (String newValue) { 109 setAttribute("style", newValue); 110 } 111 112 public String getStyle () { 113 return getAttribute ("style"); 114 } 115 public void setOnMouseDown (String newValue) { 116 setAttribute("onmousedown", newValue); 117 } 118 119 public String getOnMouseDown () { 120 return getAttribute ("onmousedown"); 121 } 122 public void setOnKeyPress (String newValue) { 123 setAttribute("onkeypress", newValue); 124 } 125 126 public String getOnKeyPress () { 127 return getAttribute ("onkeypress"); 128 } 129 public void setOnDblClick (String newValue) { 130 setAttribute("ondblclick", newValue); 131 } 132 133 public String getOnDblClick () { 134 return getAttribute ("ondblclick"); 135 } 136 public void setOnKeyDown (String newValue) { 137 setAttribute("onkeydown", newValue); 138 } 139 140 public String getOnKeyDown () { 141 return getAttribute ("onkeydown"); 142 } 143 public void setOnMouseMove (String newValue) { 144 setAttribute("onmousemove", newValue); 145 } 146 147 public String getOnMouseMove () { 148 return getAttribute ("onmousemove"); 149 } 150 public void setOnMouseUp (String newValue) { 151 setAttribute("onmouseup", newValue); 152 } 153 154 public String getOnMouseUp () { 155 return getAttribute ("onmouseup"); 156 } 157 public void setXmlLang (String newValue) { 158 setAttribute("xml:lang", newValue); 159 } 160 161 public String getXmlLang () { 162 return getAttribute ("xml:lang"); 163 } 164 public void setOnMouseOut (String newValue) { 165 setAttribute("onmouseout", newValue); 166 } 167 168 public String getOnMouseOut () { 169 return getAttribute ("onmouseout"); 170 } 171 public void setOnClick (String newValue) { 172 setAttribute("onclick", newValue); 173 } 174 175 public String getOnClick () { 176 return getAttribute ("onclick"); 177 } 178 public void setOnMouseOver (String newValue) { 179 setAttribute("onmouseover", newValue); 180 } 181 182 public String getOnMouseOver () { 183 return getAttribute ("onmouseover"); 184 } 185 public void setChOff (String newValue) { 186 setAttribute("charoff", newValue); 187 } 188 189 public String getChOff () { 190 return getAttribute ("charoff"); 191 } 192 193 194 public int getRowIndex() { 195 Node parent; 196 197 parent = getParentNode(); 198 if ( parent instanceof HTMLTableSectionElement ) 199 parent = parent.getParentNode(); 200 if ( parent instanceof HTMLTableElement ) 201 return getRowIndex( parent );; 202 return -1; 203 } 204 205 206 public void setRowIndex( int rowIndex ) { 207 Node parent; 208 209 parent = getParentNode(); 210 if ( parent instanceof HTMLTableSectionElement ) 211 parent = parent.getParentNode(); 212 if ( parent instanceof HTMLTableElement ) 213 ((XHTMLTableElementImpl)parent).insertRowX( rowIndex, this ); 214 } 215 216 217 public int getSectionRowIndex() { 218 Node parent; 219 220 parent = getParentNode(); 221 if ( parent instanceof HTMLTableSectionElement ) 222 return getRowIndex( parent ); 223 else 224 return -1; 225 } 226 227 228 public void setSectionRowIndex( int sectionRowIndex ) { 229 Node parent; 230 231 parent = getParentNode(); 232 if ( parent instanceof HTMLTableSectionElement ) 233 ( (XHTMLTableSectionElementImpl) parent ).insertRowX( sectionRowIndex, this ); 234 } 235 236 237 int getRowIndex( Node parent ) { 238 NodeList rows; 239 int i; 240 241 rows = ( (HTMLElement) parent ).getElementsByTagName( "TR" ); 245 for ( i = 0 ; i < rows.getLength() ; ++i ) 246 if ( rows.item( i ) == this ) 247 return i; 248 return -1; 249 } 250 251 252 public HTMLCollection getCells() { 253 if ( _cells == null ) 254 _cells = new XHTMLCollectionImpl( this, XHTMLCollectionImpl.CELL ); 255 return _cells; 256 } 257 258 259 public void setCells( HTMLCollection cells ) { 260 Node child; 261 int i; 262 263 child = getFirstChild(); 264 while ( child != null ) 265 { 266 removeChild( child ); 267 child = child.getNextSibling(); 268 } 269 i = 0; 270 child = cells.item( i ); 271 while ( child != null ) 272 { 273 appendChild ( child ); 274 ++i; 275 child = cells.item( i ); 276 } 277 } 278 279 280 public HTMLElement insertCell( int index ) { 281 Node child; 282 HTMLElement newCell; 283 284 newCell = new XHTMLTableCellElementImpl( (XHTMLDocumentBase) getOwnerDocument(), getNamespaceURI(), "TD" ); 285 child = getFirstChild(); 286 while ( child != null ) 287 { 288 if ( child instanceof HTMLTableCellElement ) 289 { 290 if ( index == 0 ) 291 { 292 insertBefore( newCell, child ); 293 return newCell; 294 } 295 --index; 296 } 297 child = child.getNextSibling(); 298 } 299 appendChild( newCell ); 300 return newCell; 301 } 302 303 304 public void deleteCell( int index ) { 305 Node child; 306 307 child = getFirstChild(); 308 while ( child != null ) { 309 if ( child instanceof HTMLTableCellElement ) { 310 if ( index == 0 ) { 311 removeChild ( child ); 312 return; 313 } 314 --index; 315 } 316 child = child.getNextSibling(); 317 } 318 } 319 320 public String getCh() { 321 String ch; 322 323 ch = getAttribute( "char" ); 325 if ( ch != null && ch.length() > 1 ) 326 ch = ch.substring( 0, 1 ); 327 return ch; 328 } 329 330 331 public void setCh( String ch ) { 332 if ( ch != null && ch.length() > 1 ) 334 ch = ch.substring( 0, 1 ); 335 setAttribute( "char", ch ); 336 } 337 338 HTMLCollection _cells; 339 340 341 342 ; 343 } 344 345 346 | Popular Tags |