From: Marko Grönroos Date: Mon, 23 Jun 2008 13:33:46 +0000 (+0000) Subject: Order selected items in Tables example because the return type is a Set and we need... X-Git-Tag: 6.7.0.beta1~4564 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=efa5c7affd2e0767abb95ee891b86fc220ab220f;p=vaadin-framework.git Order selected items in Tables example because the return type is a Set and we need to always have them in the same order for testing purposes. svn changeset:4940/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java b/src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java index 83f9ca1b76..a53f024904 100644 --- a/src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java +++ b/src/com/itmill/toolkit/automatedtests/featurebrowser/TableExample.java @@ -5,6 +5,8 @@ package com.itmill.toolkit.automatedtests.featurebrowser; import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; import java.util.Random; import java.util.Set; @@ -232,7 +234,15 @@ public class TableExample extends CustomComponent implements Action.Handler, // loop each selected and copy to "saved" table final Set selected = (Set) source.getValue(); int s = 0; - for (final Iterator it = selected.iterator(); it.hasNext();) { + + // The set can return the items in quite any order, but + // for testing purposes they always have to be in the + // same order. + List ordered = new LinkedList(selected); + java.util.Collections.sort(ordered); + + // Now move the items to the other table + for (final Iterator it = ordered.iterator(); it.hasNext();) { final Object id = it.next(); if (!saved.containsId(id)) { final Item item = source.getItem(id);