diff flys-client/src/main/java/de/intevation/flys/client/client/utils/Validator.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
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/utils/Validator.java	Mon Jan 09 18:06:01 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/utils/Validator.java	Wed Jan 11 10:21:22 2012 +0000
@@ -2,47 +2,15 @@
 
 import java.util.Map;
 
-import com.google.gwt.core.client.GWT;
-
-import com.smartgwt.client.widgets.form.DynamicForm;
 import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-
-import de.intevation.flys.client.client.FLYSConstants;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  *
  * This validator is used for SmartGWT FormItems.
- *
- * To use this validator an attribute named 'internalType' has to be set.
- * Values for 'internalType':
- *   'double'
- *   'integer'
  */
-public class Validator implements ChangedHandler {
-
-    /** The interface that provides i18n messages. */
-    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
-
+public interface Validator {
 
-    /**
-     *
-     */
-    public void onChanged(ChangedEvent e) {
-        FormItem item = e.getItem();
-        DynamicForm form = e.getForm();
-        Map errors = form.getErrors();
-        String type = item.getAttribute("internalType");
-
-        validate(item, errors);
-        form.setErrors(errors, true);
-    }
-
-
-    protected boolean validate(FormItem item, Map errors) {
-        return true;
-    }
+    boolean validate(FormItem item, Map errors);
 }
 

http://dive4elements.wald.intevation.org