summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarno Rantala <jarno.rantala@vaadin.com>2014-01-14 10:02:34 +0200
committerVaadin Code Review <review@vaadin.com>2014-01-16 12:31:17 +0000
commitf93c870fe9d7c6cd01892c97d5a9c799e079fa4e (patch)
tree147552359f0d28325b26085b3bb410b3a46dc30f
parent168788959373f561b8862128fa6aedc20a5591c2 (diff)
downloadvaadin-framework-f93c870fe9d7c6cd01892c97d5a9c799e079fa4e.tar.gz
vaadin-framework-f93c870fe9d7c6cd01892c97d5a9c799e079fa4e.zip
Remove unselected rows from selection on client side (#13008)
When server communicates the selected rows to the client side, client side datastructure of selected row keys is updated such that also the keys that has been unselected on server side are removed. This makes the test MultiSelectWithRemovedRow to pass. Change-Id: I7b6123436171972ecf345b07ddfb6d9965ca4f0c
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index bb431bf132..3c574f8f92 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -1060,6 +1060,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (uidl.hasVariable("selected")) {
final Set<String> selectedKeys = uidl
.getStringArrayVariableAsSet("selected");
+ removeUnselectedRowKeys(selectedKeys);
+
if (scrollBody != null) {
Iterator<Widget> iterator = scrollBody.iterator();
while (iterator.hasNext()) {
@@ -1102,6 +1104,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
return keyboardSelectionOverRowFetchInProgress;
}
+ private void removeUnselectedRowKeys(final Set<String> selectedKeys) {
+ List<String> unselectedKeys = new ArrayList<String>(0);
+ for (String key : selectedRowKeys) {
+ if (!selectedKeys.contains(key)) {
+ unselectedKeys.add(key);
+ }
+ }
+ selectedRowKeys.removeAll(unselectedKeys);
+ }
+
/** For internal use only. May be removed or replaced in the future. */
public void updateSortingProperties(UIDL uidl) {
oldSortColumn = sortColumn;