} else if (reverse) { for (int i = start - 1; i >= 0; i--) { if (isColumnInteractive(table.getColumn(i))) { return i; for (int i = table.getColumnCount() - 1; i >= start; i--) { if (isColumnInteractive(table.getColumn(i))) { return i; for (int i = start + 1; i < table.getColumnCount(); i++) { if (isColumnInteractive(table.getColumn(i))) { return i; if (isColumnInteractive(table.getColumn(i))) { return i;
protected void refreshColumnWidths() { int columnCount = getRealColumnCount(); for (int i = 0; i < columnCount; i++) { doSetColumnWidth(i, getColumnWidth(i)); } }
/** * {@inheritDoc} * * <p> * The layout behavior depends on whether or not the table is using fixed * layout. * </p> * * @see #setTableLayoutFixed(boolean) */ @Override public void setColumnWidth(Column<T, ?> column, double width, Unit unit) { // Overridden to add JavaDoc comments about fixed layout. super.setColumnWidth(column, width, unit); }
/** * Adds a column to the end of the table. * * @param col the column to be added */ public void addColumn(Column<T, ?> col) { insertColumn(getColumnCount(), col); }
/** * Update the width of all instances of the specified column. A column * instance may appear multiple times in the table. * * @param column the column to update * @param width the width of the column, or null to clear the width */ private void updateColumnWidthImpl(Column<T, ?> column, String width) { int columnCount = getColumnCount(); for (int i = 0; i < columnCount; i++) { if (columns.get(i) == column) { doSetColumnWidth(i, width); } } } }
TableSectionElement tbody = getTableBodyElement(); TableSectionElement tfoot = getTableFootElement(); TableSectionElement thead = getTableHeadElement(); TableSectionElement targetTableSection = null; TableCellElement targetTableCell = null; if (cellConsumesEventType(header.getCell(), eventType)) { header.onBrowserEvent(context, headerParent, event); int relRow = absRow - getPageStart(); int subrow = tableBuilder.getSubrowValueIndex(targetTableRow); if (hoveringRow != null && getTableBodyElement().isOrHasChild(hoveringRow)) { setRowHover(hoveringRow, event, false, isRowChange); setRowHover(hoveringRow, event, true, isRowChange); } else if (BrowserEvents.MOUSEOUT.equals(eventType) && hoveringRow != null) { boolean unhover = true; setRowHover(hoveringRow, event, false, isRowChange); hoveringRow = null; if (!isRowWithinBounds(relRow)) { return; || KeyboardSelectionPolicy.BOUND_TO_SELECTION == getKeyboardSelectionPolicy(); T value = getVisibleItem(relRow); Context context = new Context(absRow, col, getValueKey(value), subrow);
SelectionModel<? super T> selectionModel = cellTable.getSelectionModel(); boolean isSelected = (selectionModel == null || rowValue == null) ? false : selectionModel.isSelected(rowValue); RowStyles<T> rowStyles = cellTable.getRowStyles(); if (rowStyles != null) { String extraRowStyles = rowStyles.getStyleNames(rowValue, absRowIndex); int columnCount = cellTable.getColumnCount(); for (int curColumn = 0; curColumn < columnCount; curColumn++) { Column<T, ?> column = cellTable.getColumn(curColumn); Context context = new Context(absRowIndex, curColumn, cellTable.getValueKey(rowValue)); String cellStyles = column.getCellStyleNames(context, rowValue); if (cellStyles != null) {
int columnCount = table.getColumnCount(); if (columnCount == 0) { ColumnSortList sortList = table.getColumnSortList(); ColumnSortInfo sortedInfo = (sortList.size() == 0) ? null : sortList.get(0); Column<?, ?> sortedColumn = (sortedInfo == null) ? null : sortedInfo.getColumn(); Style style = getTable().getResources().style(); String className = isBuildingFooter() ? style.footer() : style.header(); String sortableStyle = " " + style.sortableHeader(); Column<T, ?> column = getTable().getColumn(0); int prevColspan = 1; boolean isSortable = false; column = table.getColumn(curColumn); if (!isFooter && column.isSortable()) { isSortable = true;
@Override protected void replaceAllChildren(List<T> values, SafeHtml html) { refreshHeadersAndColumnsImpl(); /* * If html is not null and legacyRenderRowValues is true, then the user * overrode renderRowValues() and rendered directly into a SafeHtmlBuilder. * The legacy method is deprecated but still supported. */ if (html == null || legacyRenderRowValues == false) { html = buildRowValues(values, getPageStart(), true); } TABLE_IMPL.replaceAllRows(this, getTableBodyElement(), CellBasedWidgetImpl.get().processHtml( html)); }
if (beforeIndex != getColumnCount()) { checkColumnBounds(beforeIndex); if (isColumnInteractive(col) && ((keyboardSelectedColumn >= columns.size()) || !isColumnInteractive(columns .get(keyboardSelectedColumn)))) { keyboardSelectedColumn = beforeIndex; refreshColumnsAndRedraw();
/** * Check that the specified column is within bounds. * * @param col the column index * @throws IndexOutOfBoundsException if the column is out of bounds */ private void checkColumnBounds(int col) { if (col < 0 || col >= getColumnCount()) { throw new IndexOutOfBoundsException("Column index is out of bounds: " + col); } }
/** * Click on a specific header of a cell table. * * @param table The targeted cell table * @param index The targeted cell header index in the table */ public static void clickHeader(AbstractCellTable<?> table, int index) { BrowserSimulatorImpl.get().fireLoopEnd(); table.getColumnSortList().push(table.getColumn(index)); ColumnSortEvent.fire(table, table.getColumnSortList()); BrowserSimulatorImpl.get().fireLoopEnd(); }
private void initTable(final AbstractCellTable<DynamicMenuItem> dynamicMenuTable) { dynamicMenuTable.setEmptyTableWidget(new Label(CommonConstants.INSTANCE.MenusNoMenuItems())); dynamicMenuTable.setSelectionModel(selectionModel, manager); dynamicMenuTable.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED); dynamicMenuTable.addColumn(iconColumn); dynamicMenuTable.setColumnWidth(iconColumn, "25px"); dynamicMenuTable.addColumn(iconColumn); dynamicMenuTable.setColumnWidth(iconColumn, "25px"); dynamicMenuTable.addColumn(activityCol, CommonConstants.INSTANCE.MenusActivityID()); dynamicMenuTable.addColumn(labelCol, CommonConstants.INSTANCE.MenusLabel()); dynamicMenuTable.addColumn(buttonCol); dynamicMenuTable.setColumnWidth(buttonCol, "80px");
public static int getDistributedColumnWidth( AbstractCellTable table, Column col ) { int width = getColumnWith( table, col ); if ( width <= 0 ) { width = table.getOffsetWidth(); int columnWidth = 0; int columns = table.getColumnCount(); for ( int i = 0; i < table.getColumnCount(); i++ ) { columnWidth = getColumnWith( table, i ); if ( columnWidth > 0 ) { columns--; width = width - columnWidth; } } width = width >= 0 ? width / ( columns != 0 ? columns : 1 ) : -1; } return width; }
public static int getColumnWith(AbstractCellTable table, int col) { return getColumnWith(table, table.getColumn(col)); }
@Override public void setEmptyTableWidget(Widget widget) { emptyTableWidgetContainer.setWidget(0, 0, widget); super.setEmptyTableWidget(widget); }
/** * Add a handler to handle {@link ColumnSortEvent}s. * * @param handler the {@link ColumnSortEvent.Handler} to add * @return a {@link HandlerRegistration} to remove the handler */ public HandlerRegistration addColumnSortHandler(ColumnSortEvent.Handler handler) { return addHandler(handler, ColumnSortEvent.getType()); }
public static int getColumnWith( AbstractCellTable table, Column col ) { String columnWidth = table.getColumnWidth( col ); return columnWidth != null && !"null".equals( columnWidth ) ? Integer.parseInt( columnWidth.substring( 0, columnWidth.length() - 2 ) ) : -1; }
/** * Get the column at the specified index. * * @param col the index of the column to retrieve * @return the {@link Column} at the index */ public Column<T, ?> getColumn(int col) { checkColumnBounds(col); return columns.get(col); }
if (!cellConsumesEventType(cell, eventType)) { return;