1 20 21 22 package org.ozoneDB.xml.dom.html; 23 24 25 import org.ozoneDB.xml.dom.ElementImpl; 26 import org.w3c.dom.Node ; 27 import org.w3c.dom.html.HTMLTableCellElement; 28 import org.w3c.dom.html.HTMLTableRowElement; 29 30 31 37 public final class HTMLTableCellElementImpl extends HTMLElementImpl implements HTMLTableCellElement { 38 39 40 public int getCellIndex() { 41 Node parent; 42 Node child; 43 int index; 44 45 parent = getParentNode(); 46 index = 0; 47 if (parent instanceof HTMLTableRowElement) { 48 child = parent.getFirstChild(); 49 while (child != null) { 50 if (child instanceof HTMLTableCellElement) { 51 if (child == this) { 52 return index; 53 } 54 ++index; 55 } 56 child = child.getNextSibling(); 57 } 58 } 59 return -1; 60 } 61 62 63 public void setCellIndex( int cellIndex ) { 64 Node parent; 65 Node child; 66 67 parent = getParentNode(); 68 if (parent instanceof HTMLTableRowElement) { 69 child = parent.getFirstChild(); 70 while (child != null) { 71 if (child instanceof HTMLTableCellElement) { 72 if (cellIndex == 0) { 73 if (this != child) { 74 parent.insertBefore( this, child ); 75 } 76 return; 77 } 78 --cellIndex; 79 } 80 child = child.getNextSibling(); 81 } 82 } 83 parent.appendChild( this ); 84 } 85 86 87 public String getAbbr() { 88 return getAttribute( "abbr" ); 89 } 90 91 92 public void setAbbr( String abbr ) { 93 setAttribute( "abbr", abbr ); 94 } 95 96 97 public String getAlign() { 98 return capitalize( getAttribute( "align" ) ); 99 } 100 101 102 public void setAlign( String align ) { 103 setAttribute( "align", align ); 104 } 105 106 107 public String getAxis() { 108 return getAttribute( "axis" ); 109 } 110 111 112 public void setAxis( String axis ) { 113 setAttribute( "axis", axis ); 114 } 115 116 117 public String getBgColor() { 118 return getAttribute( "bgcolor" ); 119 } 120 121 122 public void setBgColor( String bgColor ) { 123 setAttribute( "bgcolor", bgColor ); 124 } 125 126 127 public String getCh() { 128 String ch; 129 130 ch = getAttribute( "char" ); 132 if (ch != null && ch.length() > 1) { 133 ch = ch.substring( 0, 1 ); 134 } 135 return ch; 136 } 137 138 139 public void setCh( String ch ) { 140 if (ch != null && ch.length() > 1) { 142 ch = ch.substring( 0, 1 ); 143 } 144 setAttribute( "char", ch ); 145 } 146 147 148 public String getChOff() { 149 return getAttribute( "charoff" ); 150 } 151 152 153 public void setChOff( String chOff ) { 154 setAttribute( "charoff", chOff ); 155 } 156 157 158 public int getColSpan() { 159 return toInteger( getAttribute( "colspan" ) ); 160 } 161 162 163 public void setColSpan( int colspan ) { 164 setAttribute( "colspan", String.valueOf( colspan ) ); 165 } 166 167 168 public String getHeaders() { 169 return getAttribute( "headers" ); 170 } 171 172 173 public void setHeaders( String headers ) { 174 setAttribute( "headers", headers ); 175 } 176 177 178 public String getHeight() { 179 return getAttribute( "height" ); 180 } 181 182 183 public void setHeight( String height ) { 184 setAttribute( "height", height ); 185 } 186 187 188 public boolean getNoWrap() { 189 return getAttribute( "nowrap" ) != null; 190 } 191 192 193 public void setNoWrap( boolean noWrap ) { 194 setAttribute( "nowrap", noWrap ? "" : null ); 195 } 196 197 198 public int getRowSpan() { 199 return toInteger( getAttribute( "rowspan" ) ); 200 } 201 202 203 public void setRowSpan( int rowspan ) { 204 setAttribute( "rowspan", String.valueOf( rowspan ) ); 205 } 206 207 208 public String getScope() { 209 return getAttribute( "scope" ); 210 } 211 212 213 public void setScope( String scope ) { 214 setAttribute( "scope", scope ); 215 } 216 217 218 public String getVAlign() { 219 return capitalize( getAttribute( "valign" ) ); 220 } 221 222 223 public void setVAlign( String vAlign ) { 224 setAttribute( "valign", vAlign ); 225 } 226 227 228 public String getWidth() { 229 return getAttribute( "width" ); 230 } 231 232 233 public void setWidth( String width ) { 234 setAttribute( "width", width ); 235 } 236 237 238 243 public HTMLTableCellElementImpl( HTMLDocumentImpl owner, String name ) { 244 super( owner, "TD" ); 245 } 246 247 248 } 249 | Popular Tags |