aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/main/java/com/vaadin/client/UIDL.java38
-rw-r--r--client/src/main/java/com/vaadin/client/VUIDLBrowser.java5
-rw-r--r--client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java5
-rw-r--r--client/src/main/java/com/vaadin/client/ui/VEmbedded.java6
-rw-r--r--client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java2
-rw-r--r--client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java4
-rw-r--r--client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java10
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java5
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java5
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java4
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java34
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTreeTable.java9
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java5
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java6
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java5
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java16
16 files changed, 81 insertions, 78 deletions
diff --git a/client/src/main/java/com/vaadin/client/UIDL.java b/client/src/main/java/com/vaadin/client/UIDL.java
index 332b7aae9d..2c66568d65 100644
--- a/client/src/main/java/com/vaadin/client/UIDL.java
+++ b/client/src/main/java/com/vaadin/client/UIDL.java
@@ -32,8 +32,8 @@ import com.vaadin.ui.Component;
* from the server.
* <p>
* UIDL is hierarchical, and there are a few methods to retrieve the children,
- * {@link #getChildCount()}, {@link #getChildIterator()}
- * {@link #getChildString(int)}, {@link #getChildUIDL(int)}.
+ * {@link #getChildCount()}, {@link #iterator()} {@link #getChildString(int)},
+ * {@link #getChildUIDL(int)}.
* </p>
* <p>
* It can be helpful to keep in mind that UIDL was originally modeled in XML, so
@@ -42,7 +42,7 @@ import com.vaadin.ui.Component;
* but will be skipped by the methods mentioned above.
* </p>
*/
-public final class UIDL extends JavaScriptObject {
+public final class UIDL extends JavaScriptObject implements Iterable<Object> {
protected UIDL() {
}
@@ -62,7 +62,8 @@ public final class UIDL extends JavaScriptObject {
* Gets the name of this UIDL section, as created with
* {@link PaintTarget#startTag(String) PaintTarget.startTag()} in the
* server-side {@link Component#paint(PaintTarget) Component.paint()} or
- * (usually) {@link com.vaadin.ui.AbstractComponent#paintContent(PaintTarget)
+ * (usually)
+ * {@link com.vaadin.ui.AbstractComponent#paintContent(PaintTarget)
* AbstractComponent.paintContent()}. Note that if the UIDL corresponds to a
* Paintable, a component identifier will be returned instead - this is used
* internally and is not needed within
@@ -287,8 +288,33 @@ public final class UIDL extends JavaScriptObject {
* </p>
*
* @return an iterator for iterating over UIDL children
+ * @deprecated As of 8.2, please use {@link #iterator()} instead
*/
+ @Deprecated
public Iterator<Object> getChildIterator() {
+ return iterator();
+ }
+
+ /**
+ * Gets an iterator that can be used to iterate trough the children of this
+ * UIDL.
+ * <p>
+ * The Object returned by <code>next()</code> will be appropriately typed -
+ * if it's UIDL, {@link #getTag()} can be used to check which section is in
+ * question.
+ * </p>
+ * <p>
+ * The basic use case is to iterate over the children of an UIDL update, and
+ * update the appropriate part of the widget for each child encountered, e.g
+ * if <code>getTag()</code> returns "color", one would update the widgets
+ * color to reflect the value of the "color" section.
+ * </p>
+ *
+ * @return an iterator for iterating over UIDL children
+ * @since
+ */
+ @Override
+ public Iterator<Object> iterator() {
return new Iterator<Object>() {
@@ -545,9 +571,7 @@ public final class UIDL extends JavaScriptObject {
* @return the child UIDL or null if child wit given name was not found
*/
public UIDL getChildByTagName(String tagName) {
- Iterator<Object> childIterator = getChildIterator();
- while (childIterator.hasNext()) {
- Object next = childIterator.next();
+ for (Object next : this) {
if (next instanceof UIDL) {
UIDL childUIDL = (UIDL) next;
if (childUIDL.getTag().equals(tagName)) {
diff --git a/client/src/main/java/com/vaadin/client/VUIDLBrowser.java b/client/src/main/java/com/vaadin/client/VUIDLBrowser.java
index 9ed6229281..7068f7c790 100644
--- a/client/src/main/java/com/vaadin/client/VUIDLBrowser.java
+++ b/client/src/main/java/com/vaadin/client/VUIDLBrowser.java
@@ -15,7 +15,6 @@
*/
package com.vaadin.client;
-import java.util.Iterator;
import java.util.Set;
import com.google.gwt.core.client.JsArray;
@@ -311,9 +310,7 @@ public class VUIDLBrowser extends SimpleTree {
// Ignored, no variables
}
- final Iterator<Object> i = uidl.getChildIterator();
- while (i.hasNext()) {
- final Object child = i.next();
+ for (final Object child : uidl) {
try {
add(new UIDLItem((UIDL) child));
} catch (final Exception e) {
diff --git a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
index 9679473c80..d85643099c 100644
--- a/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
+++ b/client/src/main/java/com/vaadin/client/ui/ShortcutActionHandler.java
@@ -83,9 +83,8 @@ public class ShortcutActionHandler {
*/
public void updateActionMap(UIDL c) {
actions.clear();
- final Iterator<?> it = c.getChildIterator();
- while (it.hasNext()) {
- final UIDL action = (UIDL) it.next();
+ for (final Object child : c) {
+ final UIDL action = (UIDL) child;
int[] modifiers = null;
if (action.hasAttribute("mk")) {
diff --git a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java
index 551bf161d7..a6045848a7 100644
--- a/client/src/main/java/com/vaadin/client/ui/VEmbedded.java
+++ b/client/src/main/java/com/vaadin/client/ui/VEmbedded.java
@@ -17,7 +17,6 @@
package com.vaadin.client.ui;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import com.google.gwt.dom.client.Element;
@@ -195,10 +194,7 @@ public class VEmbedded extends HTML {
public static Map<String, String> getParameters(UIDL uidl) {
Map<String, String> parameters = new HashMap<>();
- Iterator<Object> childIterator = uidl.getChildIterator();
- while (childIterator.hasNext()) {
-
- Object child = childIterator.next();
+ for (Object child : uidl) {
if (child instanceof UIDL) {
UIDL childUIDL = (UIDL) child;
diff --git a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java
index c88a3079fb..89d33881ff 100644
--- a/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java
+++ b/client/src/main/java/com/vaadin/client/ui/dd/VAbstractDropHandler.java
@@ -50,7 +50,7 @@ public abstract class VAbstractDropHandler implements VDropHandler {
* contained in given uidl node
*/
if (!uidl.getTag().equals("-ac")) {
- Iterator<Object> childIterator = uidl.getChildIterator();
+ Iterator<Object> childIterator = uidl.iterator();
while (!uidl.getTag().equals("-ac") && childIterator.hasNext()) {
uidl = (UIDL) childIterator.next();
}
diff --git a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java
index 72d0784c3e..aa0ee3ab7b 100644
--- a/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/menubar/MenuBarConnector.java
@@ -100,7 +100,7 @@ public class MenuBarConnector extends AbstractComponentConnector
}
UIDL uidlItems = uidl.getChildUIDL(1);
- Iterator<Object> itr = uidlItems.getChildIterator();
+ Iterator<Object> itr = uidlItems.iterator();
Stack<Iterator<Object>> iteratorStack = new Stack<>();
Stack<VMenuBar> menuStack = new Stack<>();
VMenuBar currentMenu = getWidget();
@@ -137,7 +137,7 @@ public class MenuBarConnector extends AbstractComponentConnector
if (item.getChildCount() > 0) {
menuStack.push(currentMenu);
iteratorStack.push(itr);
- itr = item.getChildIterator();
+ itr = item.iterator();
currentMenu = new VMenuBar(true, currentMenu);
client.getVTooltip().connectHandlersToWidget(currentMenu);
// this is the top-level style that also propagates to items -
diff --git a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
index 749d72b575..6a43b334c1 100644
--- a/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/main/java/com/vaadin/client/ui/ui/UIConnector.java
@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -467,8 +466,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
/*
* Search the UIDL stream for CSS resources and strings to be injected.
*/
- for (Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
- UIDL cssInjectionsUidl = (UIDL) it.next();
+ for (Object child : uidl) {
+ UIDL cssInjectionsUidl = (UIDL) child;
// Check if we have resources to inject
if (cssInjectionsUidl.getTag().equals("css-resource")) {
@@ -482,9 +481,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
getHead().appendChild(link);
// Check if we have CSS string to inject
} else if (cssInjectionsUidl.getTag().equals("css-string")) {
- for (Iterator<?> it2 = cssInjectionsUidl.getChildIterator(); it2
- .hasNext();) {
- StyleInjector.injectAtEnd((String) it2.next());
+ for (Object c : cssInjectionsUidl) {
+ StyleInjector.injectAtEnd((String) c);
StyleInjector.flush();
}
}
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java
index 7a5b7e0935..acc99e7ace 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VListSelect.java
@@ -18,7 +18,6 @@ package com.vaadin.v7.client.ui;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -90,8 +89,8 @@ public class VListSelect extends VOptionGroupBase {
// need to deselect when something else is selected since it's only
// used in single select mode.
}
- for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
- final UIDL optionUidl = (UIDL) i.next();
+ for (final Object child : uidl) {
+ final UIDL optionUidl = (UIDL) child;
updateOrCreateItem(optionUidl.getStringAttribute("caption"),
optionUidl.getStringAttribute("key"), nextIndex,
previousKeys);
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java
index ff5541c88c..0dcad75648 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VNativeSelect.java
@@ -17,7 +17,6 @@
package com.vaadin.v7.client.ui;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import com.google.gwt.event.dom.client.ChangeEvent;
@@ -58,8 +57,8 @@ public class VNativeSelect extends VOptionGroupBase implements Field {
select.addItem("", (String) null);
}
boolean selected = false;
- for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
- final UIDL optionUidl = (UIDL) i.next();
+ for (final Object child : uidl) {
+ final UIDL optionUidl = (UIDL) child;
select.addItem(optionUidl.getStringAttribute("caption"),
optionUidl.getStringAttribute("key"));
if (optionUidl.hasAttribute("selected")) {
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java
index e3d94b0d4a..6150625547 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VOptionGroup.java
@@ -134,8 +134,8 @@ public class VOptionGroup extends VOptionGroupBase
Roles.getRadiogroupRole().set(getElement());
}
- for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
- final UIDL opUidl = (UIDL) it.next();
+ for (final Object child : uidl) {
+ final UIDL opUidl = (UIDL) child;
String itemHtml = opUidl.getStringAttribute("caption");
if (!htmlContentAllowed) {
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
index 9c9665d7ce..364afb0592 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
@@ -1662,9 +1662,8 @@ public class VScrollTable extends FlowPanel
return;
}
- final Iterator<?> it = actionsUidl.getChildIterator();
- while (it.hasNext()) {
- final UIDL action = (UIDL) it.next();
+ for (final Object child : actionsUidl) {
+ final UIDL action = (UIDL) child;
final String key = action.getStringAttribute("key");
final String caption = action.getStringAttribute("caption");
actionMap.put(key + "_c", caption);
@@ -3649,12 +3648,11 @@ public class VScrollTable extends FlowPanel
}
public void updateCellsFromUIDL(UIDL uidl) {
- Iterator<?> it = uidl.getChildIterator();
HashSet<String> updated = new HashSet<String>();
boolean refreshContentWidths = initializedAndAttached
&& hadScrollBars != willHaveScrollbars();
- while (it.hasNext()) {
- final UIDL col = (UIDL) it.next();
+ for (Object child : uidl) {
+ final UIDL col = (UIDL) child;
final String cid = col.getStringAttribute("cid");
updated.add(cid);
@@ -4586,10 +4584,9 @@ public class VScrollTable extends FlowPanel
* The UIDL
*/
public void updateCellsFromUIDL(UIDL uidl) {
- Iterator<?> columnIterator = uidl.getChildIterator();
HashSet<String> updated = new HashSet<String>();
- while (columnIterator.hasNext()) {
- final UIDL col = (UIDL) columnIterator.next();
+ for (Object child : uidl) {
+ final UIDL col = (UIDL) child;
final String cid = col.getStringAttribute("cid");
updated.add(cid);
@@ -4870,10 +4867,9 @@ public class VScrollTable extends FlowPanel
public void renderInitialRows(UIDL rowData, int firstIndex, int rows) {
firstRendered = firstIndex;
setLastRendered(firstIndex + rows - 1);
- final Iterator<?> it = rowData.getChildIterator();
aligns = tHead.getColumnAlignments();
- while (it.hasNext()) {
- final VScrollTableRow row = createRow((UIDL) it.next(), aligns);
+ for (final Object child : rowData) {
+ final VScrollTableRow row = createRow((UIDL) child, aligns);
addRow(row);
}
if (isAttached()) {
@@ -4884,7 +4880,7 @@ public class VScrollTable extends FlowPanel
public void renderRows(UIDL rowData, int firstIndex, int rows) {
// FIXME REVIEW
aligns = tHead.getColumnAlignments();
- final Iterator<?> it = rowData.getChildIterator();
+ final Iterator<?> it = rowData.iterator();
if (firstIndex == lastRendered + 1) {
while (it.hasNext()) {
final VScrollTableRow row = prepareRow((UIDL) it.next());
@@ -5005,7 +5001,7 @@ public class VScrollTable extends FlowPanel
protected List<VScrollTableRow> insertRows(UIDL rowData, int firstIndex,
int rows) {
aligns = tHead.getColumnAlignments();
- final Iterator<?> it = rowData.getChildIterator();
+ final Iterator<?> it = rowData.iterator();
List<VScrollTableRow> insertedRows = new ArrayList<VScrollTableRow>();
if (firstIndex == lastRendered + 1) {
@@ -5628,9 +5624,7 @@ public class VScrollTable extends FlowPanel
protected void addCellsFromUIDL(UIDL uidl, char[] aligns, int col,
int visibleColumnIndex) {
- final Iterator<?> cells = uidl.getChildIterator();
- while (cells.hasNext()) {
- final Object cell = cells.next();
+ for (final Object cell : uidl) {
visibleColumnIndex++;
String columnId = visibleColOrder[visibleColumnIndex];
@@ -6718,11 +6712,10 @@ public class VScrollTable extends FlowPanel
htmlContentAllowed = uidl.getBooleanAttribute("gen_html");
spanColumns = uidl.getBooleanAttribute("gen_span");
- final Iterator<?> cells = uidl.getChildIterator();
if (spanColumns) {
int colCount = uidl.getChildCount();
- if (cells.hasNext()) {
- final Object cell = cells.next();
+ // add the first cell only
+ for (final Object cell : uidl) {
if (cell instanceof String) {
addSpannedCell(uidl, cell.toString(), aligns[0], "",
htmlContentAllowed, false, null, colCount);
@@ -6730,6 +6723,7 @@ public class VScrollTable extends FlowPanel
addSpannedCell(uidl, (Widget) cell, aligns[0], "",
false, colCount);
}
+ break;
}
} else {
super.addCellsFromUIDL(uidl, aligns, col,
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTreeTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTreeTable.java
index 903b611ff3..dc76d6cd2d 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTreeTable.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTreeTable.java
@@ -196,7 +196,8 @@ public class VTreeTable extends VScrollTable {
treeSpacer.setClassName(classname);
container.insertFirst(treeSpacer);
depth = rowUidl.hasAttribute("depth")
- ? rowUidl.getIntAttribute("depth") : 0;
+ ? rowUidl.getIntAttribute("depth")
+ : 0;
setIndent();
isTreeCellAdded = true;
return true;
@@ -341,11 +342,10 @@ public class VTreeTable extends VScrollTable {
htmlContentAllowed = uidl.getBooleanAttribute("gen_html");
spanColumns = uidl.getBooleanAttribute("gen_span");
- final Iterator<?> cells = uidl.getChildIterator();
if (spanColumns) {
int colCount = uidl.getChildCount();
- if (cells.hasNext()) {
- final Object cell = cells.next();
+ // add the first cell only
+ for (final Object cell : uidl) {
if (cell instanceof String) {
addSpannedCell(uidl, cell.toString(), aligns[0], "",
htmlContentAllowed, false, null, colCount);
@@ -353,6 +353,7 @@ public class VTreeTable extends VScrollTable {
addSpannedCell(uidl, (Widget) cell, aligns[0], "",
false, colCount);
}
+ break;
}
} else {
super.addCellsFromUIDL(uidl, aligns, col,
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java
index cf8e379818..c996fdc06a 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTwinColSelect.java
@@ -18,7 +18,6 @@ package com.vaadin.v7.client.ui;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -231,8 +230,8 @@ public class VTwinColSelect extends VOptionGroupBase implements KeyDownHandler,
selections.setMultipleSelect(isMultiselect());
options.clear();
selections.clear();
- for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
- final UIDL optionUidl = (UIDL) i.next();
+ for (final Object child : uidl) {
+ final UIDL optionUidl = (UIDL) child;
if (optionUidl.hasAttribute("selected")) {
selections.addItem(optionUidl.getStringAttribute("caption"),
optionUidl.getStringAttribute("key"));
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
index dce1a4e84e..968defbe63 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/CalendarConnector.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -394,9 +393,8 @@ public class CalendarConnector extends AbstractLegacyComponentConnector
*/
@Override
public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
- Iterator<Object> childIterator = uidl.getChildIterator();
- while (childIterator.hasNext()) {
- UIDL child = (UIDL) childIterator.next();
+ for (Object c : uidl) {
+ UIDL child = (UIDL) c;
if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) {
if (getWidget().getDropHandler() == null) {
getWidget().setDropHandler(showingMonthView()
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java
index c50b4f977c..b3b4405a1b 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/combobox/ComboBoxConnector.java
@@ -16,7 +16,6 @@
package com.vaadin.v7.client.ui.combobox;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import com.google.gwt.core.client.Scheduler;
@@ -126,8 +125,8 @@ public class ComboBoxConnector extends AbstractFieldConnector
List<FilterSelectSuggestion> newSuggestions = new ArrayList<FilterSelectSuggestion>();
- for (final Iterator<?> i = options.getChildIterator(); i.hasNext();) {
- final UIDL optionUidl = (UIDL) i.next();
+ for (final Object child : options) {
+ final UIDL optionUidl = (UIDL) child;
final FilterSelectSuggestion suggestion = getWidget().new FilterSelectSuggestion(
optionUidl);
newSuggestions.add(suggestion);
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java
index d03c0bf55a..dd8305b90b 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/tree/TreeConnector.java
@@ -80,7 +80,8 @@ public class TreeConnector extends AbstractLegacyComponentConnector
getWidget().readonly = isReadOnly();
getWidget().dragMode = uidl.hasAttribute("dragMode")
- ? uidl.getIntAttribute("dragMode") : 0;
+ ? uidl.getIntAttribute("dragMode")
+ : 0;
getWidget().isNullSelectionAllowed = uidl
.getBooleanAttribute("nullselect");
@@ -98,8 +99,8 @@ public class TreeConnector extends AbstractLegacyComponentConnector
TreeNode childTree = null;
UIDL childUidl = null;
- for (final Iterator<?> i = uidl.getChildIterator(); i.hasNext();) {
- childUidl = (UIDL) i.next();
+ for (final Object child : uidl) {
+ childUidl = (UIDL) child;
if ("actions".equals(childUidl.getTag())) {
updateActionMap(childUidl);
continue;
@@ -213,7 +214,7 @@ public class TreeConnector extends AbstractLegacyComponentConnector
VConsole.error(e);
}
- renderChildNodes(rootNode, (Iterator) uidl.getChildIterator(),
+ renderChildNodes(rootNode, (Iterator) uidl.iterator(),
levelProperty + 1);
}
}
@@ -224,9 +225,8 @@ public class TreeConnector extends AbstractLegacyComponentConnector
* @param uidl
*/
private void updateActionMap(UIDL uidl) {
- final Iterator<?> it = uidl.getChildIterator();
- while (it.hasNext()) {
- final UIDL action = (UIDL) it.next();
+ for (final Object child : uidl) {
+ final UIDL action = (UIDL) child;
final String key = action.getStringAttribute("key");
final String caption = action
.getStringAttribute(TreeConstants.ATTRIBUTE_ACTION_CAPTION);
@@ -265,7 +265,7 @@ public class TreeConnector extends AbstractLegacyComponentConnector
if (uidl.getChildCount() == 0) {
treeNode.childNodeContainer.setVisible(false);
} else {
- renderChildNodes(treeNode, (Iterator) uidl.getChildIterator(),
+ renderChildNodes(treeNode, (Iterator) uidl.iterator(),
level + 1);
treeNode.childrenLoaded = true;
}