diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java @ 1542:3e2ef8e0a0dc

Issue 265. Deactivate measure control and scale line if the map output tab is not selected. flys-client/trunk@3761 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 25 Jan 2012 08:50:06 +0000
parents c39aa5a6478c
children c057ef91b268
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Wed Jan 25 08:42:46 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapOutputTab.java	Wed Jan 25 08:50:06 2012 +0000
@@ -13,6 +13,8 @@
 import com.smartgwt.client.widgets.events.ResizedHandler;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
+import com.smartgwt.client.widgets.tab.events.TabSelectedEvent;
 
 import org.gwtopenmaps.openlayers.client.Bounds;
 import org.gwtopenmaps.openlayers.client.Map;
@@ -61,7 +63,7 @@
 
 public class MapOutputTab
 extends      OutputTab
-implements   RedrawRequestHandler, ExternalWMSWindow.LayerLoader {
+implements   RedrawRequestHandler, ExternalWMSWindow.LayerLoader, TabSelectedHandler {
 
     public static final String DEFAULT_SRID = "4326";
 
@@ -99,6 +101,8 @@
     ){
         super(title, collection, collectionView, mode);
 
+        collectionView.registerTabHandler(this);
+
         mapService.doOut(collection, new AsyncCallback<MapConfig>() {
                 public void onFailure(Throwable caught) {
                     GWT.log("MAP ERROR: " + caught.getMessage());
@@ -537,5 +541,19 @@
             }
         );
     }
+
+
+    public void onTabSelected(TabSelectedEvent tse) {
+        if(floodMap == null) {
+            return;
+        }
+        if(this.equals(tse.getTab())) {
+            floodMap.activateScaleLine(true);
+        }
+        else {
+            controlPanel.activateMeasureControl(false);
+            floodMap.activateScaleLine(false);
+        }
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org