/** * Returns the current footer row height. -1 if row height is in automatic * calculation mode. * * @return footer row height * @since 8.2 */ public double getFooterRowHeight() { return getState(false).footerRowHeight; }
/** * Returns whether column reordering is allowed. Default value is * <code>false</code>. * * @return true if reordering is allowed */ public boolean isColumnReorderingAllowed() { return getState(false).columnReorderingAllowed; }
/** * Returns the current column resize mode. The default mode is * {@link ColumnResizeMode#ANIMATED}. * * @return a ColumnResizeMode value * @since 7.7.5 */ public ColumnResizeMode getColumnResizeMode() { return getState(false).columnResizeMode; }
/** * Sets the height of a body row. If -1 (default), the row height is * calculated based on the theme for an empty row before the Grid is * displayed. * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation * @since 8.2 */ public void setBodyRowHeight(double rowHeight) { getState().bodyRowHeight = rowHeight; }
/** * Returns the current body row height. -1 if row height is in automatic * calculation mode. * * @return body row height * @since 8.2 */ public double getBodyRowHeight() { return getState(false).bodyRowHeight; }
/** * Returns the current header row height. -1 if row height is in automatic * calculation mode. * * @return header row height * @since 8.2 */ public double getHeaderRowHeight() { return getState(false).headerRowHeight; }
/** * Sets the column resize mode to use. The default mode is * {@link ColumnResizeMode#ANIMATED}. * * @param mode * a ColumnResizeMode value * @since 7.7.5 */ public void setColumnResizeMode(ColumnResizeMode mode) { getState().columnResizeMode = mode; }
@Override protected GridState getState() { return getState(true); }
/** * Gets the amount of rows in Grid's body that are shown, while * {@link #getHeightMode()} is {@link HeightMode#ROW}. * * @return the amount of rows that are being shown in Grid's body * @see #setHeightByRows(double) */ public double getHeightByRows() { return getState(false).heightByRows; }
/** * Returns the current {@link HeightMode} the Grid is in. * <p> * Defaults to {@link HeightMode#CSS}. * * @return the current HeightMode */ public HeightMode getHeightMode() { return getState(false).heightMode; }
/** * Sets the height of a header row. If -1 (default), the row height is * calculated based on the theme for an empty row before the Grid is * displayed. * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation * @since 8.2 */ public void setHeaderRowHeight(double rowHeight) { getState().headerRowHeight = rowHeight; }
/** * Sets the height of a footer row. If -1 (default), the row height is * calculated based on the theme for an empty row before the Grid is * displayed. * * @param rowHeight * The height of a row in pixels or -1 for automatic calculation * @since 8.2 */ public void setFooterRowHeight(double rowHeight) { getState().footerRowHeight = rowHeight; }
@Override protected TreeGridState getState() { return (TreeGridState) super.getState(); }
@Override protected TreeGridState getState(boolean markAsDirty) { return (TreeGridState) super.getState(markAsDirty); }
/** * Gets the number of frozen columns in this grid. 0 means that no data * columns will be frozen, but the built-in selection checkbox column will * still be frozen if it's in use. -1 means that not even the selection * column is frozen. * <p> * <em>NOTE:</em> this count includes {@link Column#isHidden() hidden * columns} in the count. * * @see #setFrozenColumnCount(int) * * @return the number of frozen columns */ public int getFrozenColumnCount() { return getState(false).frozenColumnCount; }
/** * Gets an unmodifiable collection of all columns currently in this * {@link Grid}. * * @return unmodifiable collection of columns */ public List<Column<T, ?>> getColumns() { return Collections.unmodifiableList(getState(false).columnOrder.stream() .map(columnKeys::get).collect(Collectors.toList())); }
/** * {@inheritDoc} * <p> * <em>Note:</em> This method will set the height mode to be * {@link HeightMode#CSS}. * * @see #setHeightMode(HeightMode) */ @Override public void setHeight(float height, Unit unit) { getState().heightMode = HeightMode.CSS; super.setHeight(height, unit); }
/** * Sets whether or not column reordering is allowed. Default value is * <code>false</code>. * * @param columnReorderingAllowed * specifies whether column reordering is allowed */ public void setColumnReorderingAllowed(boolean columnReorderingAllowed) { if (isColumnReorderingAllowed() != columnReorderingAllowed) { getState().columnReorderingAllowed = columnReorderingAllowed; } }
private void setSortOrder(List<GridSortOrder<T>> order, boolean userOriginated) { Objects.requireNonNull(order, "Sort order list cannot be null"); // Update client state to display sort order. List<String> sortColumns = new ArrayList<>(); List<SortDirection> directions = new ArrayList<>(); order.stream().forEach(sortOrder -> { sortColumns.add(sortOrder.getSorted().getInternalId()); directions.add(sortOrder.getDirection()); }); getState().sortColumns = sortColumns.toArray(new String[0]); getState().sortDirs = directions.toArray(new SortDirection[0]); sortOrder.clear(); sortOrder.addAll(order); sort(userOriginated); }
private void addColumn(String identifier, Column<T, ?> column) { if (getColumns().contains(column)) { return; } column.extend(this); columnSet.add(column); columnKeys.put(identifier, column); column.setInternalId(identifier); addDataGenerator(column.getDataGenerator()); getState().columnOrder.add(identifier); getHeader().addColumn(identifier); getFooter().addColumn(identifier); if (getDefaultHeaderRow() != null) { getDefaultHeaderRow().getCell(column).setText(column.getCaption()); } column.updateSortable(); }