changeset 6100:de92e0cdebdc

GWT client: Removed some Iterator cruft.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sat, 25 May 2013 16:58:27 +0200
parents 96b5066ab55e
children a0078e5e3b39
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java
diffstat 5 files changed, 22 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java	Sat May 25 16:18:28 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java	Sat May 25 16:58:27 2013 +0200
@@ -44,7 +44,6 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -242,13 +241,10 @@
         List<String> errors = new ArrayList<String>();
         NumberFormat nf     = NumberFormat.getDecimalFormat();
 
-        Iterator<String> iter = wqranges.keySet().iterator();
+        for (Map.Entry<String, DoubleArrayPanel> entry: wqranges.entrySet()) {
 
-        while (iter.hasNext()) {
-            List<String> tmpErrors = new ArrayList<String>();
-
-            String           key = iter.next();
-            DoubleArrayPanel dap = wqranges.get(key);
+            String           key = entry.getKey();
+            DoubleArrayPanel dap = entry.getValue();
 
             if (!dap.validateForm()) {
                 errors.add(MSG.error_invalid_double_value());
@@ -261,6 +257,7 @@
                 continue;
             }
 
+            List<String> tmpErrors = new ArrayList<String>();
             double[] values = dap.getInputValues();
             // might geht npe here if one field not filled
             double[] good   = new double[values.length];
@@ -362,10 +359,9 @@
     protected Data getWQValues() {
         String wqvalue = null;
 
-        Iterator<String> iter = wqranges.keySet().iterator();
-        while (iter.hasNext()) {
-            String           key = iter.next();
-            DoubleArrayPanel dap = wqranges.get(key);
+        for (Map.Entry<String, DoubleArrayPanel> entry: wqranges.entrySet()) {
+            String           key = entry.getKey();
+            DoubleArrayPanel dap = entry.getValue();
 
             double[] values = dap.getInputValues();
             if (wqvalue == null) {
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java	Sat May 25 16:18:28 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java	Sat May 25 16:58:27 2013 +0200
@@ -31,7 +31,6 @@
 import org.dive4elements.river.client.shared.model.DefaultDataItem;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -260,14 +259,13 @@
     @Override
     protected Data[] getData() {
         Map<?,?> values  = form.getValues();
-        Iterator<?> keys = values.keySet().iterator();
 
         Data[] list = new Data[values.size()];
         int       i = 0;
 
-        while (keys.hasNext()) {
-            String fieldname = ((String) keys.next()).replace('_', ' ');
-            String selection = (String) values.get(fieldname);
+        for (Map.Entry<?, ?> entry: values.entrySet()) {
+            String fieldname = ((String)entry.getKey()).replace('_', ' ');
+            String selection = (String)entry.getValue();
 
             DataItem item    = new DefaultDataItem(fieldname, null, selection);
 
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java	Sat May 25 16:18:28 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java	Sat May 25 16:58:27 2013 +0200
@@ -49,7 +49,6 @@
 import org.dive4elements.river.client.shared.model.Theme;
 
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
@@ -196,9 +195,7 @@
                     LinkedHashMap<String, String> valueMap =
                         new LinkedHashMap<String, String>();
                     valueMap.put("aktuell", "Aktuell");
-                    Iterator<String> iter = keys.iterator();
-                    while (iter.hasNext()) {
-                        String s = iter.next().toString();
+                    for (String s: keys) {
                         Style tmp = styleGroups.get(s);
                         tmp.setFacet(current.getFacet());
                         tmp.setIndex(current.getIndex());
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java	Sat May 25 16:18:28 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java	Sat May 25 16:58:27 2013 +0200
@@ -51,7 +51,6 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -220,7 +219,6 @@
                         return;
                     }
 
-                    int    idx = e.getColNum();
                     Record r   = e.getRecord();
                     double val = r.getAttributeAsDouble("value");
 
@@ -385,13 +383,10 @@
         List<String> errors = new ArrayList<String>();
         NumberFormat nf     = NumberFormat.getDecimalFormat();
 
-        Iterator<String> iter = wqranges.keySet().iterator();
+        for (Map.Entry<String, DoubleArrayPanel> entry: wqranges.entrySet()) {
 
-        while (iter.hasNext()) {
-            List<String> tmpErrors = new ArrayList<String>();
-
-            String           key = iter.next();
-            DoubleArrayPanel dap = wqranges.get(key);
+            String           key = entry.getKey();
+            DoubleArrayPanel dap = entry.getValue();
 
             if (!dap.validateForm()) {
                 errors.add(MSG.error_invalid_double_value());
@@ -409,6 +404,7 @@
 
             int idx = 0;
 
+            List<String> tmpErrors = new ArrayList<String>();
             for (double value: values) {
                 if (value < mm[0] || value > mm[1]) {
                     String tmp = MSG.error_validate_range();
@@ -697,10 +693,9 @@
     protected Data getWQValues() {
         String wqvalue = null;
 
-        Iterator<String> iter = wqranges.keySet().iterator();
-        while (iter.hasNext()) {
-            String           key = iter.next();
-            DoubleArrayPanel dap = wqranges.get(key);
+        for (Map.Entry<String, DoubleArrayPanel> entry: wqranges.entrySet()) {
+            String           key = entry.getKey();
+            DoubleArrayPanel dap = entry.getValue();
             String label = dap.getItemTitle();
 
             double[] values = dap.getInputValues();
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java	Sat May 25 16:18:28 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java	Sat May 25 16:58:27 2013 +0200
@@ -23,7 +23,6 @@
 import org.dive4elements.river.client.shared.model.DefaultDataItem;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -145,15 +144,14 @@
 
     @Override
     public Data[] getData() {
-        Map values    = form.getValues();
-        Iterator keys = values.keySet().iterator();
+        Map<?, ?> values = form.getValues();
 
         Data[] list = new Data[values.size()];
         int       i = 0;
 
-        while (keys.hasNext()) {
-            String fieldname = (String) keys.next();
-            String selection = (String) values.get(fieldname);
+        for (Map.Entry<?, ?>entry: values.entrySet()) {
+            String fieldname = (String)entry.getKey();
+            String selection = (String)entry.getValue();
 
             DataItem item    = new DefaultDataItem(fieldname, null, selection);
 

http://dive4elements.wald.intevation.org