public void deleteRow(int index) throws DOMException { synchronized (this.getTreeLock()) { org.xamjwg.util.ListSet nl = this.nodeList; int size = nl.size(); int trcount = 0; for (int i = 0; i < size; i++) { Node node = (Node) nl.get(i); if ("TR".equalsIgnoreCase(node.getNodeName())) { if (trcount == index) { this.removeChildAt(i); return; } trcount++; } } } throw new DOMException(DOMException.INDEX_SIZE_ERR, "Index out of range"); }
public HTMLElement insertRow(int index) throws DOMException { org.w3c.dom.Document doc = this.document; if (doc == null) { throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Orphan element"); } HTMLElement rowElement = (HTMLElement) doc.createElement("row"); synchronized (this.getTreeLock()) { org.xamjwg.util.ListSet nl = this.nodeList; int size = nl.size(); int trcount = 0; for (int i = 0; i < size; i++) { Node node = (Node) nl.get(i); if ("TR".equalsIgnoreCase(node.getNodeName())) { if (trcount == index) { this.insertAt(rowElement, i); return rowElement; } trcount++; } } } throw new DOMException(DOMException.INDEX_SIZE_ERR, "Index out of range"); }