public int getCellIndex() { Node parent; Node child; int index; parent = getParentNode(); index = 0; if ( parent instanceof HTMLTableRowElement ) { child = parent.getFirstChild(); while ( child != null ) { if ( child instanceof HTMLTableCellElement ) { if ( child == this ) return index; ++ index; } child = child.getNextSibling(); } } return -1; }
public void setCellIndex( int cellIndex ) { Node parent; Node child; parent = getParentNode(); if ( parent instanceof HTMLTableRowElement ) { child = parent.getFirstChild(); while ( child != null ) { if ( child instanceof HTMLTableCellElement ) { if ( cellIndex == 0 ) { if ( this != child ) parent.insertBefore( this, child ); return; } -- cellIndex; } child = child.getNextSibling(); } } parent.appendChild( this ); }
public HTMLElement insertCell( int index ) { Node child; HTMLElement newCell; newCell = new HTMLTableCellElementImpl( (HTMLDocumentImpl) getOwnerDocument(), "TD" ); child = getFirstChild(); while ( child != null ) { if ( child instanceof HTMLTableCellElement ) { if ( index == 0 ) { insertBefore( newCell, child ); return newCell; } --index; } child = child.getNextSibling(); } appendChild( newCell ); return newCell; }
public void deleteCell( int index ) { Node child; child = getFirstChild(); while ( child != null ) { if ( child instanceof HTMLTableCellElement ) { if ( index == 0 ) { removeChild ( child ); return; } --index; } child = child.getNextSibling(); } }
private Element nodeToHTML(PlanDiffBadgedNode node) { Element table = document.createElement("TABLE"); table.setAttribute("style", "display:inline; vertical-align:middle; width:100%"); Element tableRow = document.createElement("TR"); HTMLTableCellElement description = (HTMLTableCellElement) document.createElement("TD"); table.appendChild(tableRow); tableRow.appendChild(description); Element icon = emptyElement("SPAN", node.getCSSclassForIcon()); Element badge = emptyElement("SPAN", "badge difftype-" + node.getCSSclassForBadge()); Element name = element("SPAN", node.getName(), node.getCSSclass() + " name"); if (node.getDiffType()==DiffType.ADD) table.setAttribute("class", "added"); else if (node.getDiffType()==DiffType.REMOVE) table.setAttribute("class", "deleted"); else if (node.getDiffType()==DiffType.MODIFY) table.setAttribute("class", "modified"); else if (node.getDiffType()==DiffType.MOVE_IN) table.setAttribute("class", "moved elsewhere"); else if (node.getDiffType()==DiffType.MOVE_OUT) table.setAttribute("class", "moved here"); if (node instanceof PlanDiffObjectNode) iconGetsActivityColor(icon, ((PlanDiffObjectNode) node).getObject()); description.appendChild(icon); description.appendChild(badge); description.appendChild(name); if (node instanceof PlanDiffObjectNode) { HTMLTableCellElement startTime = (HTMLTableCellElement) document.createElement("TD"); tableRow.appendChild(startTime); appendObjectInfo(((PlanDiffObjectNode) node), description, startTime); } return table; }
TableCell( WebResponse response, FrameSelector frame, HTMLTableCellElement element, URL url, String parentTarget, String characterSet ) { super( response, frame, url, parentTarget, element, characterSet ); _element = element; }
TableCell newTableCell( HTMLTableCellElement element ) { return new TableCell( _response, _frameName, element, _url, _baseTarget, _characterSet ); }
TableCell newTableCell( HTMLTableCellElement element ) { return _webTable.newTableCell( element ); }