Example usage for com.google.gwt.dom.client TableSectionElement setPropertyInt

List of usage examples for com.google.gwt.dom.client TableSectionElement setPropertyInt

Introduction

In this page you can find the example usage for com.google.gwt.dom.client TableSectionElement setPropertyInt.

Prototype

@Override
    public void setPropertyInt(String name, int value) 

Source Link

Usage

From source file:org.rstudio.core.client.widget.HeaderBreaksItemCodec.java

License:Open Source License

public void onRowsChanged(TableSectionElement tbody) {
    if (!hasNonValueRows())
        return;/* ww  w .  j  a va  2 s.  c  o  m*/

    TableRowElement lastRow = null;

    Node previousSibling = tbody.getPreviousSibling();
    if (previousSibling != null && previousSibling.getNodeType() == Node.ELEMENT_NODE
            && ((Element) previousSibling).getTagName().equalsIgnoreCase("tbody")) {
        TableSectionElement prevbody = (TableSectionElement) previousSibling;
        NodeList<TableRowElement> prevrows = prevbody.getRows();
        if (prevrows.getLength() > 0) {
            TableRowElement lastRowEl = prevrows.getItem(prevrows.getLength() - 1);
            if (isValueRow(lastRowEl)) {
                lastRow = lastRowEl;
            }
        }
    }

    int totalExtraRows = 0;
    final NodeList<TableRowElement> rows = tbody.getRows();
    for (int i = 0; i < rows.getLength(); i++) {
        TableRowElement row = rows.getItem(i);
        if (needsBreak(lastRow, row)) {
            int extraRows = addBreak(row);
            i += extraRows;
            totalExtraRows += extraRows;
        }

        lastRow = row;
    }

    tbody.setPropertyInt(EXTRA_ROWS, totalExtraRows);
}