diff options
author | Teppo Kurki <teppo.kurki@vaadin.com> | 2015-07-09 23:23:35 +0300 |
---|---|---|
committer | patrik <patrik@vaadin.com> | 2015-08-05 12:36:42 +0300 |
commit | f031c9a46c9d4b1eedb9e86c2e72ab97f5847593 (patch) | |
tree | 9eeee879bf0a5e2f77c77ad6d59f919313fb7623 /server/src/com | |
parent | 4f3533115bae0acd251405a1c70feb8c62756c2f (diff) | |
download | vaadin-framework-f031c9a46c9d4b1eedb9e86c2e72ab97f5847593.tar.gz vaadin-framework-f031c9a46c9d4b1eedb9e86c2e72ab97f5847593.zip |
Update Select all -CheckBox from server and partial selections (#17590)
Change-Id: Iab111504502dc104cb9ce8777dbaf87bba1e31a0
Diffstat (limited to 'server/src/com')
-rw-r--r-- | server/src/com/vaadin/ui/Grid.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Grid.java b/server/src/com/vaadin/ui/Grid.java index ea973bb3ba..3e4a78db9d 100644 --- a/server/src/com/vaadin/ui/Grid.java +++ b/server/src/com/vaadin/ui/Grid.java @@ -1068,6 +1068,8 @@ public class Grid extends AbstractComponent implements SelectionNotifier, private int selectionLimit = DEFAULT_MAX_SELECTIONS; + private boolean allSelected; + @Override public boolean select(final Object... itemIds) throws IllegalArgumentException { @@ -1113,6 +1115,9 @@ public class Grid extends AbstractComponent implements SelectionNotifier, } fireSelectionEvent(oldSelection, selection); } + + updateAllSelectedState(); + return selectionWillChange; } @@ -1178,6 +1183,9 @@ public class Grid extends AbstractComponent implements SelectionNotifier, selection.removeAll(itemIds); fireSelectionEvent(oldSelection, selection); } + + updateAllSelectedState(); + return hasCommonElements; } @@ -1258,6 +1266,8 @@ public class Grid extends AbstractComponent implements SelectionNotifier, fireSelectionEvent(oldSelection, selection); } + updateAllSelectedState(); + return changed; } @@ -1271,6 +1281,13 @@ public class Grid extends AbstractComponent implements SelectionNotifier, "Vararg array of itemIds may not be null"); } } + + private void updateAllSelectedState() { + if (allSelected != selection.size() >= selectionLimit) { + allSelected = selection.size() >= selectionLimit; + grid.getRpcProxy(GridClientRpc.class).setSelectAll(allSelected); + } + } } /** |