]> source.dussan.org Git - vaadin-framework.git/commitdiff
Order selected items in Tables example because the return type is a Set and we need...
authorMarko Grönroos <magi@iki.fi>
Mon, 23 Jun 2008 13:33:46 +0000 (13:33 +0000)
committerMarko Grönroos <magi@iki.fi>
Mon, 23 Jun 2008 13:33:46 +0000 (13:33 +0000)
svn changeset:4940/svn branch:trunk

src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java

index 83f9ca1b76509a6d971d7df5de79717f16ca86d1..a53f02490414f0bb3ec8a72d9af48631f7c2af4b 100644 (file)
@@ -5,6 +5,8 @@
 package com.itmill.toolkit.automatedtests.featurebrowser;\r
 \r
 import java.util.Iterator;\r
+import java.util.LinkedList;\r
+import java.util.List;\r
 import java.util.Random;\r
 import java.util.Set;\r
 \r
@@ -232,7 +234,15 @@ public class TableExample extends CustomComponent implements Action.Handler,
             // loop each selected and copy to "saved" table\r
             final Set selected = (Set) source.getValue();\r
             int s = 0;\r
-            for (final Iterator it = selected.iterator(); it.hasNext();) {\r
+            \r
+            // The set can return the items in quite any order, but\r
+            // for testing purposes they always have to be in the\r
+            // same order.\r
+            List ordered = new LinkedList(selected);\r
+            java.util.Collections.sort(ordered);\r
+            \r
+            // Now move the items to the other table\r
+            for (final Iterator it = ordered.iterator(); it.hasNext();) {\r
                 final Object id = it.next();\r
                 if (!saved.containsId(id)) {\r
                     final Item item = source.getItem(id);\r