Search in sources :

Example 6 with TableCellElement

use of com.google.gwt.dom.client.TableCellElement in project drools-wb by kiegroup.

the class TemplateDataHeaderWidget method resizeColumn.

// Resize the inner DIV in each table cell
protected void resizeColumn(DynamicColumn<TemplateDataColumn> resizeColumn, int resizeColumnWidth) {
    DivElement div;
    TableCellElement tce;
    // This is also set in the ColumnResizeEvent handler, however it makes
    // resizing columns in the header more simple too
    resizeColumn.setWidth(resizeColumnWidth);
    int resizeColumnIndex = widget.headerColumns.indexOf(resizeColumn);
    // Row 0 (General\Fact Type)
    tce = widget.headerRows[0].getChild(resizeColumnIndex).<TableCellElement>cast();
    div = tce.getFirstChild().<DivElement>cast();
    div.getStyle().setWidth(resizeColumnWidth, Unit.PX);
    // Row 1 (Sorters)
    tce = widget.headerRows[1].getChild(resizeColumnIndex).<TableCellElement>cast();
    div = tce.getFirstChild().<DivElement>cast();
    div.getStyle().setWidth(resizeColumnWidth, Unit.PX);
    // Fire event to any interested consumers
    ColumnResizeEvent cre = new ColumnResizeEvent(widget.headerColumns.get(resizeColumnIndex), resizeColumnWidth);
    eventBus.fireEvent(cre);
}
Also used : DivElement(com.google.gwt.dom.client.DivElement) ColumnResizeEvent(org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.ColumnResizeEvent) TableCellElement(com.google.gwt.dom.client.TableCellElement)

Example 7 with TableCellElement

use of com.google.gwt.dom.client.TableCellElement in project gwt-test-utils by gwt-test-utils.

the class GridPatcher method createRow.

private static TableRowElement createRow(int columns, String cellContent) {
    TableRowElement tr = Document.get().createTRElement();
    for (int i = 0; i < columns; i++) {
        TableCellElement cell = Document.get().createTDElement();
        cell.setInnerHTML(cellContent);
        tr.appendChild(cell);
    }
    return tr;
}
Also used : TableRowElement(com.google.gwt.dom.client.TableRowElement) TableCellElement(com.google.gwt.dom.client.TableCellElement)

Example 8 with TableCellElement

use of com.google.gwt.dom.client.TableCellElement in project gwt-test-utils by gwt-test-utils.

the class TableRowElementTest method deleteCell.

@Test
public void deleteCell() {
    // Given
    TableCellElement td0 = Document.get().createTDElement();
    tr.appendChild(td0);
    TableCellElement td1 = Document.get().createTDElement();
    tr.appendChild(td1);
    // When
    tr.deleteCell(0);
    // Then
    assertThat(tr.getChildCount()).isEqualTo(1);
    assertThat(tr.getChild(0)).isEqualTo(td1);
}
Also used : TableCellElement(com.google.gwt.dom.client.TableCellElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 9 with TableCellElement

use of com.google.gwt.dom.client.TableCellElement in project gwt-test-utils by gwt-test-utils.

the class TableRowElementTest method insertCell.

@Test
public void insertCell() {
    // Given
    TableCellElement td0 = Document.get().createTDElement();
    tr.appendChild(td0);
    TableCellElement td1 = Document.get().createTDElement();
    tr.appendChild(td1);
    // When
    TableCellElement insert = tr.insertCell(1);
    // Then
    assertThat(tr.getChildCount()).isEqualTo(3);
    assertThat(tr.getChild(0)).isEqualTo(td0);
    assertThat(tr.getChild(1)).isEqualTo(insert);
    assertThat(tr.getChild(2)).isEqualTo(td1);
}
Also used : TableCellElement(com.google.gwt.dom.client.TableCellElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 10 with TableCellElement

use of com.google.gwt.dom.client.TableCellElement in project rstudio by rstudio.

the class FindOutputCodec method addBreak.

@Override
protected int addBreak(TableRowElement row) {
    TableRowElement tr = Document.get().createTRElement();
    tr.setClassName(styles_.headerRow());
    TableCellElement td = Document.get().createTDElement();
    td.setColSpan(2);
    td.setInnerText(row.getAttribute(DATA_FILE));
    tr.appendChild(td);
    row.getParentElement().insertBefore(tr, row);
    return 1;
}
Also used : TableRowElement(com.google.gwt.dom.client.TableRowElement) TableCellElement(com.google.gwt.dom.client.TableCellElement)

Aggregations

TableCellElement (com.google.gwt.dom.client.TableCellElement)10 TableRowElement (com.google.gwt.dom.client.TableRowElement)6 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)2 Test (org.junit.Test)2 DivElement (com.google.gwt.dom.client.DivElement)1 Element (com.google.gwt.dom.client.Element)1 EventTarget (com.google.gwt.dom.client.EventTarget)1 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 TableElement (com.google.gwt.dom.client.TableElement)1 TableSectionElement (com.google.gwt.dom.client.TableSectionElement)1 ColumnResizeEvent (org.kie.workbench.common.widgets.decoratedgrid.client.widget.events.ColumnResizeEvent)1