checkColumnIsAttached(); if (pixelWidth < 0) { throw new IllegalArgumentException(
/** * Sets the minimum width for this column. * <p> * This defines the minimum guaranteed pixel width of the column * <em>when it is set to expand</em>. * * @param pixels * the minimum width for the column * @throws IllegalStateException * if the column is no longer attached to any grid * @see #setExpandRatio(int) * @return the column itself */ public Column<T, V> setMinimumWidth(double pixels) throws IllegalStateException { checkColumnIsAttached(); final double maxwidth = getMaximumWidth(); if (pixels >= 0 && pixels > maxwidth && maxwidth >= 0) { throw new IllegalArgumentException("New minimum width (" + pixels + ") was greater than maximum width (" + maxwidth + ")"); } getState().minWidth = pixels; getGrid().markAsDirty(); return this; }
/** * Sets the maximum width for this column. * <p> * This defines the maximum allowed pixel width of the column <em>when * it is set to expand</em>. * * @param pixels * the maximum width * @throws IllegalStateException * if the column is no longer attached to any grid * @see #setExpandRatio(int) */ public Column<T, V> setMaximumWidth(double pixels) { checkColumnIsAttached(); final double minwidth = getMinimumWidth(); if (pixels >= 0 && pixels < minwidth && minwidth >= 0) { throw new IllegalArgumentException("New maximum width (" + pixels + ") was less than minimum width (" + minwidth + ")"); } getState().maxWidth = pixels; getGrid().markAsDirty(); return this; }
checkColumnIsAttached(); if (expandRatio != getExpandRatio()) { getState().expandRatio = expandRatio;
/** * Hides or shows the column. By default columns are visible before * explicitly hiding them. * * @since 7.5.0 * @param hidden * <code>true</code> to hide the column, <code>false</code> * to show * @return this column * @throws IllegalStateException * if the column is no longer attached to any grid */ public Column<T, V> setHidden(boolean hidden) { checkColumnIsAttached(); if (hidden != isHidden()) { getState().hidden = hidden; getGrid().fireColumnVisibilityChangeEvent(this, hidden, false); } return this; }
/** * Sets whether this column can be resized by the user. * * @since 7.6 * @param resizable * {@code true} if this column should be resizable, * {@code false} otherwise * @throws IllegalStateException * if the column is no longer attached to any grid */ public Column<T, V> setResizable(boolean resizable) { checkColumnIsAttached(); if (resizable != isResizable()) { getState().resizable = resizable; getGrid().markAsDirty(); } return this; }
/** * Marks the column width as undefined. An undefined width means the * grid is free to resize the column based on the cell contents and * available space in the grid. * * @return the column itself */ public Column<T, V> setWidthUndefined() { checkColumnIsAttached(); if (!isWidthUndefined()) { getState().width = -1; getGrid().markAsDirty(); getGrid().fireColumnResizeEvent(this, false); } return this; }
/** * 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 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; }