changeset 4130:df8ac7ff6b1a

Improve warning when user does not select a waterlevel calculation (#914)
author Christian Lins <christian.lins@intevation.de>
date Sun, 14 Oct 2012 14:44:28 +0200
parents 989f6f0d1986
children 360e22afb98b
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java
diffstat 6 files changed, 38 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/ChangeLog	Sun Oct 14 14:44:28 2012 +0200
@@ -1,3 +1,12 @@
+2012-10-14	Christian Lins	<christian.lins@intevation.de>
+
+	* flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java:
+	  Improve warning when user does not select a waterlevel calculation (#914).
+
 2012-10-14	Christian Lins	<christian.lins@intevation.de>
 
 	* flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Sun Oct 14 14:44:28 2012 +0200
@@ -58,6 +58,8 @@
 
     String warning_language();
 
+    String warning_no_wsp_selected();
+
     String no_projects();
 
     String load_projects();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Sun Oct 14 14:44:28 2012 +0200
@@ -349,6 +349,8 @@
 error_values_needed = You must provide values.
 error_no_module_found = No modules found
 
+warning_no_wsp_selected = No waterlevel selected!
+
 ## map related strings
 digitize = images/digitize.png
 pipe1 = Pipe1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Sun Oct 14 14:44:28 2012 +0200
@@ -348,6 +348,8 @@
 error_values_needed = Es muss mindestens ein Wert selektiert sein.
 error_no_module_found = Keine nutzbaren Module gefunden.
 
+warning_no_wsp_selected = Kein Wasserstand ausgew\u00e4hlt!
+
 ## map related strings
 digitize = images/digitize.png
 pipe1 = Rohr1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Sun Oct 14 14:44:28 2012 +0200
@@ -349,6 +349,8 @@
 error_values_needed = You must provide values.
 error_no_module_found = No modules found
 
+warning_no_wsp_selected = No waterlevel selected!
+
 ## map related strings
 digitize = images/digitize.png
 pipe1 = Pipe1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java	Sun Oct 14 11:21:27 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java	Sun Oct 14 14:44:28 2012 +0200
@@ -1,15 +1,17 @@
 package de.intevation.flys.client.client.ui;
 
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import com.smartgwt.client.util.SC;
 import com.smartgwt.client.widgets.events.ClickEvent;
 
+import de.intevation.flys.client.client.Config;
+import de.intevation.flys.client.client.FLYS;
+import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.client.event.StepForwardEvent;
+import de.intevation.flys.client.client.services.LoadArtifactService;
+import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.Data;
@@ -22,15 +24,15 @@
 import de.intevation.flys.client.shared.model.ToLoad;
 import de.intevation.flys.client.shared.model.User;
 
-import de.intevation.flys.client.client.Config;
-import de.intevation.flys.client.client.FLYSConstants;
-import de.intevation.flys.client.client.event.StepForwardEvent;
-import de.intevation.flys.client.client.services.LoadArtifactService;
-import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 
 public class WspDatacagePanel extends DatacagePanel {
 
+    private static final long serialVersionUID = 2494432743877141135L;
+
     public static final String WATERLEVEL_OUTS = "waterlevels";
 
     public static final FLYSConstants MSG = GWT.create(FLYSConstants.class);
@@ -83,14 +85,23 @@
             final  Collection c     = this.collection;
             final  Recommendation r = getSelectedRecommendation();
 
+
+            if (r == null) {
+                SC.warn(MSG.warning_no_wsp_selected());
+                return;
+            }
+
             // 2) Create, load Artifact and fire event
             loadService.load(
                 c, r, "winfo", locale,
                 new AsyncCallback<Artifact>() {
+                    @Override
                     public void onFailure(Throwable caught) {
-                        SC.warn(caught.getMessage());
+                        GWT.log("WspDatacagePanel", caught);
+                        SC.warn(FLYS.getExceptionString(MSG, caught));
                     }
 
+                    @Override
                     public void onSuccess(Artifact artifact) {
                         fireStepForwardEvent(new StepForwardEvent(
                             getData(r, artifact)));

http://dive4elements.wald.intevation.org