Example usage for com.google.gwt.dom.client TableElement getTBodies

List of usage examples for com.google.gwt.dom.client TableElement getTBodies

Introduction

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

Prototype

public NodeList<TableSectionElement> getTBodies() 

Source Link

Document

Returns a collection of the table bodies (including implicit ones).

Usage

From source file:com.vaadin.client.widget.grid.selection.MultiSelectionRenderer.java

License:Apache License

private TableSectionElement getTbodyElement() {
    TableElement table = getTableElement();
    if (table != null) {
        return table.getTBodies().getItem(0);
    } else {/*from   w  w  w  .  j  a  v a2 s .co m*/
        return null;
    }
}

From source file:com.xemantic.tadedon.gwt.user.client.ui.TablePanel.java

License:Apache License

public void addRow(IsWidget rowWidget) {
    if (!(rowWidget.asWidget().getElement().cast() instanceof TableRowElement)) {
        throw new IllegalArgumentException("rowWidget's root element must be instance of TableRowElement");
    }/*from w  ww .jav  a2 s.c o  m*/

    TableElement table = getElement().cast();
    NodeList<TableSectionElement> tBodies = table.getTBodies();
    if ((tBodies != null) && (tBodies.getLength() > 0)) {
        TableSectionElement tbody = tBodies.getItem(0);
        add(rowWidget.asWidget(), tbody);
    } else {
        add(rowWidget.asWidget(), getElement());
    }
}

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;/*from www .  j av a  2s  .  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;//  w  w w .j  a  v  a2 s. c  om
        } 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;
    }/*  w  ww  . j  a  va2s  .  c  o  m*/
    return logicalOffset;
}

From source file:sk.turn.gwtmvp.client.adapters.TableRowAdapter.java

License:Apache License

/**
 * Constructs a new instance setting the number of columns for each row and attaching it to a table element.
 * @param parentElement The table to attach the item-rows under. This constructor will take the first table 
 * section of the table, to further define the desired table section, use the other version of the constructor.
 * @param columns Number of columns each row will have, this number cannot be changed later.
 *///from  ww  w  .j  av a2s.com
public TableRowAdapter(TableElement parentElement, int columns) {
    this(parentElement.getTBodies().getItem(0), columns);
}