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 Summary
Modifier and TypeMethodDescriptionenabledWhen(SerializablePredicate<T> predicate) Sets a predicate that controls whether this action is enabled for a given row item.voidremove()Removes this action from the grid's actions column.tooltip(ValueProvider<T, String> tooltipProvider) Sets a dynamic tooltip for this action, computed from the row item.Sets a static tooltip for this action.visibleWhen(SerializablePredicate<T> predicate) Sets a predicate that controls whether this action is visible for a given row item.withConfirmation(String message) Configures a confirmation dialog with a message (no title) before the action is executed.withConfirmation(String title, String message) Configures a confirmation dialog with both a title and a message before the action is executed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, removeThemeVariants
-
Method Details
-
visibleWhen
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 returnstrue.- Returns:
- this action, for method chaining
-
enabledWhen
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 returnstrue.- Returns:
- this action, for method chaining
-
tooltip
Sets a static tooltip for this action.- Parameters:
tooltip- the tooltip text- Returns:
- this action, for method chaining
-
tooltip
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
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
Configures a confirmation dialog with both a title and a message before the action is executed.- Parameters:
title- the dialog titlemessage- 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 nextbeforeClientResponsecycle; if no actions remain the column is hidden. Callingremove()on an action that was never registered, or that has already been removed, is a no-op.
-