diff options
author | Tarek Oraby <42799254+tarekoraby@users.noreply.github.com> | 2020-08-26 17:31:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 17:31:58 +0300 |
commit | 7babdf719ca5641b8ad7ea1421c342d6cfcc427a (patch) | |
tree | 0c45986aa6d076f893312cfaec983d936e383992 /server | |
parent | 49f0317b72efe65fa5d585a51750172ea3dca8c7 (diff) | |
download | vaadin-framework-7babdf719ca5641b8ad7ea1421c342d6cfcc427a.tar.gz vaadin-framework-7babdf719ca5641b8ad7ea1421c342d6cfcc427a.zip |
Add API to detect if GridMultiSelect select-all checkbox is checked (#12086)
Diffstat (limited to 'server')
3 files changed, 27 insertions, 9 deletions
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/GridMultiSelect.java b/server/src/main/java/com/vaadin/ui/components/grid/GridMultiSelect.java index 2e98230a6f..e376f72711 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/GridMultiSelect.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/GridMultiSelect.java @@ -188,6 +188,20 @@ public class GridMultiSelect<T> implements MultiSelect<T> { } /** + * Returns whether all items are selected or not. + * <p> + * This is only {@code true} if user has selected all rows with the select + * all checkbox on client side, or if {@link #selectAll()} has been used + * from server side. + * + * @return {@code true} if all selected, {@code false} if not + * @since 8.12.0 + */ + public boolean isAllSelected() { + return model.isAllSelected(); + } + + /** * Checks if the user is allowed to change the selection. * <p> * The check is done only for the client side actions. It doesn't affect diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java index 305a4fbaf9..35f948ca46 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModel.java @@ -135,4 +135,16 @@ public interface MultiSelectionModel<T> * @see #setSelectAllCheckBoxVisibility(SelectAllCheckBoxVisibility) */ public boolean isSelectAllCheckBoxVisible(); + + /** + * Returns whether all items are selected or not. + * <p> + * This is only {@code true} if user has selected all rows with the select + * all checkbox on client side, or if {@link #selectAll()} has been used + * from server side. + * + * @return {@code true} if all selected, {@code false} if not + * @since 8.12.0 + */ + boolean isAllSelected(); } diff --git a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java index 0ef1d1a5f7..7d8c6d7d85 100644 --- a/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java +++ b/server/src/main/java/com/vaadin/ui/components/grid/MultiSelectionModelImpl.java @@ -131,15 +131,7 @@ public class MultiSelectionModelImpl<T> extends AbstractSelectionModel<T> return getState(false).selectAllCheckBoxVisible; } - /** - * Returns whether all items are selected or not. - * <p> - * This is only {@code true} if user has selected all rows with the select - * all checkbox on client side, or if {@link #selectAll()} has been used - * from server side. - * - * @return {@code true} if all selected, {@code false} if not - */ + @Override public boolean isAllSelected() { return getState(false).allSelected; } |