Interface HasRowActions<T>
- Type Parameters:
T- the grid bean type
- All Known Implementing Classes:
EasyGrid,EasyGridWrapper
@CssImport("./fc-dynamic-buttons.css")
@JsModule("./fc-icon.ts")
@Uses(com.vaadin.flow.component.button.Button.class) @Uses(com.vaadin.flow.component.confirmdialog.ConfirmDialog.class)
public interface HasRowActions<T>
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 Summary
Modifier and TypeMethodDescriptiondefault EasyRowAction<T>addRowAction(@NonNull IconFactory iconFactory, @NonNull SerializableConsumer<T> handler) Adds an icon-only row action whose icon is created fromiconFactorythat invokeshandlerwhen clicked.default EasyRowAction<T>addRowAction(@NonNull Icon icon, @NonNull SerializableConsumer<T> handler) Adds an icon-only row action that invokeshandlerwhen clicked.default <ICON extends AbstractIcon<ICON>>
EasyRowAction<T>addRowAction(@NonNull ValueProvider<T, ICON> iconProvider, @NonNull SerializableConsumer<T> handler) Adds an icon-only row action whose icon is computed per row fromiconProviderthat invokeshandlerwhen clicked.default EasyRowAction<T>addRowAction(@NonNull String label, @NonNull SerializableConsumer<T> handler) Adds a label-only row action that invokeshandlerwhen clicked.default EasyRowAction<T>addRowAction(String label, @NonNull IconFactory iconFactory, @NonNull SerializableConsumer<T> handler) Adds a row action with a static label and an icon created fromiconFactorythat invokeshandlerwhen clicked.default EasyRowAction<T>addRowAction(String label, Icon icon, @NonNull SerializableConsumer<T> handler) Adds a row action with a static label and icon that invokeshandlerwhen clicked.default <ICON extends AbstractIcon<ICON>>
EasyRowAction<T>addRowAction(String label, ValueProvider<T, ICON> iconProvider, @NonNull SerializableConsumer<T> handler) Adds a row action with a static label and a per-row icon that invokeshandlerwhen clicked.default Grid.Column<T>Returns theGrid.Columnthat hosts the actions, ornullif the active renderer does not use a column (e.g. a context-menu renderer).Returns theRowActionsManagerthat backs this grid's actions column.default voidSchedules a renderer rebuild on the nextbeforeClientResponsecycle.default voidsetDefaultRowActionVariants(ButtonVariant... variants) Sets the theme variants that will be applied upon creation to all row actions added after this call.default voidsetRowActionsRenderer(RowActionsRenderer<T> renderer) Replaces the active row-actions renderer.default voidsetRowActionsStyle(@NonNull RowActionsStyle style) Sets the style used to present row actions: inline buttons, a dropdown overflow menu, or a right-click context menu.
-
Method Details
-
getRowActionsManager
RowActionsManager<T> getRowActionsManager()Returns theRowActionsManagerthat backs this grid's actions column. Every other method of this interface is adefaultmethod 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 invokeshandlerwhen clicked.- Parameters:
label- the button labelhandler- 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 invokeshandlerwhen clicked. Eitherlabeloriconmay benull, but not both.- Parameters:
label- the button label, ornullfor icon-onlyicon- the button icon, ornullfor label-onlyhandler- 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 invokeshandlerwhen clicked.- Parameters:
icon- the button iconhandler- 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 fromiconFactorythat invokeshandlerwhen clicked.labelmay benullfor icon-only.- Parameters:
label- the button label, ornullfor icon-onlyiconFactory- factory used to create the button iconhandler- 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 fromiconFactorythat invokeshandlerwhen clicked.- Parameters:
iconFactory- factory used to create the button iconhandler- 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 fromiconProviderthat invokeshandlerwhen clicked.- Type Parameters:
ICON- the icon type- Parameters:
iconProvider- per-row provider for the button iconhandler- 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 invokeshandlerwhen clicked. EitherlabeloriconProvidermay benull, but not both.- Type Parameters:
ICON- the icon type- Parameters:
label- the button label, ornullfor icon-onlyiconProvider- per-row provider for the button icon, ornullfor label-onlyhandler- the action to execute when clicked- Returns:
- the registered action
-
setRowActionsStyle
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
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 nextbeforeClientResponsecycle.- Parameters:
renderer- the new renderer to use
-
getActionsColumn
Returns theGrid.Columnthat hosts the actions, ornullif 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
nullif the active renderer does not use a column
-
setDefaultRowActionVariants
Sets the theme variants that will be applied upon creation to all row actions added after this call. Pass no arguments (ornull) 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 nextbeforeClientResponsecycle. The fluent configuration methods ofEasyRowAction(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.
-