com.vaadin.flow.component.gridpro.
Class EditColumnConfigurator<T>
Type Parameters:
T
- the grid bean type
All Implemented Interfaces:
Configuration for the editor of an edit column.
Author:
Vaadin Ltd.
See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncheckbox
(ItemUpdater<T, Boolean> itemUpdater) Configures the column to have a checkbox editor with the given item updater.
<V> Grid.Column<T>
custom
(HasValueAndElement<?, V> component, ItemUpdater<T, V> itemUpdater) Configures the column to have a custom editor component.
<V> Grid.Column<T>
custom
(HasValueAndElement<?, V> component, ValueProvider<T, V> valueProvider, ItemUpdater<T, V> itemUpdater) Configures the column to have a custom editor component, using a custom value provider.
Gets the column.
<E extends Enum<E>>
Grid.Column<T>select
(ItemUpdater<T, E> itemUpdater, Class<E> enumType) Configures the column to have a select editor with the given item updater, enum type using toString() as the string representation.
<E extends Enum<E>>
Grid.Column<T>select
(ItemUpdater<T, E> itemUpdater, Class<E> enumType, SerializableFunction<E, String> getStringRepresentation) Configures the column to have a select editor with the given item updater, enum type and string representation callback.
select
(ItemUpdater<T, String> itemUpdater, String... options) Configures the column to have a select editor with the given item updater and options.
Configures the column to have a select editor with the given item updater and options.
text
(ItemUpdater<T, String> itemUpdater) Configures the column to have a text editor with the given item updater.
withCellEditableProvider
(SerializablePredicate<T> cellEditableProvider) Configures a predicate that determines whether individual cells in this column are editable.
Configures the column to not refresh the item automatically when a property is updated.
-
Method Details
-
getColumn
Gets the column.
Returns:
the configured column
-
text
Configures the column to have a text editor with the given item updater.
Parameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item, newValue.Returns:
the configured column
-
custom
Configures the column to have a custom editor component.
When editing starts, the editor's value is initialized with the same presentation value that is used for the column. When committing the editor value, the item updater is called to update the edited item with the new value.
Parameters:
component
- the editor component, which must be an implementation ofHasValueAndElement
itemUpdater
- the callback function that is called when the editor value has changed. It receives the edited item, and the new value from the editor.Returns:
the configured column
-
custom
public <V> Grid.Column<T> custom(HasValueAndElement<?, V> component, ValueProvider<T, V> valueProvider, ItemUpdater<T, V> itemUpdater) Configures the column to have a custom editor component, using a custom value provider.
When editing starts, the editor's value is initialized using the custom value provider. When committing the editor value, the item updater is called to update the edited item with the new value.
Parameters:
component
- the editor component, which must be an implementation ofHasValueAndElement
valueProvider
- the value provider that is used to initialize the editor valueitemUpdater
- the callback function that is called when the editor value has changed. It receives the edited item, and the new value from the editor.Returns:
the configured column
-
checkbox
Configures the column to have a checkbox editor with the given item updater.
Parameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item, newValue.Returns:
the configured column
-
select
Configures the column to have a select editor with the given item updater and options.
Parameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item, newValue.options
- options provided for the select editorReturns:
the configured column
-
select
Configures the column to have a select editor with the given item updater and options.
Parameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item, newValue.options
- options provided for the select editorReturns:
the configured column
-
select
public <E extends Enum<E>> Grid.Column<T> select(ItemUpdater<T, E> itemUpdater, Class<E> enumType, SerializableFunction<E, String> getStringRepresentation) Configures the column to have a select editor with the given item updater, enum type and string representation callback. All constants from the given enum will be used, in their natural order. To exclude some constants or use a different order, build the list of options manually and use
select(ItemUpdater, String...)
.Type Parameters:
E
- the enum typeParameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item and newValue.enumType
- the enum classgetStringRepresentation
- callback used to get the string representation for each enum constant.Returns:
the configured column
Throws:
IllegalArgumentException
- if any of the enum constants have the same string representation -
select
Configures the column to have a select editor with the given item updater, enum type using toString() as the string representation. All constants from the given enum will be used, in their natural order. To exclude some constants or use a different order, build the list of options manually and use
select(ItemUpdater, String...)
.Type Parameters:
E
- the enum typeParameters:
itemUpdater
- the callback function that is called when item is changed. It receives two arguments: item and newValue.enumType
- the enum classReturns:
the configured column
-
withManualRefresh
Configures the column to not refresh the item automatically when a property is updated. The required update and refresh operations should be performed in the provided item updater manually.
Returns:
the configurator
-
withCellEditableProvider
public EditColumnConfigurator<T> withCellEditableProvider(SerializablePredicate<T> cellEditableProvider) Configures a predicate that determines whether individual cells in this column are editable. The predicate is called for each rendered item of the grid and should return a boolean indicating whether the cell is editable or not. By default, the provider is null, which means that all cells in the column are editable.
Parameters:
cellEditableProvider
- the cell editable provider
-