summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorTeppo Kurki <teppo.kurki@vaadin.com>2015-07-09 23:23:35 +0300
committerVaadin Code Review <review@vaadin.com>2015-08-05 07:29:09 +0000
commit3c7eab0d5810a16a31778b22af22e8a34251db1a (patch)
tree019b5857978e7b690ef292fc30ccc3e4d86959e9 /server
parentf6d075df5207e02b3e96a35943c022c2c2f29bc1 (diff)
downloadvaadin-framework-3c7eab0d5810a16a31778b22af22e8a34251db1a.tar.gz
vaadin-framework-3c7eab0d5810a16a31778b22af22e8a34251db1a.zip
Update Select all -CheckBox from server and partial selections (#17590)
Change-Id: I8f4986455029fc3b997ec5fee8916fa118a487ca
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/Grid.java17
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);
+ }
+ }
}
/**