Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java @ 4131:360e22afb98b
Cosmetics, warnings and minor TODOs.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 15 Oct 2012 00:04:35 +0200 |
parents | 15b4bc8eede0 |
children |
comparison
equal
deleted
inserted
replaced
4130:df8ac7ff6b1a | 4131:360e22afb98b |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | |
3 import java.util.Map; | |
4 | 2 |
5 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
6 import com.google.gwt.i18n.client.NumberFormat; | 4 import com.google.gwt.i18n.client.NumberFormat; |
7 | 5 |
8 import com.smartgwt.client.types.Alignment; | 6 import com.smartgwt.client.types.Alignment; |
12 import com.smartgwt.client.widgets.form.fields.StaticTextItem; | 10 import com.smartgwt.client.widgets.form.fields.StaticTextItem; |
13 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; | 11 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
14 | 12 |
15 import de.intevation.flys.client.client.FLYSConstants; | 13 import de.intevation.flys.client.client.FLYSConstants; |
16 | 14 |
15 import java.util.Map; | |
17 | 16 |
18 | 17 |
19 /** | 18 /** |
20 * This class creates a DynamicForm with three input fields. | 19 * This class creates a DynamicForm with three input fields. |
21 * | 20 * |
164 * there are values that doesn't represent a valid float, an error is | 163 * there are values that doesn't represent a valid float, an error is |
165 * displayed. | 164 * displayed. |
166 * | 165 * |
167 * @param item The FormItem. | 166 * @param item The FormItem. |
168 */ | 167 */ |
168 @SuppressWarnings("unchecked") | |
169 protected boolean validateForm(FormItem item) { | 169 protected boolean validateForm(FormItem item) { |
170 if (item instanceof StaticTextItem) { | 170 if (item instanceof StaticTextItem) { |
171 return true; | 171 return true; |
172 } | 172 } |
173 | 173 |
174 boolean valid = true; | 174 boolean valid = true; |
175 | 175 |
176 String v = (String) item.getValue(); | 176 String v = (String) item.getValue(); |
177 | 177 |
178 NumberFormat f = NumberFormat.getDecimalFormat(); | 178 NumberFormat f = NumberFormat.getDecimalFormat(); |
179 @SuppressWarnings("rawtypes") | |
179 Map errors = getErrors(); | 180 Map errors = getErrors(); |
180 | 181 |
181 try { | 182 try { |
182 if (v == null) { | 183 if (v == null) { |
183 throw new NumberFormatException("empty"); | 184 throw new NumberFormatException("empty"); |
184 } | 185 } |
185 | 186 |
186 double value = f.parse(v); | 187 f.parse(v); |
187 | 188 |
188 errors.remove(item.getFieldName()); | 189 errors.remove(item.getFieldName()); |
189 } | 190 } |
190 catch (NumberFormatException nfe) { | 191 catch (NumberFormatException nfe) { |
191 errors.put(item.getFieldName(), MESSAGES.wrongFormat()); | 192 errors.put(item.getFieldName(), MESSAGES.wrongFormat()); |