[Dive4elements-commits] [PATCH] GWT client: Removed some Iterator cruft
Wald Commits
scm-commit at wald.intevation.org
Sat May 25 16:58:48 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1369493907 -7200
# Node ID de92e0cdebdcdc0d1690c13daf7eff9e7d230d4b
# Parent 96b5066ab55eb687250475079e036258360094db
GWT client: Removed some Iterator cruft.
diff -r 96b5066ab55e -r de92e0cdebdc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/QSegmentedInputPanel.java
--- 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) {
diff -r 96b5066ab55e -r de92e0cdebdc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/SelectProvider.java
--- 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);
diff -r 96b5066ab55e -r de92e0cdebdc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java
--- 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());
diff -r 96b5066ab55e -r de92e0cdebdc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/WQAdaptedInputPanel.java
--- 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();
diff -r 96b5066ab55e -r de92e0cdebdc gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java
--- 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);
More information about the Dive4elements-commits
mailing list