From dced2af6931c933c7832cdbc8bae50571efe2cd7 Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:16:17 -0300 Subject: [PATCH 1/2] WIP: spec: add RowActionsStyle enum to replace setRowActionsAsMenu() --- FEATURE_ROW_ACTIONS.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/FEATURE_ROW_ACTIONS.md b/FEATURE_ROW_ACTIONS.md index b9de324..45e4bdc 100644 --- a/FEATURE_ROW_ACTIONS.md +++ b/FEATURE_ROW_ACTIONS.md @@ -1,6 +1,6 @@ # Feature: Row Actions -Row actions are buttons or menu items displayed in a dedicated actions column, created and managed by `EasyGrid` on the wrapped grid. +Row actions are buttons or menu items presented by `EasyGrid` on the wrapped grid — as inline buttons, an overflow menu, or the grid's right-click context menu. ## API @@ -8,7 +8,7 @@ Row actions are buttons or menu items displayed in a dedicated actions column, c #### Adding row actions -All `addRowAction` overloads append a new action to the actions column and return an `EasyRowAction` that can be further configured via its fluent API (visibility, enablement, tooltip, confirmation). +All `addRowAction` overloads register a new action and return an `EasyRowAction` that can be further configured via its fluent API (visibility, enablement, tooltip, confirmation). How the action is presented depends on the current `RowActionsStyle`. ```java EasyRowAction addRowAction(String label, SerializableConsumer handler); @@ -47,9 +47,13 @@ Adds an action button whose icon is resolved per row by calling `iconProvider` w #### Rendering mode ```java -void setRowActionsAsMenu(boolean asMenu); +void setRowActionsStyle(RowActionsStyle style); ``` -Controls how row actions are rendered. When `true`, all actions are presented as items in an overflow (context) menu triggered by a single button per row. When `false` (the default), each action is rendered as a separate inline button in the actions column. +Controls how row actions are presented. `RowActionsStyle` has three values: + +- `INLINE_BUTTONS` (the default) — each action is rendered as a separate inline button in the actions column. +- `DROPDOWN` — all actions are presented as items in an overflow menu, opened by a single trigger button per row that is hosted in the actions column. +- `CONTEXT_MENU` — all actions are presented as items in the grid's right-click context menu; no actions column is created. --- @@ -58,7 +62,9 @@ Controls how row actions are rendered. When `true`, all actions are presented as ```java Grid.Column getActionsColumn(); ``` -Returns the `Grid.Column` backing the actions column, allowing the caller to configure its header text, width, freeze position, or any other `Grid.Column` property. The actions column is created automatically when the first action is added. +Returns the `Grid.Column` backing the actions column, allowing the caller to configure its header text, width, freeze position, or any other `Grid.Column` property. For the column-based styles the column is created automatically when the actions are first rendered. + +Returns a non-`null` column for the `INLINE_BUTTONS` and `DROPDOWN` styles (the latter hosts its overflow menu trigger button in the column). For the `CONTEXT_MENU` style the actions are not hosted in a column, so this method returns `null`. --- @@ -76,7 +82,7 @@ Sets the Vaadin `ButtonVariant`s applied by default to every action button creat ```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. +Replaces the strategy that turns the registered actions into UI. The built-in renderers (selected via `setRowActionsStyle`) cover the common cases; supply a custom `RowActionsRenderer` to present actions another way. The previous renderer is cleaned up and a rebuild is scheduled. --- @@ -85,7 +91,7 @@ Replaces the strategy that turns the registered actions into UI. The built-in in ```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. +Schedules a rebuild of the row actions 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. --- @@ -153,7 +159,7 @@ These are forwarded onto the rendered button. Unlike the fluent mutators above, ```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. 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. The row actions are re-rendered on the next server response, refreshing the grid's data view so the change becomes visible without an explicit 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. --- From 9fa0a662bebfca268fd2795f34073df68b43684a Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Tue, 23 Jun 2026 11:21:06 -0300 Subject: [PATCH 2/2] WIP: spec: update usage examples for setRowActionsStyle() --- FEATURE_ROW_ACTIONS.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/FEATURE_ROW_ACTIONS.md b/FEATURE_ROW_ACTIONS.md index 45e4bdc..e582e01 100644 --- a/FEATURE_ROW_ACTIONS.md +++ b/FEATURE_ROW_ACTIONS.md @@ -185,8 +185,11 @@ easyGrid.addRowAction( person -> toggleActive(person) ); -// Actions as a context menu (overflow menu) instead of inline buttons -easyGrid.setRowActionsAsMenu(true); +// Actions as an overflow menu instead of inline buttons +easyGrid.setRowActionsStyle(RowActionsStyle.DROPDOWN); + +// ...or as the grid's right-click context menu (no actions column) +easyGrid.setRowActionsStyle(RowActionsStyle.CONTEXT_MENU); // Conditional visibility easyGrid.addRowAction("Activate", VaadinIcon.CHECK, person -> { @@ -209,7 +212,10 @@ easyGrid.setDefaultRowActionVariants(ButtonVariant.LUMO_SMALL, ButtonVariant.LUM easyGrid.addRowAction("Reset", person -> reset(person)) .addClassName("warning"); -// Configure the actions column via the underlying Grid.Column +// Configure the actions column via the underlying Grid.Column. +// Available for the INLINE_BUTTONS and DROPDOWN styles. With the CONTEXT_MENU +// style there is no actions column and getActionsColumn() returns null, so the +// chain below would throw a NullPointerException. easyGrid.getActionsColumn() .setHeader("Actions") .setWidth("150px")