diff options
Diffstat (limited to 'compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java')
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java index 2d6c1e521e..7738c166f7 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Tree.java @@ -529,9 +529,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, // Collapses the nodes if (variables.containsKey("collapse")) { - final String[] keys = (String[]) variables.get("collapse"); - for (int i = 0; i < keys.length; i++) { - final Object id = itemIdMapper.get(keys[i]); + for (String key : (String[]) variables.get("collapse")) { + final Object id = itemIdMapper.get(key); if (id != null && isExpanded(id)) { expanded.remove(id); if (expandedItemId == id) { @@ -548,9 +547,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, if (variables.containsKey("requestChildTree")) { sendChildTree = true; } - final String[] keys = (String[]) variables.get("expand"); - for (int i = 0; i < keys.length; i++) { - final Object id = itemIdMapper.get(keys[i]); + for (String key : (String[]) variables.get("expand")) { + final Object id = itemIdMapper.get(key); if (id != null) { expandItem(id, sendChildTree); } @@ -593,12 +591,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical, * The variables sent to the server from the client */ private void handleSelectedItems(Map<String, Object> variables) { - final String[] ka = (String[]) variables.get("selected"); // Converts the key-array to id-set final LinkedList<Object> s = new LinkedList<Object>(); - for (int i = 0; i < ka.length; i++) { - final Object id = itemIdMapper.get(ka[i]); + for (String key : (String[]) variables.get("selected")) { + final Object id = itemIdMapper.get(key); if (!isNullSelectionAllowed() && (id == null || id == getNullSelectionItemId())) { // skip empty selection if nullselection is not allowed |