From 6aeee90ccab579052452862e322b1c3ce0e0e51e Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 23 Jul 2014 15:15:28 +0300 Subject: Refactor GridConnector to remove RowKeyHelper (#13334) Change-Id: I4c2fec5b46b15eea456d4b0347b2a686943ad113 --- server/src/com/vaadin/ui/components/grid/Grid.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'server') diff --git a/server/src/com/vaadin/ui/components/grid/Grid.java b/server/src/com/vaadin/ui/components/grid/Grid.java index f5846c0148..514a0496e2 100644 --- a/server/src/com/vaadin/ui/components/grid/Grid.java +++ b/server/src/com/vaadin/ui/components/grid/Grid.java @@ -286,7 +286,7 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier { SetView removedItemIds = Sets.difference(oldSelection, newSelection); - if (!addedItemIds.isEmpty()) { + if (!removedItemIds.isEmpty()) { /* * Since these changes come from the client, we want to * modify the selection model and get that event fired to @@ -296,16 +296,16 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier { */ ignoreSelectionClientSync++; - if (addedItemIds.size() == 1) { - select(addedItemIds.iterator().next()); + if (removedItemIds.size() == 1) { + deselect(removedItemIds.iterator().next()); } else { - assert getSelectionModel() instanceof SelectionModel.Multi : "Got multiple selections, but the selection model is not a SelectionModel.Multi"; + assert getSelectionModel() instanceof SelectionModel.Multi : "Got multiple deselections, but the selection model is not a SelectionModel.Multi"; ((SelectionModel.Multi) getSelectionModel()) - .select(addedItemIds); + .deselect(removedItemIds); } } - if (!removedItemIds.isEmpty()) { + if (!addedItemIds.isEmpty()) { /* * Since these changes come from the client, we want to * modify the selection model and get that event fired to @@ -315,12 +315,12 @@ public class Grid extends AbstractComponent implements SelectionChangeNotifier { */ ignoreSelectionClientSync++; - if (removedItemIds.size() == 1) { - deselect(removedItemIds.iterator().next()); + if (addedItemIds.size() == 1) { + select(addedItemIds.iterator().next()); } else { - assert getSelectionModel() instanceof SelectionModel.Multi : "Got multiple deselections, but the selection model is not a SelectionModel.Multi"; + assert getSelectionModel() instanceof SelectionModel.Multi : "Got multiple selections, but the selection model is not a SelectionModel.Multi"; ((SelectionModel.Multi) getSelectionModel()) - .deselect(removedItemIds); + .select(addedItemIds); } } } -- cgit v1.2.3