comparison flys-client/src/main/java/de/intevation/flys/client/client/utils/IntegerValidator.java @ 1507:c21d14e48040

Improved validation and property handling. flys-client/trunk@3645 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Jan 2012 10:21:22 +0000
parents 02a9104c0451
children
comparison
equal deleted inserted replaced
1506:339f8aa641b5 1507:c21d14e48040
1 package de.intevation.flys.client.client.utils; 1 package de.intevation.flys.client.client.utils;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
5 import com.google.gwt.core.client.GWT;
6
5 import com.smartgwt.client.widgets.form.fields.FormItem; 7 import com.smartgwt.client.widgets.form.fields.FormItem;
8
9 import de.intevation.flys.client.client.FLYSConstants;
6 10
7 /** 11 /**
8 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> 12 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
9 */ 13 */
10 public class IntegerValidator extends Validator { 14 public class IntegerValidator implements Validator {
15
16 /** The interface that provides i18n messages. */
17 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
11 18
12 /** 19 /**
13 * 20 *
14 */ 21 */
15 @Override 22 public boolean validate(FormItem item, Map errors) {
16 protected boolean validate(FormItem item, Map errors) {
17 boolean valid = true; 23 boolean valid = true;
18 24
19 String v = (String) item.getValue(); 25 String v = item.getValue().toString();
20 26
21 try { 27 try {
22 if (v == null) { 28 if (v == null) {
23 throw new NumberFormatException("empty"); 29 throw new NumberFormatException("empty");
24 } 30 }

http://dive4elements.wald.intevation.org