Mercurial > dive4elements > river
annotate 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 |
rev | line source |
---|---|
1500 | 1 package de.intevation.flys.client.client.utils; |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
2 |
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
3 import java.util.Map; |
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
4 |
1500 | 5 import com.google.gwt.core.client.GWT; |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
6 |
1500 | 7 import com.smartgwt.client.widgets.form.DynamicForm; |
8 import com.smartgwt.client.widgets.form.fields.FormItem; | |
9 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; | |
10 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; | |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
11 |
1500 | 12 import de.intevation.flys.client.client.FLYSConstants; |
13 | |
14 /** | |
15 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> | |
16 * | |
17 * This validator is used for SmartGWT FormItems. | |
18 * | |
19 * To use this validator an attribute named 'internalType' has to be set. | |
20 * Values for 'internalType': | |
21 * 'double' | |
22 * 'integer' | |
23 */ | |
24 public class Validator implements ChangedHandler { | |
25 | |
26 /** The interface that provides i18n messages. */ | |
27 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
28 | |
29 | |
30 /** | |
31 * | |
32 */ | |
33 public void onChanged(ChangedEvent e) { | |
34 FormItem item = e.getItem(); | |
35 DynamicForm form = e.getForm(); | |
36 Map errors = form.getErrors(); | |
37 String type = item.getAttribute("internalType"); | |
38 | |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
39 validate(item, errors); |
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
40 form.setErrors(errors, true); |
1500 | 41 } |
42 | |
43 | |
1504
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
44 protected boolean validate(FormItem item, Map errors) { |
02a9104c0451
Implemented the validators more object oriented.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1500
diff
changeset
|
45 return true; |
1500 | 46 } |
47 } | |
48 |