changeset 3352:2f533220af1c

Handle upcoming 'double' theme attribute type. flys-client/trunk@5034 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 18 Jul 2012 09:57:21 +0000
parents 24e9b5eb83f8
children 08f8524a81ad
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Jul 18 09:56:24 2012 +0000
+++ b/flys-client/ChangeLog	Wed Jul 18 09:57:21 2012 +0000
@@ -1,3 +1,8 @@
+2012-07-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Handle upcoming "double" theme attribute type.
+
 2012-07-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/utils/DoubleValidator.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Wed Jul 18 09:56:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Wed Jul 18 09:57:21 2012 +0000
@@ -18,6 +18,8 @@
 import com.smartgwt.client.widgets.form.fields.SelectItem;
 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
+import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
@@ -35,6 +37,8 @@
 import de.intevation.flys.client.shared.model.StyleSetting;
 import de.intevation.flys.client.shared.model.Theme;
 
+import de.intevation.flys.client.client.utils.DoubleValidator;
+
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -418,6 +422,22 @@
             c.setValue(rgbToHtml(value));
             f = c;
         }
+        else if (type.equals("double")) {
+            f = new FormItem(MSG.getString(name));
+            f.addBlurHandler(new BlurHandler() {
+                public void onBlur(BlurEvent e) {
+                     DoubleValidator validator = new DoubleValidator();
+                     Map errors = e.getForm().getErrors();
+                     if(validator.validate(e.getItem(), errors)) {
+                         e.getForm().setErrors(errors, true);
+                     }
+                     else {
+                         e.getForm().setErrors(errors, true);
+                     }
+                }
+            });
+
+        }
         else if (type.equals("Dash")) {
             f = new SelectItem(name, MSG.getString(name));
             LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();

http://dive4elements.wald.intevation.org