changeset 1422:25be27e33b77

#421 Ask the user before removing themes from chart or map. flys-client/trunk@3364 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 08 Dec 2011 06:51:20 +0000
parents d50c3262e638
children 204e085a9f1c
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/ThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java
diffstat 7 files changed, 53 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/ChangeLog	Thu Dec 08 06:51:20 2011 +0000
@@ -1,3 +1,18 @@
+2011-12-08  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue421 (Diagramm: Löschen eines Thema ohne Rückfrage beim Nutzer)
+
+	* 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 used when the user is asked if he is sure to remove selected
+	  themes.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java:
+	  Ask before removing themes.
+
 2011-12-06  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Thu Dec 08 06:51:20 2011 +0000
@@ -104,6 +104,8 @@
 
     String pan();
 
+    String askThemeRemove();
+
     String fix();
 
     String next();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Thu Dec 08 06:51:20 2011 +0000
@@ -135,6 +135,7 @@
 zoom_out = images/zoom-out.png
 zoom_back = images/zoom-back.png
 pan = images/pan.png
+askThemeRemove = Are you sure that you want to remove the selected theme / themes?
 
 discharge_curve = Discharge Curves at Gauges
 computed_discharge_curve = Discharge Curve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Thu Dec 08 06:51:20 2011 +0000
@@ -135,6 +135,7 @@
 zoom_out = images/zoom-out.png
 zoom_back = images/zoom-back.png
 pan = images/pan.png
+askThemeRemove = Sind Sie sicher, dass sie die gew\u00e4hlten / das gew\u00e4lte Thema l\u00f6eschen wollen?
 
 discharge_curve = Abflusskurven an Pegeln
 computed_discharge_curve = Abflusskurve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Thu Dec 08 06:51:20 2011 +0000
@@ -135,6 +135,7 @@
 zoom_out = images/zoom-out.png
 zoom_back = images/zoom-back.png
 pan = images/pan.png
+askThemeRemove = Are you sure that you want to remove the selected theme / themes?
 
 discharge_curve = Discharge Curves at Gauges
 computed_discharge_curve = Discharge Curve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Thu Dec 08 06:51:20 2011 +0000
@@ -7,6 +7,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import com.smartgwt.client.util.SC;
+import com.smartgwt.client.util.BooleanCallback;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
@@ -397,15 +398,21 @@
 
         remove.addClickHandler(new ClickHandler() {
             public void onClick(MenuItemClickEvent evt) {
-                for (ListGridRecord record: records) {
-                    FacetRecord facet = (FacetRecord) record;
+                SC.ask(MSG.askThemeRemove(), new BooleanCallback() {
+                    @Override
+                    public void execute(Boolean value) {
+                        if (value) {
+                            for (ListGridRecord record: records) {
+                                FacetRecord facet = (FacetRecord) record;
+                                Theme theme = facet.getTheme();
+                                theme.setVisible(0);
+                                theme.setActive(0);
 
-                    Theme theme = facet.getTheme();
-                    theme.setVisible(0);
-                    theme.setActive(0);
-                }
-
-                updateCollection();
+                                updateCollection();
+                            }
+                        }
+                    }
+                });
             }
         });
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Tue Dec 06 09:08:48 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java	Thu Dec 08 06:51:20 2011 +0000
@@ -2,6 +2,8 @@
 
 import com.google.gwt.core.client.GWT;
 
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.util.BooleanCallback;
 import com.smartgwt.client.types.ImageStyle;
 import com.smartgwt.client.types.ListGridFieldType;
 import com.smartgwt.client.types.VerticalAlignment;
@@ -259,18 +261,25 @@
         item.addClickHandler(new ClickHandler() {
             @Override
             public void onClick(MenuItemClickEvent evt) {
-                for (ListGridRecord record: records) {
-                    FacetRecord facet = (FacetRecord) record;
+                SC.ask(MSG.askThemeRemove(), new BooleanCallback() {
+                    @Override
+                    public void execute(Boolean value) {
+                        if (value) {
+                            for (ListGridRecord record: records) {
+                                FacetRecord facet = (FacetRecord) record;
 
-                    Theme theme = facet.getTheme();
-                    theme.setVisible(0);
-                    theme.setActive(0);
+                                Theme theme = facet.getTheme();
+                                theme.setVisible(0);
+                                theme.setActive(0);
 
-                    AttributedTheme at = (AttributedTheme) theme;
-                    getMapOutputTab().removeLayer(at.getAttr("layers"));
-                }
+                                AttributedTheme at = (AttributedTheme) theme;
+                                getMapOutputTab().removeLayer(at.getAttr("layers"));
+                            }
 
-                updateCollection();
+                            updateCollection();
+                        }
+                    }
+                });
             }
         });
 

http://dive4elements.wald.intevation.org