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.HTMLCollection; 28 import org.w3c.dom.html.HTMLElement; 29 import org.w3c.dom.html.HTMLTableRowElement; 30 import org.w3c.dom.html.HTMLTableSectionElement; 31 32 33 39 public final class HTMLTableSectionElementImpl extends HTMLElementImpl implements HTMLTableSectionElement { 40 41 42 public String getAlign() { 43 return capitalize( getAttribute( "align" ) ); 44 } 45 46 47 public void setAlign( String align ) { 48 setAttribute( "align", align ); 49 } 50 51 52 public String getCh() { 53 String ch; 54 55 ch = getAttribute( "char" ); 57 if (ch != null && ch.length() > 1) { 58 ch = ch.substring( 0, 1 ); 59 } 60 return ch; 61 } 62 63 64 public void setCh( String ch ) { 65 if (ch != null && ch.length() > 1) { 67 ch = ch.substring( 0, 1 ); 68 } 69 setAttribute( "char", ch ); 70 } 71 72 73 public String getChOff() { 74 return getAttribute( "charoff" ); 75 } 76 77 78 public void setChOff( String chOff ) { 79 setAttribute( "charoff", chOff ); 80 } 81 82 83 public String getVAlign() { 84 return capitalize( getAttribute( "valign" ) ); 85 } 86 87 88 public void setVAlign( String vAlign ) { 89 setAttribute( "valign", vAlign ); 90 } 91 92 93 public HTMLCollection getRows() { 94 if (_rows == null) { 95 _rows = new HTMLCollectionImpl( this, HTMLCollectionImpl.ROW ); 96 } 97 return _rows; 98 } 99 100 101 public HTMLElement insertRow( int index ) { 102 HTMLTableRowElementImpl newRow; 103 104 newRow = new HTMLTableRowElementImpl( (HTMLDocumentImpl)getOwnerDocument(), "TR" ); 105 newRow.insertCell( 0 ); 106 if (insertRowX( index, newRow ) >= 0) { 107 appendChild( newRow ); 108 } 109 return newRow; 110 } 111 112 113 int insertRowX( int index, HTMLTableRowElementImpl newRow ) { 114 Node child; 115 116 child = getFirstChild(); 117 while (child != null) { 118 if (child instanceof HTMLTableRowElement) { 119 if (index == 0) { 120 insertBefore( newRow, child ); 121 return -1; 122 } 123 --index; 124 } 125 child = child.getNextSibling(); 126 } 127 return index; 128 } 129 130 131 public void deleteRow( int index ) { 132 deleteRowX( index ); 133 } 134 135 136 int deleteRowX( int index ) { 137 Node child; 138 139 child = getFirstChild(); 140 while (child != null) { 141 if (child instanceof HTMLTableRowElement) { 142 if (index == 0) { 143 removeChild( child ); 144 return -1; 145 } 146 --index; 147 } 148 child = child.getNextSibling(); 149 } 150 return index; 151 } 152 153 154 159 public HTMLTableSectionElementImpl( HTMLDocumentImpl owner, String section ) { 160 super( owner, section ); 161 } 162 163 164 private HTMLCollectionImpl _rows; 165 166 167 } 168 | Popular Tags |