comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java @ 1490:15b4bc8eede0

#302 Improved input validation in WQ panels. flys-client/trunk@3576 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 03 Jan 2012 13:27:14 +0000
parents f98bd9b5cedd
children 360e22afb98b
comparison
equal deleted inserted replaced
1489:03649eb8933a 1490:15b4bc8eede0
146 stepItem.setValue(f.format(steps)); 146 stepItem.setValue(f.format(steps));
147 } 147 }
148 148
149 149
150 public boolean validateForm() { 150 public boolean validateForm() {
151 return 151 try {
152 validateForm(fromItem) && 152 return
153 validateForm(toItem) && 153 validateForm(fromItem) &&
154 validateForm(stepItem); 154 validateForm(toItem) &&
155 validateForm(stepItem);
156 }
157 catch (NumberFormatException nfe) {
158 return false;
159 }
155 } 160 }
156 161
157 /** 162 /**
158 * This method validates the entered text in the input fields. If 163 * This method validates the entered text in the input fields. If
159 * there are values that doesn't represent a valid float, an error is 164 * there are values that doesn't represent a valid float, an error is
213 /** 218 /**
214 * Returns the start value. 219 * Returns the start value.
215 * 220 *
216 * @return the start value. 221 * @return the start value.
217 */ 222 */
218 public double getFrom() { 223 public double getFrom() throws NullPointerException {
219 String v = getValueAsString(FIELD_FROM); 224 String v = getValueAsString(FIELD_FROM);
220 225
221 return getDouble(v); 226 return getDouble(v);
222 } 227 }
223 228
225 /** 230 /**
226 * Returns the end value. 231 * Returns the end value.
227 * 232 *
228 * @return the end value. 233 * @return the end value.
229 */ 234 */
230 public double getTo() { 235 public double getTo() throws NullPointerException {
231 String v = getValueAsString(FIELD_TO); 236 String v = getValueAsString(FIELD_TO);
232 237
233 return getDouble(v); 238 return getDouble(v);
234 } 239 }
235 240
237 /** 242 /**
238 * Returns the step width. 243 * Returns the step width.
239 * 244 *
240 * @return the step width. 245 * @return the step width.
241 */ 246 */
242 public double getStep() { 247 public double getStep() throws NullPointerException {
243 String v = getValueAsString(FIELD_WIDTH); 248 String v = getValueAsString(FIELD_WIDTH);
244 249
245 return getDouble(v); 250 return getDouble(v);
246 } 251 }
247 252

http://dive4elements.wald.intevation.org