Matthew Dempsky has submitted this change and it was merged.

Change subject: Fix SingleSelectionModel.getSelectedSet()
......................................................................


Fix SingleSelectionModel.getSelectedSet()

Ensure that if recent changes have been made to the model, that
getSelectedSet() still returns the same object that
getSelectedObject() would.

Change-Id: I0d0fbb4e8f9650d77d2270f53cde681a9cf2ca0f
Review-Link: https://gwt-review.googlesource.com/#/c/3680/
---
M user/src/com/google/gwt/view/client/SingleSelectionModel.java
M user/test/com/google/gwt/view/client/SingleSelectionModelTest.java
2 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Leeroy Jenkins: Verified
  Goktug Gokdogan: Looks good to me, approved



diff --git a/user/src/com/google/gwt/view/client/SingleSelectionModel.java b/user/src/com/google/gwt/view/client/SingleSelectionModel.java
index c34c338..9c84c8b 100644
--- a/user/src/com/google/gwt/view/client/SingleSelectionModel.java
+++ b/user/src/com/google/gwt/view/client/SingleSelectionModel.java
@@ -71,8 +71,9 @@
   @Override
   public Set<T> getSelectedSet() {
     Set<T> set = new HashSet<T>();
-    if (curSelection != null) {
-      set.add(curSelection);
+    T item = getSelectedObject();
+    if (item != null) {
+      set.add(item);
     }
     return set;
   }
diff --git a/user/test/com/google/gwt/view/client/SingleSelectionModelTest.java b/user/test/com/google/gwt/view/client/SingleSelectionModelTest.java
index 5ab75f1..d1966e9 100644
--- a/user/test/com/google/gwt/view/client/SingleSelectionModelTest.java
+++ b/user/test/com/google/gwt/view/client/SingleSelectionModelTest.java
@@ -105,6 +105,10 @@
     assertFalse(model.isSelected("test1"));
     assertFalse(model.isSelected("test0"));
     assertEquals(0, model.getSelectedSet().size());
+
+    model.setSelected("test2", true);
+    assertEquals(1, model.getSelectedSet().size());
+    assertEquals("test2", model.getSelectedSet().iterator().next());
   }

   public void testSetSelectedNull() {

--
To view, visit https://gwt-review.googlesource.com/3680
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d0fbb4e8f9650d77d2270f53cde681a9cf2ca0f
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Matthew Dempsky <[email protected]>
Gerrit-Reviewer: Goktug Gokdogan <[email protected]>
Gerrit-Reviewer: Leeroy Jenkins <[email protected]>
Gerrit-Reviewer: Matthew Dempsky <[email protected]>
Gerrit-Reviewer: Thomas Broyer <[email protected]>

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to