Search in sources :

Example 1 with TableRowElement

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

the class AbstractCellTableTestBase method testSetHeaderBuilder.

public void testSetHeaderBuilder() {
    T table = createAbstractHasData();
    HeaderBuilder<String> headerBuilder = new AbstractHeaderOrFooterBuilder<String>(table, false) {

        @Override
        protected boolean buildHeaderOrFooterImpl() {
            TableRowBuilder tr = startRow();
            tr.startTH().text("Col 0").endTH();
            tr.startTH().text("Col 1").endTH();
            tr.startTH().text("Col 2").endTH();
            tr.endTR();
            return true;
        }
    };
    // Change the header builder.
    table.setHeaderBuilder(headerBuilder);
    assertEquals(headerBuilder, table.getHeaderBuilder());
    table.getPresenter().flush();
    // Verify the new header.
    NodeList<TableRowElement> rows = table.getTableHeadElement().getRows();
    assertEquals(1, rows.getLength());
    NodeList<TableCellElement> cells = rows.getItem(0).getCells();
    assertEquals(3, cells.getLength());
    assertEquals("Col 0", cells.getItem(0).getInnerText());
    assertEquals("Col 1", cells.getItem(1).getInnerText());
    assertEquals("Col 2", cells.getItem(2).getInnerText());
}
Also used : TableRowElement(org.gwtproject.dom.client.TableRowElement) TableRowBuilder(org.gwtproject.dom.builder.shared.TableRowBuilder) TableCellElement(org.gwtproject.dom.client.TableCellElement)

Example 2 with TableRowElement

use of org.gwtproject.dom.client.TableRowElement 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 3 with TableRowElement

use of org.gwtproject.dom.client.TableRowElement 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 4 with TableRowElement

use of org.gwtproject.dom.client.TableRowElement 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 5 with TableRowElement

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

the class AbstractCellTable method onBlur.

@Override
protected void onBlur() {
    TableCellElement td = getKeyboardSelectedTableCellElement();
    if (td != null) {
        TableRowElement tr = td.getParentElement().cast();
        td.removeClassName(style.keyboardSelectedCell());
        setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), false);
    }
}
Also used : TableRowElement(org.gwtproject.dom.client.TableRowElement) TableCellElement(org.gwtproject.dom.client.TableCellElement)

Aggregations

TableRowElement (org.gwtproject.dom.client.TableRowElement)17 TableElement (org.gwtproject.dom.client.TableElement)10 TableCellElement (org.gwtproject.dom.client.TableCellElement)9 TableSectionElement (org.gwtproject.dom.client.TableSectionElement)8 TableRowBuilder (org.gwtproject.dom.builder.shared.TableRowBuilder)2 Element (org.gwtproject.dom.client.Element)2 Context (org.gwtproject.cell.client.Cell.Context)1 HasCell (org.gwtproject.cell.client.HasCell)1 Scheduler (org.gwtproject.core.client.Scheduler)1 EventTarget (org.gwtproject.dom.client.EventTarget)1 Node (org.gwtproject.dom.client.Node)1 CellPreviewEvent (org.gwtproject.view.client.CellPreviewEvent)1 Test (org.junit.Test)1