/** * Sets the identifier to use with this Column in communication. * * @param id * the identifier string */ private void setInternalId(String id) { Objects.requireNonNull(id, "Communication ID can't be null"); getState().internalId = id; }
private void updateSortable() { boolean inMemory = getGrid().getDataProvider().isInMemory(); boolean hasSortOrder = getSortOrder(SortDirection.ASCENDING) .count() != 0; getState().sortable = this.sortable && (inMemory || hasSortOrder); }
/** * Sets whether this column can be hidden by the user. Hidable columns * can be hidden and shown via the sidebar menu. * * @since 7.5.0 * @param hidable * <code>true</code> if the column may be hidable by the user * via UI interaction * @return this column */ public Column<T, V> setHidable(boolean hidable) { if (hidable != isHidable()) { getState().hidable = hidable; } return this; }
@Override protected ColumnState getState() { return getState(true); }
/** * Gets whether the width of the contents in the column should be * considered minimum width for this column. * * @return <code>true</code> to reserve space for all contents, * <code>false</code> to allow the column to shrink smaller than * the contents * @see #setMinimumWidthFromContent(boolean) * @since 8.1 */ public boolean isMinimumWidthFromContent() { return getState(false).minimumWidthFromContent; }
/** * Returns whether this column can be hidden by the user. Default is * {@code false}. * <p> * <em>Note:</em> the column can be programmatically hidden using * {@link #setHidden(boolean)} regardless of the returned value. * * @since 7.5.0 * @return <code>true</code> if the user can hide the column, * <code>false</code> if not */ public boolean isHidable() { return getState(false).hidable; }
/** * Gets whether Grid is handling the events in this Column from * Component and Widgets. * * @see #setHandleWidgetEvents(boolean) * * @return {@code true} if handling events; {@code false} if not * @since 8.3 */ public boolean isHandleWidgetEvents() { return getState(false).handleWidgetEvents; }
/** * Gets whether this Column has a component displayed in Editor or not. * * @return {@code true} if the column displays an editor component; * {@code false} if not */ public boolean isEditable() { return getState(false).editable; }
/** * Returns the maximum width for this column. * * @return the maximum width for this column * @see #setMaximumWidth(double) */ public double getMaximumWidth() { return getState(false).maxWidth; }
/** * Gets the header caption for this column. * * @return header caption * * @since 8.2 */ public String getAssistiveCaption() { return getState(false).assistiveCaption; }
/** * Gets whether the user can actually sort this column. * * @return {@code true} if the column can be sorted by the user; * {@code false} if not * * @since 8.3.2 */ public boolean isSortableByUser() { return getState(false).sortable; }
/** * Gets the caption of the hiding toggle for this column. * * @since 7.5.0 * @see #setHidingToggleCaption(String) * @return the caption for the hiding toggle for this column */ public String getHidingToggleCaption() { return getState(false).hidingToggleCaption; }
/** * Returns whether this column has an undefined width. * * @since 7.6 * @return whether the width is undefined * @throws IllegalStateException * if the column is no longer attached to any grid */ public boolean isWidthUndefined() { checkColumnIsAttached(); return getState(false).width < 0; }
/** * Returns whether this column is hidden. Default is {@code false}. * * @since 7.5.0 * @return <code>true</code> if the column is currently hidden, * <code>false</code> otherwise */ public boolean isHidden() { return getState(false).hidden; }
/** * Return the minimum width for this column. * * @return the minimum width for this column * @see #setMinimumWidth(double) */ public double getMinimumWidth() { return getState(false).minWidth; }
/** * Returns the width (in pixels). By default a column is 100px wide. * * @return the width in pixels of the column * @throws IllegalStateException * if the column is no longer attached to any grid */ public double getWidth() throws IllegalStateException { checkColumnIsAttached(); return getState(false).width; }
/** * Gets the header caption for this column. * * @return header caption */ public String getCaption() { return getState(false).caption; }
/** * Returns the column's expand ratio. * * @return the column's expand ratio * @see #setExpandRatio(int) */ public int getExpandRatio() { return getState(false).expandRatio; }
/** * Gets the Renderer for this Column. * * @return the renderer * @since 8.1 */ public Renderer<?> getRenderer() { return (Renderer<?>) getState().renderer; }
/** * Returns the identifier used with this Column in communication. * * @return the identifier string */ private String getInternalId() { return getState(false).internalId; }