diff options
Diffstat (limited to 'compatibility-client')
8 files changed, 47 insertions, 77 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java index 2c2841042d..bb4acd257b 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java @@ -17,7 +17,6 @@ package com.vaadin.v7.client.ui; import java.util.Date; -import java.util.Iterator; import com.google.gwt.aria.client.Roles; import com.google.gwt.aria.client.SelectedValue; @@ -450,7 +449,8 @@ public class VCalendarPanel extends FocusableFlexTable implements updateControlButtonRangeStyles(needsMonth); final String monthName = needsMonth - ? getDateTimeService().getMonth(displayedMonth.getMonth()) : ""; + ? getDateTimeService().getMonth(displayedMonth.getMonth()) + : ""; final int year = displayedMonth.getYear() + 1900; getFlexCellFormatter().setStyleName(0, 2, @@ -1404,8 +1404,8 @@ public class VCalendarPanel extends FocusableFlexTable implements /** * Returns the reset key which will reset the calendar to the previous - * selection. By default this is backspace but it can be overridden to change - * the key to whatever you want. + * selection. By default this is backspace but it can be overridden to + * change the key to whatever you want. * * @return */ @@ -2138,9 +2138,7 @@ public class VCalendarPanel extends FocusableFlexTable implements .parseInt(subPart.substring(SUBPART_DAY.length())); Date date = new Date(displayedMonth.getYear(), displayedMonth.getMonth(), dayOfMonth); - Iterator<Widget> iter = days.iterator(); - while (iter.hasNext()) { - Widget w = iter.next(); + for (Widget w : days) { if (w instanceof Day) { Day day = (Day) w; if (day.getDate().equals(date)) { diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java index 3bc66e8390..0abee9b3b3 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java @@ -20,7 +20,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; @@ -1092,10 +1091,8 @@ public class VFilterSelect extends Composite } clearItems(); - final Iterator<FilterSelectSuggestion> it = suggestions.iterator(); boolean isFirstIteration = true; - while (it.hasNext()) { - final FilterSelectSuggestion s = it.next(); + for (final FilterSelectSuggestion s : suggestions) { final MenuItem mi = new MenuItem(s.getDisplayString(), true, s); String style = s.getStyle(); if (style != null) { 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 6150625547..4abcc75f4d 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 @@ -237,10 +237,8 @@ public class VOptionGroup extends VOptionGroupBase @Override public void setTabIndex(int tabIndex) { - for (Iterator<Widget> iterator = panel.iterator(); iterator - .hasNext();) { - FocusWidget widget = (FocusWidget) iterator.next(); - widget.setTabIndex(tabIndex); + for (Widget widget : panel) { + ((FocusWidget) widget).setTabIndex(tabIndex); } } @@ -269,9 +267,10 @@ public class VOptionGroup extends VOptionGroupBase @Override public void focus() { - Iterator<Widget> iterator = panel.iterator(); - if (iterator.hasNext()) { - ((Focusable) iterator.next()).setFocus(true); + Iterator<Widget> it = panel.iterator(); + if (it.hasNext()) { + ((Focusable) it.next()).setFocus(true); + } } 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 364afb0592..9894264126 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 @@ -1315,13 +1315,12 @@ public class VScrollTable extends FlowPanel boolean updateFocus = rowsUnSelected || selectedRowKeys.size() == 0 || focusedRow == null; if (scrollBody != null) { - Iterator<Widget> iterator = scrollBody.iterator(); - while (iterator.hasNext()) { + for (Widget w : scrollBody) { /* * Make the focus reflect to the server side state unless we * are currently selecting multiple rows with keyboard. */ - VScrollTableRow row = (VScrollTableRow) iterator.next(); + VScrollTableRow row = (VScrollTableRow) w; boolean selected = selectedKeys.contains(row.getKey()); if (!selected && unSyncedselectionsBeforeRowFetch != null && unSyncedselectionsBeforeRowFetch @@ -2034,10 +2033,8 @@ public class VScrollTable extends FlowPanel */ public VScrollTableRow getRenderedRowByKey(String key) { if (scrollBody != null) { - final Iterator<Widget> it = scrollBody.iterator(); - VScrollTableRow r = null; - while (it.hasNext()) { - r = (VScrollTableRow) it.next(); + for (Widget w : scrollBody) { + VScrollTableRow r = (VScrollTableRow) w; if (r.getKey().equals(key)) { return r; } @@ -2056,9 +2053,8 @@ public class VScrollTable extends FlowPanel */ private VScrollTableRow getNextRow(VScrollTableRow row, int offset) { final Iterator<Widget> it = scrollBody.iterator(); - VScrollTableRow r = null; while (it.hasNext()) { - r = (VScrollTableRow) it.next(); + VScrollTableRow r = (VScrollTableRow) it.next(); if (r == row) { r = null; while (offset >= 0 && it.hasNext()) { @@ -2082,10 +2078,9 @@ public class VScrollTable extends FlowPanel private VScrollTableRow getPreviousRow(VScrollTableRow row, int offset) { final Iterator<Widget> it = scrollBody.iterator(); final Iterator<Widget> offsetIt = scrollBody.iterator(); - VScrollTableRow r = null; VScrollTableRow prev = null; while (it.hasNext()) { - r = (VScrollTableRow) it.next(); + VScrollTableRow r = (VScrollTableRow) it.next(); if (offset < 0) { prev = (VScrollTableRow) offsetIt.next(); } @@ -3452,11 +3447,11 @@ public class VScrollTable extends FlowPanel } if (columnIndex < 0) { columnIndex = 0; - for (Iterator<Widget> it = tHead.iterator(); it - .hasNext(); columnIndex++) { - if (it.next() == this) { + for (Widget w : tHead) { + if (w == this) { break; } + columnIndex++; } } final int cw = scrollBody.getColWidth(columnIndex); @@ -4079,11 +4074,10 @@ public class VScrollTable extends FlowPanel * Returns column alignments for visible columns */ public char[] getColumnAlignments() { - final Iterator<Widget> it = visibleCells.iterator(); final char[] aligns = new char[visibleCells.size()]; int colIndex = 0; - while (it.hasNext()) { - aligns[colIndex++] = ((HeaderCell) it.next()).getAlign(); + for (Widget w : visibleCells) { + aligns[colIndex++] = ((HeaderCell) w).getAlign(); } return aligns; } @@ -5439,9 +5433,8 @@ public class VScrollTable extends FlowPanel public void moveCol(int oldIndex, int newIndex) { // loop all rows and move given index to its new place - final Iterator<?> rows = iterator(); - while (rows.hasNext()) { - final VScrollTableRow row = (VScrollTableRow) rows.next(); + for (Widget w : this) { + final VScrollTableRow row = (VScrollTableRow) w; final Element td = DOM.getChild(row.getElement(), oldIndex); if (td != null) { @@ -6921,7 +6914,6 @@ public class VScrollTable extends FlowPanel return; } - Iterator<Widget> headCells = tHead.iterator(); int usedMinimumWidth = 0; int totalExplicitColumnsWidths = 0; float expandRatioDivider = 0; @@ -6931,8 +6923,8 @@ public class VScrollTable extends FlowPanel int hierarchyColumnIndex = getHierarchyColumnIndex(); HeaderCell hierarchyHeaderInNeedOfFurtherHandling = null; - while (headCells.hasNext()) { - final HeaderCell hCell = (HeaderCell) headCells.next(); + for (Widget widget : tHead) { + final HeaderCell hCell = (HeaderCell) widget; boolean hasIndent = hierarchyColumnIndent > 0 && hCell.isHierarchyColumn(); if (hCell.isDefinedWidth()) { @@ -7049,12 +7041,10 @@ public class VScrollTable extends FlowPanel } // we have some space that can be divided optimally - HeaderCell hCell; colIndex = 0; - headCells = tHead.iterator(); int checksum = 0; - while (headCells.hasNext()) { - hCell = (HeaderCell) headCells.next(); + for (Widget widget : tHead) { + HeaderCell hCell = (HeaderCell) widget; if (hCell.isResizing) { continue; } @@ -7107,10 +7097,9 @@ public class VScrollTable extends FlowPanel * extra space is divided so if there is one then we give the * first undefined column 1 more pixel */ - headCells = tHead.iterator(); colIndex = 0; - while (headCells.hasNext()) { - HeaderCell hc = (HeaderCell) headCells.next(); + for (Widget widget : tHead) { + HeaderCell hc = (HeaderCell) widget; if (!hc.isResizing && !hc.isDefinedWidth()) { setColWidth(colIndex, hc.getWidthWithIndent() + availW - checksum, @@ -7554,12 +7543,11 @@ public class VScrollTable extends FlowPanel private Class<? extends Widget> getRowClass() { // get the row type this way to make dd work in derived // implementations - Iterator<Widget> iterator = scrollBody.iterator(); - if (iterator.hasNext()) { - return iterator.next().getClass(); - } else { - return null; + Iterator<Widget> it = scrollBody.iterator(); + if (it.hasNext()) { + return it.next().getClass(); } + return null; } @Override diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java index acfbb02d70..2dce082305 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java @@ -19,7 +19,6 @@ package com.vaadin.v7.client.ui; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -1016,9 +1015,8 @@ public class VTree extends FocusElementPanel List<TreeNode> nodes = new LinkedList<TreeNode>(); if (!isLeaf() && isChildrenLoaded()) { - Iterator<Widget> iter = childNodeContainer.iterator(); - while (iter.hasNext()) { - TreeNode node = (TreeNode) iter.next(); + for (Widget w : childNodeContainer) { + TreeNode node = (TreeNode) w; nodes.add(node); } } @@ -1489,10 +1487,8 @@ public class VTree extends FocusElementPanel endNode = temp; } - Iterator<TreeNode> childIter = children.iterator(); boolean startFound = false; - while (childIter.hasNext()) { - TreeNode node = childIter.next(); + for (TreeNode node : children) { if (node == startNode) { startFound = true; } 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 dc76d6cd2d..99caa8bf44 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 @@ -428,9 +428,8 @@ public class VTreeTable extends VScrollTable { @Override protected void calculateMaxIndent() { int maxIndent = 0; - Iterator<Widget> iterator = iterator(); - while (iterator.hasNext()) { - VTreeTableRow next = (VTreeTableRow) iterator.next(); + for (Widget w : this) { + VTreeTableRow next = (VTreeTableRow) w; maxIndent = Math.max(maxIndent, next.getIndent()); } this.maxIndent = maxIndent; @@ -442,10 +441,8 @@ public class VTreeTable extends VScrollTable { indentWidth = -1; return; } - Iterator<Widget> iterator = iterator(); - while (iterator.hasNext()) { - VTreeTableRow next = (VTreeTableRow) iterator.next(); - next.setIndent(); + for (Widget w : this) { + ((VTreeTableRow) w).setIndent(); } calculateMaxIndent(); } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java index 4d7d1631c2..b7e152c010 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/calendar/schedule/DayToolbar.java @@ -15,8 +15,6 @@ */ package com.vaadin.v7.client.ui.calendar.schedule; -import java.util.Iterator; - import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -158,9 +156,8 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler { } private void updateDayLabelSizedStyleNames() { - Iterator<Widget> it = iterator(); - while (it.hasNext()) { - updateWidgetSizedStyleName(it.next()); + for (Widget w : this) { + updateWidgetSizedStyleName(w); } } diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java index 091951bc8b..b4a00559b1 100644 --- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java +++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java @@ -16,7 +16,6 @@ package com.vaadin.v7.client.ui.table; import java.util.Collections; -import java.util.Iterator; import java.util.List; import com.google.gwt.core.client.Scheduler; @@ -190,7 +189,8 @@ public class TableConnector extends AbstractFieldConnector // Update child measure hint int childMeasureHint = uidl.hasAttribute("measurehint") - ? uidl.getIntAttribute("measurehint") : 0; + ? uidl.getIntAttribute("measurehint") + : 0; getWidget().setChildMeasurementHint( ChildMeasurementHint.values()[childMeasureHint]); @@ -451,9 +451,7 @@ public class TableConnector extends AbstractFieldConnector */ public void showSavedContextMenu(ContextMenuDetails savedContextMenu) { if (isEnabled() && savedContextMenu != null) { - Iterator<Widget> iterator = getWidget().scrollBody.iterator(); - while (iterator.hasNext()) { - Widget w = iterator.next(); + for (Widget w : getWidget().scrollBody) { VScrollTableRow row = (VScrollTableRow) w; if (row.getKey().equals(savedContextMenu.rowKey)) { row.showContextMenu(savedContextMenu.left, |