Class EditColumnConfigurator<T>

java.lang.Object
com.vaadin.flow.component.gridpro.EditColumnConfigurator<T>
Type Parameters:
T - the grid bean type
All Implemented Interfaces:
Serializable

public class EditColumnConfigurator<T> extends Object implements Serializable
Configuration for the editor of an edit column.
Author:
Vaadin Ltd.
See Also:
  • Method Details

    • getColumn

      public Grid.Column<T> getColumn()
      Gets the column.
      Returns:
      the configured column
    • text

      public Grid.Column<T> text(ItemUpdater<T,String> itemUpdater)
      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

      public <V> Grid.Column<T> custom(HasValueAndElement<?,V> component, ItemUpdater<T,V> itemUpdater)
      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 of HasValueAndElement
      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 of HasValueAndElement
      valueProvider - the value provider that is used to initialize the editor value
      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
    • checkbox

      public Grid.Column<T> checkbox(ItemUpdater<T,Boolean> itemUpdater)
      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

      public Grid.Column<T> select(ItemUpdater<T,String> itemUpdater, List<String> options)
      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 editor
      Returns:
      the configured column
    • select

      public Grid.Column<T> select(ItemUpdater<T,String> itemUpdater, String... options)
      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 editor
      Returns:
      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 type
      Parameters:
      itemUpdater - the callback function that is called when item is changed. It receives two arguments: item and newValue.
      enumType - the enum class
      getStringRepresentation - 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

      public <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. 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 type
      Parameters:
      itemUpdater - the callback function that is called when item is changed. It receives two arguments: item and newValue.
      enumType - the enum class
      Returns:
      the configured column
    • withManualRefresh

      public EditColumnConfigurator<T> 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