use of com.google.gwt.dom.client.TableCellElement in project kie-wb-common by kiegroup.
the class AbstractVerticalMergableGridWidget method deselectCell.
@Override
@SuppressWarnings({ "rawtypes" })
void deselectCell(CellValue<? extends Comparable<?>> cell) {
if (cell == null) {
throw new IllegalArgumentException("cell cannot be null");
}
Coordinate hc = cell.getHtmlCoordinate();
TableRowElement tre = tbody.getRows().getItem(hc.getRow()).<TableRowElement>cast();
TableCellElement tce = tre.getCells().getItem(hc.getCol()).<TableCellElement>cast();
// Merging, grouping etc could have led to the selected HTML cell disappearing
if (tce != null) {
String cellSelectedStyle = resources.cellTableCellSelected();
String cellMultipleValuesStyle = resources.cellTableCellMultipleValues();
String cellOtherwiseStyle = resources.cellTableCellOtherwise();
tce.removeClassName(cellSelectedStyle);
// Re-apply applicable styling
if (cell.isOtherwise()) {
tce.addClassName(cellOtherwiseStyle);
}
if (cell instanceof CellValue.GroupedCellValue) {
CellValue.GroupedCellValue gcv = (CellValue.GroupedCellValue) cell;
if (gcv.hasMultipleValues()) {
tce.addClassName(cellMultipleValuesStyle);
}
}
}
}
use of com.google.gwt.dom.client.TableCellElement in project kie-wb-common by kiegroup.
the class AbstractVerticalMergableGridWidget method showColumn.
@Override
void showColumn(int index) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be less than zero");
}
if (index > columns.size()) {
throw new IllegalArgumentException("index cannot be greater than the number of rows");
}
for (int iRow = 0; iRow < data.size(); iRow++) {
DynamicDataRow rowData = data.get(iRow);
TableCellElement tce = makeTableCellElement(index, rowData);
if (tce != null) {
CellValue<? extends Comparable<?>> cell = rowData.get(index);
Coordinate hc = cell.getHtmlCoordinate();
TableRowElement tre = tbody.getRows().getItem(hc.getRow());
TableCellElement ntce = tre.insertCell(hc.getCol());
tre.replaceChild(tce, ntce);
}
}
}
use of com.google.gwt.dom.client.TableCellElement in project kie-wb-common by kiegroup.
the class AbstractVerticalMergableGridWidget method hideColumn.
@Override
void hideColumn(int index) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be less than zero");
}
if (index > columns.size()) {
throw new IllegalArgumentException("index cannot be greater than the number of rows");
}
for (int iRow = 0; iRow < data.size(); iRow++) {
DynamicDataRow rowData = data.get(iRow);
CellValue<? extends Comparable<?>> cell = rowData.get(index);
if (cell.getRowSpan() > 0) {
Coordinate hc = cell.getHtmlCoordinate();
TableRowElement tre = tbody.getRows().getItem(hc.getRow());
TableCellElement tce = tre.getCells().getItem(hc.getCol());
tre.removeChild(tce);
}
}
}
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;
}
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);
}
Aggregations