Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java @ 4568:bbd82bd8e541
flys-client: Cosmetics and warnings.
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 19 Nov 2012 00:07:53 +0100 |
parents | 22f39c2d7a72 |
children |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java Sun Nov 18 01:19:07 2012 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualWSPEditor.java Mon Nov 19 00:07:53 2012 +0100 @@ -1,50 +1,34 @@ package de.intevation.flys.client.client.ui.chart; import com.google.gwt.core.client.GWT; - import com.google.gwt.i18n.client.NumberFormat; - import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONNumber; import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONString; - import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.types.Alignment; - import com.smartgwt.client.util.SC; - import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.Window; - import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; - import com.smartgwt.client.widgets.form.DynamicForm; - import com.smartgwt.client.widgets.form.fields.TextItem; - import com.smartgwt.client.widgets.form.fields.events.BlurEvent; import com.smartgwt.client.widgets.form.fields.events.BlurHandler; - import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; - import de.intevation.flys.client.client.event.RedrawRequestEvent; import de.intevation.flys.client.client.event.RedrawRequestHandler; - -import de.intevation.flys.client.client.services.FeedService; import de.intevation.flys.client.client.services.FeedServiceAsync; -import de.intevation.flys.client.client.services.LoadArtifactService; import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; - import de.intevation.flys.client.client.utils.DoubleValidator; - import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.CollectionItem; @@ -73,7 +57,7 @@ /** Name of the main data item to be fed. */ public static final String LINE_DATA = "manualpoints.lines"; - /** When we chaged something, we need a RedrawRequest(Handler). */ + /** When we change something, we need a RedrawRequest(Handler). */ protected RedrawRequestHandler redrawRequestHandler; /** The collection */ @@ -127,7 +111,7 @@ for (int i = 0; i < size; i++) { CollectionItem item = collection.getItem(i); - String dataValue = (String) item.getData().get(dataItemName); + String dataValue = item.getData().get(dataItemName); if (dataValue != null) { // Found it. uuid = item.identifier(); @@ -158,13 +142,12 @@ /** Create and setup/add the ui. */ public void createUI() { - Config config = Config.getInstance(); - Button accept = new Button(MSG.label_ok()); Button cancel = new Button(MSG.label_cancel()); cancel.addClickHandler(this); accept.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent e) { okClicked(); } @@ -200,6 +183,7 @@ valueInputPanel.setTitle(yAxis); valueInputPanel.setShowTitle(true); valueInputPanel.addBlurHandler(new BlurHandler() { + @Override public void onBlur(BlurEvent e) { DoubleValidator validator = new DoubleValidator(); Map errors = e.getForm().getErrors(); @@ -248,7 +232,6 @@ oldLines = new JSONArray(); } - int idx = 0; double val; if (valueInputPanel.getValue() == null) return oldLines; @@ -258,7 +241,7 @@ val = d; } catch(NumberFormatException nfe) { - SC.warn("fehler... nfe... TODO"); + GWT.log("fehler... nfe... TODO"); return oldLines; } @@ -299,11 +282,13 @@ new DefaultArtifact(uuid, "TODO:hash"), feedData, new AsyncCallback<Artifact>() { + @Override public void onFailure(Throwable caught) { GWT.log("Could not feed artifact with lines."); SC.warn(MSG.getString(caught.getMessage())); enable(); } + @Override public void onSuccess(Artifact fartifact) { GWT.log("Successfully set lines "); redrawRequestHandler.onRedrawRequest( @@ -337,9 +322,11 @@ "manualpoints", locale, new AsyncCallback<Artifact>() { + @Override public void onFailure(Throwable caught) { GWT.log("Creating manualpoint artifact failed!"); } + @Override public void onSuccess(Artifact artifact) { GWT.log("Successfully created artifact."); removeItem(standByLabel); @@ -354,6 +341,7 @@ * This method is called when the user aborts point editing. * @param event The event. */ + @Override public void onClick(ClickEvent event) { this.destroy(); }