Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/utils/Validator.java @ 1504:02a9104c0451
Implemented the validators more object oriented.
flys-client/trunk@3634 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 09 Jan 2012 17:29:56 +0000 |
parents | 2a8b5dcbe8ca |
children | c21d14e48040 |
line wrap: on
line source
package de.intevation.flys.client.client.utils; 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 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; } }