diff --git a/FEATURE_ROW_ACTIONS.md b/FEATURE_ROW_ACTIONS.md index 658cb9d..b9de324 100644 --- a/FEATURE_ROW_ACTIONS.md +++ b/FEATURE_ROW_ACTIONS.md @@ -44,15 +44,6 @@ Adds an action button whose icon is resolved per row by calling `iconProvider` w --- -#### Removing row actions - -```java -void removeRowAction(EasyRowAction action); -``` -Removes the specified action from the actions column. Equivalent to calling `action.remove()`. - ---- - #### Rendering mode ```java @@ -71,6 +62,33 @@ Returns the `Grid.Column` backing the actions column, allowing the caller to --- +#### Default theme variants + +```java +void setDefaultRowActionVariants(ButtonVariant... variants); +``` +Sets the Vaadin `ButtonVariant`s applied by default to every action button created *after* this call; actions added earlier are unaffected. The built-in default is `LUMO_TERTIARY_INLINE`. Pass no arguments (or `null`) to clear the defaults. Individual actions can still add their own variants via `EasyRowAction.addThemeVariants(...)`. + +--- + +#### Custom renderer + +```java +void setRowActionsRenderer(RowActionsRenderer renderer); +``` +Replaces the strategy that turns the registered actions into UI. The built-in inline-button and context-menu renderers (selected via `setRowActionsAsMenu`) cover the common cases; supply a custom `RowActionsRenderer` to present actions another way. The previous renderer is cleaned up and a rebuild is scheduled. + +--- + +#### Refreshing after configuration changes + +```java +void refreshRowActions(); +``` +Schedules a rebuild of the actions column on the next server response. The fluent `EasyRowAction` methods (`visibleWhen`, `enabledWhen`, `tooltip`, `withConfirmation`) already trigger this automatically, so an explicit call is only needed after changing an action's attribute or property, which are not applied automatically. + +--- + ### `EasyRowAction` All mutator methods return `this` to support method chaining. @@ -117,12 +135,25 @@ Intercepts button clicks and presents a confirmation dialog before invoking the --- +#### Styling and theme variants + +`EasyRowAction` implements `HasStyle` and `HasThemeVariant`, so the action's button can be styled and themed directly: + +```java +action.addClassName("danger"); +action.getStyle().set("font-weight", "bold"); +action.addThemeVariants(ButtonVariant.LUMO_ERROR); +``` +These are forwarded onto the rendered button. Unlike the fluent mutators above, style and theme-variant changes made after the grid has already rendered are **not** applied automatically — call `easyGrid.refreshRowActions()` afterwards to make them visible. + +--- + #### Removal ```java void remove(); ``` -Removes this action from the actions column and triggers an immediate re-render so the change is visible without waiting for a data refresh. Equivalent to calling `easyGrid.removeRowAction(this)`. If the action has already been removed, this call is a no-op. After removal the `EasyRowAction` reference is considered dead and cannot be re-added; call `addRowAction` again to create a new action. +Removes this action from the actions column and triggers an immediate re-render so the change is visible without waiting for a data refresh. If the action has already been removed, this call is a no-op. After removal the `EasyRowAction` reference is considered dead and cannot be re-added; call `addRowAction` again to create a new action. --- @@ -163,10 +194,15 @@ easyGrid.addRowAction("Deactivate", VaadinIcon.CLOSE, person -> { // Removing an action EasyRowAction adminAction = easyGrid.addRowAction("Purge", VaadinIcon.TRASH, item -> purge(item)); // later: -easyGrid.removeRowAction(adminAction); -// or equivalently, if only the action reference is in scope: adminAction.remove(); +// Default theme variants applied to every action added afterwards +easyGrid.setDefaultRowActionVariants(ButtonVariant.LUMO_SMALL, ButtonVariant.LUMO_TERTIARY); + +// Style or theme an individual action's button +easyGrid.addRowAction("Reset", person -> reset(person)) + .addClassName("warning"); + // Configure the actions column via the underlying Grid.Column easyGrid.getActionsColumn() .setHeader("Actions")