diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 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 c39aa5a6478c
line wrap: on
line diff
--- 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