use of org.gwtproject.dom.client.Node in project gwtproject by treblereel.
the class DOMImplStandard method getChild.
@Override
public Element getChild(Element elem, int index) {
int count = 0;
Node child = elem.getFirstChild();
while (child != null) {
if (child.getNodeType() == 1) {
if (index == count) {
return (Element) child;
}
++count;
}
child = child.getNextSibling();
}
return null;
}
use of org.gwtproject.dom.client.Node in project gwtproject by treblereel.
the class DOMImplStandard method getChildIndex.
@Override
public int getChildIndex(Element parent, Element toFind) {
int count = 0;
Node child = parent.getFirstChild();
while (child != null) {
if (child == toFind) {
return count;
}
if (child.getNodeType() == 1) {
++count;
}
child = child.getNextSibling();
}
return -1;
}
use of org.gwtproject.dom.client.Node in project gwtproject by treblereel.
the class Grid method addRows.
/**
* Native method to add rows into a table with a given number of columns.
*
* @param table the table element
* @param rows number of rows to add
* @param columns the number of columns per row
*/
private static void addRows(Element table, int rows, int columns) {
TableCellElement td = Document.get().createTDElement();
td.setInnerHTML(" ");
TableRowElement row = Document.get().createTRElement();
for (int cellNum = 0; cellNum < columns; cellNum++) {
Node cell = td.cloneNode(true);
row.appendChild(cell);
}
table.appendChild(row);
for (int rowNum = 1; rowNum < rows; rowNum++) {
table.appendChild(row.cloneNode(true));
}
}
use of org.gwtproject.dom.client.Node in project gwtproject by treblereel.
the class DOMImplStandard method getChildCount.
@Override
public int getChildCount(Element elem) {
int count = 0;
Node child = elem.getFirstChild();
while (child != null) {
if (child.getNodeType() == 1) {
++count;
}
child = child.getNextSibling();
}
return count;
}
use of org.gwtproject.dom.client.Node in project gwtproject by treblereel.
the class UIObject method replaceNode.
private void replaceNode(Element node, Element newNode) {
Node p = node.getParentNode();
if (p == null) {
return;
}
p.insertBefore(newNode, node);
p.removeChild(node);
}
Aggregations