# HG changeset patch # User Felix Wolfsteller # Date 1340897588 0 # Node ID f0c7c52203c02f8cc04c7897a842299b4ca66e8e # Parent f978058dc835a61a247e96144877deab3ab5b99f Minor Manual WSP editor polish. flys-client/trunk@4829 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r f978058dc835 -r f0c7c52203c0 flys-client/ChangeLog --- 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 + + + * src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java: + Added basic validation + 2012-06-28 Felix Wolfsteller Improved manual line editor. diff -r f978058dc835 -r f0c7c52203c0 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java --- 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; } }