Class EasyColumn<T,V>
java.lang.Object
com.flowingcode.vaadin.addons.easygrid.EasyColumn<T,V>
- Type Parameters:
T- the grid bean typeV- the column value type
- All Implemented Interfaces:
Serializable
Wraps a
Grid.Column and provides type-specific formatting for an EasyGridAddon-managed
column.- See Also:
-
Method Summary
Modifier and TypeMethodDescription<S> EasyColumn<T,S> Returns this column cast to value typeS, analogously toClass.asSubclass(java.lang.Class<U>).Returns the underlyingGrid.Column.default EasyColumn<T,V> setAutoWidth(boolean autoWidth) Sets whether this column's width is automatically determined from its content.default <C extends Comparable<? super C>>
EasyColumn<T,V> setComparator(ValueProvider<T, C> valueProvider) Sets a comparator to use for in-memory sorting for this column based on a value provider.default EasyColumn<T,V> setComparator(Comparator<T> comparator) Sets a comparator to use for in-memory sorting for this column.default EasyColumn<T,V> setEditorComponent(Component component) Sets the editor component for this column.default EasyColumn<T,V> setEditorComponent(SerializableFunction<T, ? extends Component> componentFunction) Sets a generator that provides the editor component for each row in this column.default EasyColumn<T,V> setFlexGrow(int flexGrow) Sets the flex grow ratio for this column.default EasyColumn<T,V> Sets a component footer for this column.default EasyColumn<T,V> Sets a text footer for this column.default EasyColumn<T,V> setFooterPartName(String footerPartName) Sets the part name for the footer cell of this column.EasyColumn<T,V> setFormatter(SerializableFunction<V, String> formatter) Sets a custom formatter that converts the column value to a display string.default EasyColumn<T,V> setFrozen(boolean frozen) Sets whether this column is frozen, locking it to the start of the grid.default EasyColumn<T,V> setFrozenToEnd(boolean frozenToEnd) Sets whether this column is frozen to the end of the grid.default EasyColumn<T,V> Sets a component header for this column.default EasyColumn<T,V> Sets a text header for this column.default EasyColumn<T,V> setHeaderPartName(String headerPartName) Sets the part name for the header cell of this column.default EasyColumn<T,V> Sets the key for this column, used to retrieve it viaGrid.getColumnByKey(String).EasyColumn<T,V> setNullRepresentation(String nullRepresentation) Sets the string to display when the column value isnull.default EasyColumn<T,V> setPartNameGenerator(SerializableFunction<T, String> partNameGenerator) Sets a generator that returns a part name for a given row item in this column.EasyColumn<T,V> setRendererFactory(RendererFactory<T, V> rendererFactory) Sets a custom renderer factory for this column.default EasyColumn<T,V> setResizable(boolean resizable) Sets whether this column is user-resizable.default EasyColumn<T,V> setRowHeader(boolean rowHeader) Sets whether this column represents a row header for accessibility purposes.default EasyColumn<T,V> setSortable(boolean sortable) Sets whether this column is user-sortable.default EasyColumn<T,V> setSortOrderProvider(SortOrderProvider provider) Sets the sort order provider for this column.default EasyColumn<T,V> setSortProperty(String... properties) Sets the backend properties used for sorting when this column is sorted.EasyColumn<T,V> setTextAlign(ColumnTextAlign textAlign) Sets the text alignment for this column's cells.default EasyColumn<T,V> setTooltipGenerator(SerializableFunction<T, String> tooltipGenerator) Sets a generator that produces a tooltip for a given row item in this column.default EasyColumn<T,V> setVisible(boolean visible) Sets whether this column is visible.default EasyColumn<T,V> Sets the width of this column as a CSS value.
-
Method Details
-
as
Returns this column cast to value typeS, analogously toClass.asSubclass(java.lang.Class<U>). Succeeds when the column's actual value type is a subtype ofS; throws otherwise.- Type Parameters:
S- the target value type- Parameters:
type- the target value type class- Returns:
- this column cast to
EasyColumn<T, S> - Throws:
ClassCastException- if the column's actual value type is not a subtype oftype
-
setNullRepresentation
Sets the string to display when the column value isnull. Overrides any null representation inherited from the type or global configuration. Updates the underlying configuration and re-applies the renderer.- Parameters:
nullRepresentation- the string to show fornullvalues- Returns:
- this column, for fluent chaining
-
setFormatter
Sets a custom formatter that converts the column value to a display string. Overrides any type-specific or formatter-based renderer inherited from the configuration chain.- Parameters:
formatter- a function mapping a column value to its display string- Returns:
- this column, for fluent chaining
-
setRendererFactory
Sets a custom renderer factory for this column. Overrides any type-specific or formatter-based renderer inherited from the configuration chain.- Parameters:
rendererFactory- a factory that creates a renderer from a value provider- Returns:
- this column, for fluent chaining
-
setTextAlign
Sets the text alignment for this column's cells. Updates both the underlyingGrid.Columnand theColumnConfiguration.- Parameters:
textAlign- the text alignment to apply- Returns:
- this column, for fluent chaining
-
getColumn
Grid.Column<T> getColumn()Returns the underlyingGrid.Column.- Returns:
- the underlying
Grid.Column
-
setAutoWidth
Sets whether this column's width is automatically determined from its content.- Parameters:
autoWidth-trueto enable auto-width,falseto use a fixed width- Returns:
- this column, for fluent chaining
-
setComparator
Sets a comparator to use for in-memory sorting for this column.- Parameters:
comparator- the comparator to use- Returns:
- this column, for fluent chaining
-
setComparator
default <C extends Comparable<? super C>> EasyColumn<T,V> setComparator(ValueProvider<T, C> valueProvider) Sets a comparator to use for in-memory sorting for this column based on a value provider.- Type Parameters:
C- the comparable value type- Parameters:
valueProvider- a value provider that extracts the comparable sort key from a row item- Returns:
- this column, for fluent chaining
-
setEditorComponent
Sets the editor component for this column.- Parameters:
component- the editor component- Returns:
- this column, for fluent chaining
-
setEditorComponent
default EasyColumn<T,V> setEditorComponent(SerializableFunction<T, ? extends Component> componentFunction) Sets a generator that provides the editor component for each row in this column.- Parameters:
componentFunction- a function that returns the editor component for a given row item- Returns:
- this column, for fluent chaining
-
setFlexGrow
Sets the flex grow ratio for this column.- Parameters:
flexGrow- the flex grow ratio- Returns:
- this column, for fluent chaining
-
setFrozen
Sets whether this column is frozen, locking it to the start of the grid.- Parameters:
frozen-trueto freeze this column,falseto unfreeze it- Returns:
- this column, for fluent chaining
-
setFrozenToEnd
Sets whether this column is frozen to the end of the grid.- Parameters:
frozenToEnd-trueto freeze this column to the end,falseto unfreeze it- Returns:
- this column, for fluent chaining
-
setHeader
Sets a text header for this column.- Parameters:
headerText- the header text- Returns:
- this column, for fluent chaining
-
setHeader
Sets a component header for this column.- Parameters:
headerComponent- the header component- Returns:
- this column, for fluent chaining
-
setHeaderPartName
Sets the part name for the header cell of this column.- Parameters:
headerPartName- the part name for the header cell- Returns:
- this column, for fluent chaining
-
setKey
Sets the key for this column, used to retrieve it viaGrid.getColumnByKey(String).- Parameters:
key- the column key- Returns:
- this column, for fluent chaining
-
setPartNameGenerator
Sets a generator that returns a part name for a given row item in this column.- Parameters:
partNameGenerator- a function that returns the part name for a given row item- Returns:
- this column, for fluent chaining
-
setResizable
Sets whether this column is user-resizable.- Parameters:
resizable-trueto make this column resizable,falseto prevent resizing- Returns:
- this column, for fluent chaining
-
setRowHeader
Sets whether this column represents a row header for accessibility purposes.- Parameters:
rowHeader-trueto mark this column as a row header,falseotherwise- Returns:
- this column, for fluent chaining
-
setSortable
Sets whether this column is user-sortable.- Parameters:
sortable-trueto make this column sortable,falseto disable sorting- Returns:
- this column, for fluent chaining
-
setSortOrderProvider
Sets the sort order provider for this column.- Parameters:
provider- the sort order provider- Returns:
- this column, for fluent chaining
-
setSortProperty
Sets the backend properties used for sorting when this column is sorted.- Parameters:
properties- the backend property names used for sorting- Returns:
- this column, for fluent chaining
-
setTooltipGenerator
Sets a generator that produces a tooltip for a given row item in this column.- Parameters:
tooltipGenerator- a function that returns the tooltip text for a given row item- Returns:
- this column, for fluent chaining
-
setVisible
Sets whether this column is visible.- Parameters:
visible-trueto show this column,falseto hide it- Returns:
- this column, for fluent chaining
-
setWidth
Sets the width of this column as a CSS value.- Parameters:
width- the column width as a CSS value- Returns:
- this column, for fluent chaining
-