Interface HasRowActions<T>

Type Parameters:
T - the grid bean type
All Known Implementing Classes:
EasyGrid, EasyGridWrapper

Mixin interface that adds a configurable row-actions column to a Grid. Implemented by EasyGrid, it provides fluent default methods to register per-row actions (the addRowAction family), choose how they are presented (setRowActionsStyle(RowActionsStyle)), and set default theme variants (setDefaultRowActionVariants(ButtonVariant...)). Every method delegates to the backing RowActionsManager returned by getRowActionsManager().
Author:
Javier Godoy / Flowing Code
  • Method Details

    • getRowActionsManager

      RowActionsManager<T> getRowActionsManager()
      Returns the RowActionsManager that backs this grid's actions column. Every other method of this interface is a default method that delegates to it.
      Returns:
      the row actions manager, never null
    • addRowAction

      default EasyRowAction<T> addRowAction(@NonNull @NonNull String label, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds a label-only row action that invokes handler when clicked.
      Parameters:
      label - the button label
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default EasyRowAction<T> addRowAction(String label, Icon icon, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds a row action with a static label and icon that invokes handler when clicked. Either label or icon may be null, but not both.
      Parameters:
      label - the button label, or null for icon-only
      icon - the button icon, or null for label-only
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default EasyRowAction<T> addRowAction(@NonNull @NonNull Icon icon, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds an icon-only row action that invokes handler when clicked.
      Parameters:
      icon - the button icon
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default EasyRowAction<T> addRowAction(String label, @NonNull @NonNull IconFactory iconFactory, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds a row action with a static label and an icon created from iconFactory that invokes handler when clicked. label may be null for icon-only.
      Parameters:
      label - the button label, or null for icon-only
      iconFactory - factory used to create the button icon
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default EasyRowAction<T> addRowAction(@NonNull @NonNull IconFactory iconFactory, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds an icon-only row action whose icon is created from iconFactory that invokes handler when clicked.
      Parameters:
      iconFactory - factory used to create the button icon
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default <ICON extends AbstractIcon<ICON>> EasyRowAction<T> addRowAction(@NonNull @NonNull ValueProvider<T,ICON> iconProvider, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds an icon-only row action whose icon is computed per row from iconProvider that invokes handler when clicked.
      Type Parameters:
      ICON - the icon type
      Parameters:
      iconProvider - per-row provider for the button icon
      handler - the action to execute when clicked
      Returns:
      the registered action
    • addRowAction

      default <ICON extends AbstractIcon<ICON>> EasyRowAction<T> addRowAction(String label, ValueProvider<T,ICON> iconProvider, @NonNull @NonNull SerializableConsumer<T> handler)
      Adds a row action with a static label and a per-row icon that invokes handler when clicked. Either label or iconProvider may be null, but not both.
      Type Parameters:
      ICON - the icon type
      Parameters:
      label - the button label, or null for icon-only
      iconProvider - per-row provider for the button icon, or null for label-only
      handler - the action to execute when clicked
      Returns:
      the registered action
    • setRowActionsStyle

      default void setRowActionsStyle(@NonNull @NonNull RowActionsStyle style)
      Sets the style used to present row actions: inline buttons, a dropdown overflow menu, or a right-click context menu.
      Parameters:
      style - the row actions style
    • setRowActionsRenderer

      default void setRowActionsRenderer(RowActionsRenderer<T> renderer)
      Replaces the active row-actions renderer. The current renderer is cleaned up before the new one is installed, and a rebuild is scheduled for the next beforeClientResponse cycle.
      Parameters:
      renderer - the new renderer to use
    • getActionsColumn

      default Grid.Column<T> getActionsColumn()
      Returns the Grid.Column that hosts the actions, or null if the active renderer does not use a column (e.g. a context-menu renderer). For column-based renderers the column is created on demand, hidden when no actions are registered, and made visible automatically when the first action is added.
      Returns:
      the actions column, or null if the active renderer does not use a column
    • setDefaultRowActionVariants

      default void setDefaultRowActionVariants(ButtonVariant... variants)
      Sets the theme variants that will be applied upon creation to all row actions added after this call. Pass no arguments (or null) to clear the default variants.
      Parameters:
      variants - the variants to apply to each new action
    • refreshRowActions

      default void refreshRowActions()
      Schedules a renderer rebuild on the next beforeClientResponse cycle. The fluent configuration methods of EasyRowAction (visibleWhen, enabledWhen, tooltip, withConfirmation) schedule this automatically, so an explicit call is only needed after changing an action's styling or theme variants (e.g. addClassName, getStyle(), addThemeVariants), which are not applied automatically. Any previously scheduled rebuild is cancelled and replaced.