public void setData(@Nonnull final List<T> entries) { assert columnDefinitions != null; table.removeAllRows(); messageLabel.setVisible(false); table.setVisible(true); for (int i = 0; i < entries.size(); i++) { T entry = entries.get(i); for (int j = 0; j < columnDefinitions.size(); j++) { ColumnDefinition<T> columnDefinition = columnDefinitions.get(j); table.setText(i, j, columnDefinition.getContent(entry)); table.getCellFormatter().addStyleName(i, j, resources.css().selectableTableRow()); } } restoreRowSelection(); if (hotkeysEnabled) { focuser.setFocus(true); } }
new HTML(TestScenarioConstants.INSTANCE.ActualResult(fld.getActualResult()))); data.getCellFormatter().addStyleName(i, 5, "testErrorValue"); //NON-NLS
new HTML( TestScenarioConstants.INSTANCE.ActualResult( fld.getActualResult() ) ) ); data.getCellFormatter().addStyleName( i, 5, "testErrorValue" ); //NON-NLS
new HTML( TestScenarioConstants.INSTANCE.ActualResult( v.getActualResult().toString() ) ) ); data.getCellFormatter().addStyleName( i, 4, "testErrorValue" ); //NON-NLS
new HTML( TestScenarioConstants.INSTANCE.ActualResult(v.getActualResult().toString()) ) ); data.getCellFormatter().addStyleName( i, 4, "testErrorValue" ); //NON-NLS
aPanel.setWidget(1, 0, aGrid); aPanel.getCellFormatter() .addStyleName(0, 0, CSS.ewtTimePicker()); aPanel.getCellFormatter() .setHorizontalAlignment(0,
getCellFormatter().addStyleName(row, column, "selected-cell");
rCellFormatter.addStyleName(nRow, nCol, sStyle);
private void makeGrid() { grid.getCellFormatter().addStyleName(0, 0, "northwestCorner"); grid.setHTML(0, 0, ""); grid.getCellFormatter().addStyleName(0, 1, "horizontalLine"); grid.setHTML(0, 1, ""); grid.getCellFormatter().addStyleName(0, 2, "northeastCorner"); grid.setHTML(0, 2, ""); grid.getCellFormatter().addStyleName(1, 0, "verticalLine"); grid.setHTML(1, 0, ""); grid.setWidget(1, 1, widget); grid.getCellFormatter().addStyleName(1, 2, "verticalLine"); grid.setHTML(1, 2, ""); grid.getCellFormatter().addStyleName(2, 0, "southwestCorner"); grid.setHTML(2, 0, ""); grid.getCellFormatter().addStyleName(2, 1, "horizontalLine"); grid.setHTML(2, 1, ""); grid.getCellFormatter().addStyleName(2, 2, "smallButton"); grid.setHTML(2, 2, ""); }
private void updateTableStructure() { int columnCount = tableModel.getColumnCount(); for (int i = 0; i < columnCount; i++) { Column col = tableModel.getColumn(i); header.setWidget(0, i, col.getColumnTitleWidget()); } for (int i = 0; i < columnCount - 1; i++) { Column col = tableModel.getColumn(i); header.getColumnFormatter().setWidth(i, col.getWidth()); } for (int i = 0; i < columnCount; i++) { Column col = tableModel.getColumn(i); header.getCellFormatter().removeStyleName(0, i, selectionStyle.columnAscending()); header.getCellFormatter().removeStyleName(0, i, selectionStyle.columnDescending()); if (col.getSortDirection() == Column.Ascending) { header.getCellFormatter().addStyleName(0, i, selectionStyle.columnAscending()); } else if (col.getSortDirection() == Column.Descending) { header.getCellFormatter().addStyleName(0, i, selectionStyle.columnDescending()); } } }
private void processKeyUpAndDownEvent(TablePredicateFactory.Predicate tablePredicate) { int currentIndex = tableModel.getCurrentIndex(); Row currentRow = tableModel.getRow(currentIndex); if (currentIndex == 0 && tablePredicate.moveType() == TablePredicateFactory.MoveType.UP_LEFT) { tableModel.getRow(currentIndex).setHighlighted(false); tableModel.setCurrentIndex(-1); headerSelectedCellIndex = 0; changeFocus(FocusType.HEADER); header.getCellFormatter().addStyleName(0, 0, selectionStyle.selectedHeaderCell()); } else { if (currentRow.isHighlighted() && tablePredicate.indexCondition(currentIndex, tableModel.getRowCount())) { currentRow.setHighlighted(false); currentIndex = tablePredicate.nextIndex(currentIndex); tableModel.getRow(currentIndex).setHighlighted(true); tableModel.setCurrentIndex(currentIndex); scrollPanel.ensureVisible(table.getWidget(currentIndex, 0)); } } updateTableSelection(); }
/** * This method decorates the cell with styles. * * @param row is a row number. * @param column is a column number. * @param style is a style name. */ protected void decorateCell(int row, int column, String style) { HTMLTable.CellFormatter formatter = getGrid().getCellFormatter(); formatter.setStyleName(row, column, "data-cell"); formatter.addStyleName(row, column, style); if (getGrid().isReadOnly(column)) formatter.addStyleName(row, column, "readonly-cell"); else formatter.addStyleName(row, column, "editable-cell"); }
/*************************************** * Adds a style name to the cell in which the last component has been added * to this layout. * * @param rContainer The container to set the cell style in * @param sStyle The style name to add */ public void addCellStyle(Container rContainer, String sStyle) { FlexTable rTable = (FlexTable) rContainer.getWidget(); CellAddress rCell = getCell(rTable, false); rTable.getCellFormatter().addStyleName(rCell.nRow, rCell.nCol, sStyle); }
private void processKeyLeftRight(TablePredicateFactory.Predicate tablePredicate) { if (tablePredicate.indexCondition(headerSelectedCellIndex, tableModel.getColumnCount())) { header.getCellFormatter().removeStyleName(0, headerSelectedCellIndex, selectionStyle.selectedHeaderCell()); headerSelectedCellIndex = tablePredicate.nextIndex(headerSelectedCellIndex); header.getCellFormatter().addStyleName(0, headerSelectedCellIndex, selectionStyle.selectedHeaderCell()); } }
private void setCellText(int row, int cell, String fieldValue) { setText(row, cell, fieldValue); getCellFormatter().addStyleName(row, cell, STYLE_CELL); if (config.getStyleType() == MultiplicityConfiguration.StyleType.BORDERED_TABLE) { getCellFormatter().addStyleName(row, cell, STYLE_CELL_BORDER); } }
public void addHeaderCell(String fieldValue) { if (config.isShowHeaders()) { setCellText(row, col, fieldValue); getCellFormatter().addStyleName(row, col++, STYLE_HEADER_CELL); } }
/** {@inheritDoc} */ public void drawRow(Object[] data, int row) { if (row < 0) row = 0; EditableGrid grid = getGrid(); for (int i = 0; i < data.length; i++) { if (grid.isVisible(i)) { drawCell(data[i], row, i, false); grid.getCellFormatter().addStyleName(row, i, "grid-column"); } } }