changeset 2928:f0c7c52203c0

Minor Manual WSP editor polish. flys-client/trunk@4829 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Jun 2012 15:33:08 +0000
parents f978058dc835
children 0ef4753e5515
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Jun 28 14:50:05 2012 +0000
+++ b/flys-client/ChangeLog	Thu Jun 28 15:33:08 2012 +0000
@@ -1,3 +1,9 @@
+2012-06-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java:
+	  Added basic validation
+
 2012-06-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	Improved manual line editor.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java	Thu Jun 28 14:50:05 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java	Thu Jun 28 15:33:08 2012 +0000
@@ -1,6 +1,7 @@
 package de.intevation.flys.client.client.ui.chart;
 
 import java.util.List;
+import java.util.Map;
 
 import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONNumber;
@@ -18,8 +19,9 @@
 import com.smartgwt.client.widgets.Label;
 import com.google.gwt.i18n.client.NumberFormat;
 
-import com.smartgwt.client.widgets.grid.CellEditValueParser;
-import com.smartgwt.client.widgets.grid.CellEditValueFormatter;
+import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
+import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
+
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
 
@@ -52,6 +54,7 @@
 import com.smartgwt.client.widgets.form.DynamicForm; 
 import com.smartgwt.client.widgets.form.fields.FormItem; 
 import com.smartgwt.client.widgets.form.fields.TextItem;
+import de.intevation.flys.client.client.utils.DoubleValidator;
 
 
 /**
@@ -193,6 +196,18 @@
         valueInputPanel = new TextItem();
         valueInputPanel.setTitle(yAxis);
         valueInputPanel.setShowTitle(true);
+        valueInputPanel.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);
+                 }
+            }
+        });
         nameInputPanel = new TextItem();
         nameInputPanel.setTitle(MSG.pointname());
         nameInputPanel.setShowTitle(true);
@@ -313,8 +328,8 @@
         final Label standByLabel = new Label(MSG.standby());
         addItem(standByLabel);
 
-        setWidth(380);
-        setHeight(470);
+        setWidth(360);
+        setHeight(120);
         centerInPage();
 
         Config config = Config.getInstance();
@@ -352,6 +367,7 @@
     protected boolean isDialogValid() {
         boolean valid = true;
         // TODO implement
+        // 
         return valid;
     }
 }

http://dive4elements.wald.intevation.org