changeset 1447:c4bc320e3d44

Bugfix: make sure that the user has selected a DEM before feeding the Artifact with it. flys-client/trunk@3463 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 19 Dec 2011 10:13:12 +0000
parents 4c5006fecd8d
children c39aa5a6478c
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/DemDatacagePanel.java
diffstat 6 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/ChangeLog	Mon Dec 19 10:13:12 2011 +0000
@@ -1,3 +1,15 @@
+2011-12-19  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java: Added
+	  strings that force the user to select a DEM.
+	  
+	* src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java:
+	  Override validate() to make sure, that the user has selected a DEM.
+	  Otherwise, a popup is displayed.
+
 2011-12-19  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Mon Dec 19 10:13:12 2011 +0000
@@ -554,6 +554,8 @@
 
     String zoomToLayer();
 
+    String requireDGM();
+
     // data cage
 
     String old_calculations();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Mon Dec 19 10:13:12 2011 +0000
@@ -284,6 +284,7 @@
 measureArea = Measure area
 map_themepanel_header_style = Style
 zoomToLayer = Layer-Zoom
+requireDGM = You need to choose a DEM.
 
 # data cage
 old_calculations = Former Calculations
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Mon Dec 19 10:13:12 2011 +0000
@@ -284,6 +284,7 @@
 measureArea = Streckenmessung
 map_themepanel_header_style = Stil
 zoomToLayer = Layer-Zoom
+requireDGM = Sie m\u00fcssen ein DGM ausw\u00e4hlen.
 
 # data cage
 old_calculations = Fr\u00fchere Berechnungen
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Mon Dec 19 10:13:12 2011 +0000
@@ -284,6 +284,7 @@
 measureArea = Measure area
 map_themepanel_header_style = Style
 zoomToLayer = Layer-Zoom
+requireDGM = You need to choose a DEM.
 
 # data cage
 old_calculations = Former Calculations
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java	Mon Dec 19 09:53:45 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java	Mon Dec 19 10:13:12 2011 +0000
@@ -1,5 +1,6 @@
 package de.intevation.flys.client.client.ui;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import de.intevation.flys.client.shared.model.Data;
@@ -53,6 +54,19 @@
 
 
     @Override
+    public List<String> validate() {
+        List<String> errors = new ArrayList<String>();
+
+        Recommendation r = getSelectedRecommendation();
+        if (r == null) {
+            errors.add(MSG.requireDGM());
+        }
+
+        return errors;
+    }
+
+
+    @Override
     protected Data[] getData() {
         Recommendation r = getSelectedRecommendation();
 
@@ -66,7 +80,7 @@
         ToLoad toLoad = widget.getSelection();
         List<Recommendation> recoms = toLoad.toRecommendations();
 
-        return recoms.get(0);
+        return recoms != null && recoms.size() >= 1 ? recoms.get(0) : null;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org