Search in sources :

Example 6 with TableElement

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

the class DataGridTest method testDataGridWidgetStyle.

/**
 * Test if the dataGridWidget style is applied.
 */
public void testDataGridWidgetStyle() {
    Resources res = new DataGrid_ResourcesImpl();
    DataGrid<String> dataGrid = new DataGrid<String>(20, res);
    String dataGridWidgetStyle = res.dataGridStyle().dataGridWidget();
    TableElement tableElem = dataGrid.getElement().cast();
    assertTrue(tableElem.getClassName().contains(dataGridWidgetStyle));
}
Also used : Resources(org.gwtproject.user.cellview.client.DataGrid.Resources) TableElement(org.gwtproject.dom.client.TableElement)

Example 7 with TableElement

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

the class DataGridTest method getHeaderElement.

@Override
protected TableCellElement getHeaderElement(DataGrid<String> table, int column) {
    TableElement tableElem = table.tableHeader.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 8 with TableElement

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

the class CellTableTest method getHeaderCount.

@Override
protected int getHeaderCount(CellTable<String> table) {
    TableElement tableElem = table.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)

Example 9 with TableElement

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

the class CellTableTest method testTableWidgetStyle.

/**
 * Test if the tableWidget style is applied.
 */
public void testTableWidgetStyle() {
    Resources res = new CellTable_ResourcesImpl();
    CellTable<String> table = new CellTable<String>(10, res);
    String tableWidgetStyle = res.cellTableStyle().cellTableWidget();
    TableElement tableElem = table.getElement().cast();
    assertTrue(tableElem.getClassName().contains(tableWidgetStyle));
}
Also used : Resources(org.gwtproject.user.cellview.client.CellTable.Resources) TableElement(org.gwtproject.dom.client.TableElement)

Example 10 with TableElement

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

the class GwtElementBuilderImplTestBase method testBuildTable.

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)

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