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

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

Introduction

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

Prototype

@Override
    public int getPropertyInt(String name) 

Source Link

Usage

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

License:Open Source License

public Integer logicalOffsetToPhysicalOffset(TableElement table, int offset) {
    if (!hasNonValueRows())
        return offset;

    NodeList<TableSectionElement> bodies = table.getTBodies();
    int skew = 0;
    int pos = 0;/*w ww. ja va2s .  c  o  m*/
    for (int i = 0; i < bodies.getLength(); i++) {
        TableSectionElement body = bodies.getItem(i);
        NodeList<TableRowElement> rows = body.getRows();
        int rowCount = rows.getLength();
        int extraRows = body.getPropertyInt(EXTRA_ROWS);
        int max = (pos - skew) + (rowCount - extraRows);
        if (max <= offset) {
            // It's safe to skip this whole tbody. These are not the
            // rows we're looking for.
            pos += rowCount;
            skew += extraRows;
        } else {
            NodeList<TableRowElement> allRows = table.getRows();
            for (; pos < allRows.getLength(); pos++) {
                TableRowElement row = allRows.getItem(pos);
                if (!isValueRow(row))
                    skew++;
                else if (offset == (pos - skew))
                    return pos;
            }
        }
    }

    if (pos - skew == offset)
        return pos;
    else
        return null;
}

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

License:Open Source License

public Integer physicalOffsetToLogicalOffset(TableElement table, int offset) {
    if (!hasNonValueRows())
        return offset;

    if (offset >= table.getRows().getLength())
        return null;

    NodeList<TableSectionElement> bodies = table.getTBodies();
    int logicalOffset = 0;
    for (int i = 0; offset > 0 && i < bodies.getLength(); i++) {
        TableSectionElement body = bodies.getItem(i);
        NodeList<TableRowElement> rows = body.getRows();
        int rowCount = rows.getLength();
        int extraRows = body.getPropertyInt(EXTRA_ROWS);
        if (rowCount < offset) {
            logicalOffset += rowCount - extraRows;
            offset -= rowCount;/*from   w w  w.java  2  s  . com*/
        } else {
            // It's in here
            for (int j = 0; offset > 0 && j < rows.getLength(); j++) {
                offset--;
                if (isValueRow(rows.getItem(j)))
                    logicalOffset++;
            }
        }
    }

    return logicalOffset;
}

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

License:Open Source License

public int getLogicalRowCount(TableElement table) {
    if (!hasNonValueRows())
        return table.getRows().getLength();

    NodeList<TableSectionElement> bodies = table.getTBodies();
    int logicalOffset = 0;
    for (int i = 0; i < bodies.getLength(); i++) {
        TableSectionElement body = bodies.getItem(i);
        NodeList<TableRowElement> rows = body.getRows();
        int rowCount = rows.getLength();
        int extraRows = body.getPropertyInt(EXTRA_ROWS);
        logicalOffset += rowCount - extraRows;
    }/*from   ww  w . j  a va 2  s  .com*/
    return logicalOffset;
}