use of org.gwtproject.dom.client.TableCellElement 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());
}
use of org.gwtproject.dom.client.TableCellElement 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);
}
}
use of org.gwtproject.dom.client.TableCellElement in project gwtproject by treblereel.
the class AbstractCellTable method onFocus.
@Override
protected void onFocus() {
TableCellElement td = getKeyboardSelectedTableCellElement();
if (td != null) {
TableRowElement tr = td.getParentElement().cast();
td.addClassName(style.keyboardSelectedCell());
setRowStyleName(tr, style.keyboardSelectedRow(), style.keyboardSelectedRowCell(), true);
}
}
use of org.gwtproject.dom.client.TableCellElement in project gwtproject by treblereel.
the class Grid method addRows.
/**
* Native method to add rows into a table with a given number of columns.
*
* @param table the table element
* @param rows number of rows to add
* @param columns the number of columns per row
*/
private static void addRows(Element table, int rows, int columns) {
TableCellElement td = Document.get().createTDElement();
td.setInnerHTML(" ");
TableRowElement row = Document.get().createTRElement();
for (int cellNum = 0; cellNum < columns; cellNum++) {
Node cell = td.cloneNode(true);
row.appendChild(cell);
}
table.appendChild(row);
for (int rowNum = 1; rowNum < rows; rowNum++) {
table.appendChild(row.cloneNode(true));
}
}
use of org.gwtproject.dom.client.TableCellElement in project gwtproject by treblereel.
the class HTMLTable method addCells.
void addCells(Element tbody, int row, int num) {
Element rowElem = getRows(tbody).getAt(row);
for (int i = 0; i < num; i++) {
TableCellElement tdElement = Document.get().createTDElement();
rowElem.appendChild(tdElement);
}
}
Aggregations