Class EasyRowAction<T>

java.lang.Object
com.flowingcode.vaadin.addons.easygrid.actions.EasyRowAction<T>
Type Parameters:
T - the grid bean type
All Implemented Interfaces:
HasElement, HasStyle, HasTheme, HasThemeVariant<ButtonVariant>, Serializable

public final class EasyRowAction<T> extends Object implements Serializable, HasStyle, HasThemeVariant<ButtonVariant>
Represents a row action registered on an EasyGrid. Row actions are rendered either as inline buttons in a dedicated actions column or as items in a menu, depending on the grid's RowActionsStyle.

Use the fluent methods to configure conditional visibility, conditional enablement, tooltips, and optional confirmation dialogs before the action is executed. The rendered button can also be styled and themed through the inherited HasStyle and HasThemeVariant methods.

Author:
Javier Godoy / Flowing Code
See Also:
  • Method Details

    • visibleWhen

      public EasyRowAction<T> visibleWhen(SerializablePredicate<T> predicate)
      Sets a predicate that controls whether this action is visible for a given row item.
      Parameters:
      predicate - a predicate evaluated for each row item; the action is visible when it returns true.
      Returns:
      this action, for method chaining
    • enabledWhen

      public EasyRowAction<T> enabledWhen(SerializablePredicate<T> predicate)
      Sets a predicate that controls whether this action is enabled for a given row item.
      Parameters:
      predicate - a predicate evaluated for each row item; the action is enabled when it returns true.
      Returns:
      this action, for method chaining
    • tooltip

      public EasyRowAction<T> tooltip(String tooltip)
      Sets a static tooltip for this action.
      Parameters:
      tooltip - the tooltip text
      Returns:
      this action, for method chaining
    • tooltip

      public EasyRowAction<T> tooltip(ValueProvider<T,String> tooltipProvider)
      Sets a dynamic tooltip for this action, computed from the row item.
      Parameters:
      tooltipProvider - a function that returns the tooltip text for a given row item
      Returns:
      this action, for method chaining
    • withConfirmation

      public EasyRowAction<T> withConfirmation(String message)
      Configures a confirmation dialog with a message (no title) before the action is executed.
      Parameters:
      message - the confirmation message
      Returns:
      this action, for method chaining
    • withConfirmation

      public EasyRowAction<T> withConfirmation(String title, String message)
      Configures a confirmation dialog with both a title and a message before the action is executed.
      Parameters:
      title - the dialog title
      message - the confirmation message
      Returns:
      this action, for method chaining
    • remove

      public void remove()
      Removes this action from the grid's actions column. The column is re-rendered on the next beforeClientResponse cycle; if no actions remain the column is hidden. Calling remove() on an action that was never registered, or that has already been removed, is a no-op.