Search in sources :

Example 1 with TableElement

use of org.gwtproject.dom.client.TableElement in project gwtproject by treblereel.

the class CellTableTest method getHeaderElement.

@Override
protected TableCellElement getHeaderElement(CellTable<String> table, int column) {
    TableElement tableElem = table.getElement().cast();
    TableSectionElement thead = tableElem.getTHead();
    TableRowElement tr = thead.getRows().getItem(0);
    return tr.getCells().getItem(column);
}
Also used : TableSectionElement(org.gwtproject.dom.client.TableSectionElement) TableRowElement(org.gwtproject.dom.client.TableRowElement) TableElement(org.gwtproject.dom.client.TableElement)

Example 2 with TableElement

use of org.gwtproject.dom.client.TableElement in project gwtproject by treblereel.

the class CellTableTest method getBodyElement.

@Override
protected TableCellElement getBodyElement(CellTable<String> table, int row, int column) {
    TableElement tableElem = table.getElement().cast();
    TableSectionElement tbody = tableElem.getTBodies().getItem(0);
    TableRowElement tr = tbody.getRows().getItem(row);
    return tr.getCells().getItem(column);
}
Also used : TableSectionElement(org.gwtproject.dom.client.TableSectionElement) TableRowElement(org.gwtproject.dom.client.TableRowElement) TableElement(org.gwtproject.dom.client.TableElement)

Example 3 with TableElement

use of org.gwtproject.dom.client.TableElement in project gwtproject by treblereel.

the class DataGridTest method getBodyElement.

@Override
protected TableCellElement getBodyElement(DataGrid<String> table, int row, int column) {
    TableElement tableElem = table.tableData.getElement().cast();
    TableSectionElement tbody = tableElem.getTBodies().getItem(0);
    TableRowElement tr = tbody.getRows().getItem(row);
    return tr.getCells().getItem(column);
}
Also used : TableSectionElement(org.gwtproject.dom.client.TableSectionElement) TableRowElement(org.gwtproject.dom.client.TableRowElement) TableElement(org.gwtproject.dom.client.TableElement)

Example 4 with TableElement

use of org.gwtproject.dom.client.TableElement in project gwtproject by treblereel.

the class J2clElementBuilderImplTestBase method testBuildTable.

@Test
public void testBuildTable() {
    // Build a table.
    TableBuilder tableBuilder = factory.createTableBuilder().id("mytable");
    TableSectionBuilder tbody = tableBuilder.startTBody();
    for (int r = 0; r < 5; r++) {
        TableRowBuilder tr = tbody.startTR().id("row" + r);
        for (int c = 0; c < 3; c++) {
            tr.startTD().text(r + ":" + c).endTD();
        }
        tr.endTR();
    }
    tbody.endTBody();
    tableBuilder.endTable();
    // Check the rendered element.
    TableElement table = tableBuilder.finish().cast();
    assertEquals(5, table.getRows().getLength());
    for (int r = 0; r < 5; r++) {
        TableRowElement tr = table.getRows().getItem(r);
        assertEquals(3, tr.getCells().getLength());
        for (int c = 0; c < 3; c++) {
            TableCellElement td = tr.getCells().getItem(c);
            assertEquals(r + ":" + c, td.getInnerText());
        }
    }
}
Also used : TableRowElement(org.gwtproject.dom.client.TableRowElement) TableElement(org.gwtproject.dom.client.TableElement) TableCellElement(org.gwtproject.dom.client.TableCellElement) Test(org.junit.Test)

Example 5 with TableElement

use of org.gwtproject.dom.client.TableElement in project gwtproject by treblereel.

the class DataGridTest method getHeaderCount.

@Override
protected int getHeaderCount(DataGrid<String> table) {
    TableElement tableElem = table.tableHeader.getElement().cast();
    TableSectionElement thead = tableElem.getTHead();
    if (thead.getRows().getLength() == 0) {
        return 0;
    }
    TableRowElement tr = thead.getRows().getItem(0);
    return tr.getCells().getLength();
}
Also used : TableSectionElement(org.gwtproject.dom.client.TableSectionElement) TableRowElement(org.gwtproject.dom.client.TableRowElement) TableElement(org.gwtproject.dom.client.TableElement)

Aggregations

TableElement (org.gwtproject.dom.client.TableElement)10 TableRowElement (org.gwtproject.dom.client.TableRowElement)8 TableSectionElement (org.gwtproject.dom.client.TableSectionElement)6 TableCellElement (org.gwtproject.dom.client.TableCellElement)2 Resources (org.gwtproject.user.cellview.client.CellTable.Resources)1 Resources (org.gwtproject.user.cellview.client.DataGrid.Resources)1 Test (org.junit.Test)1