diff flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java @ 1364:9981ba2ee13a

Display the datacage button in the map toolbar. flys-client/trunk@3063 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 24 Oct 2011 13:35:30 +0000
parents 45b9b1fc26e2
children 9aa1a453eed5
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java	Mon Oct 24 10:53:39 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapToolbar.java	Mon Oct 24 13:35:30 2011 +0000
@@ -4,11 +4,11 @@
 
 import com.smartgwt.client.types.SelectionType;
 import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.ImgButton;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
 
 import org.gwtopenmaps.openlayers.client.Map;
 import org.gwtopenmaps.openlayers.client.control.DragPan;
@@ -20,13 +20,14 @@
 import org.gwtopenmaps.openlayers.client.util.Attributes;
 
 import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.client.ui.Toolbar;
 import de.intevation.flys.client.client.utils.EnableDisableCmd;
 
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class MapToolbar extends HLayout {
+public class MapToolbar extends Toolbar {
 
     protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
@@ -35,6 +36,8 @@
     protected ZoomBox       zoomBox;
     protected SelectFeature selectFeature;
 
+    protected Button datacageButton;
+
     protected ImgButton zoomToMaxButton;
     protected ImgButton zoomBoxButton;
     protected ImgButton zoomOutButton;
@@ -49,13 +52,23 @@
     protected Canvas position;
 
 
-    public MapToolbar(FloodMap floodMap, Canvas wrapper) {
-        this(floodMap, wrapper, true);
+    public MapToolbar(MapOutputTab mapTab, FloodMap floodMap, Canvas wrapper) {
+        this(mapTab, floodMap, wrapper, true);
     }
 
 
     public MapToolbar(FloodMap floodMap, Canvas wrapper, boolean digitize) {
-        super();
+        this(null, floodMap, wrapper, digitize);
+    }
+
+
+    public MapToolbar(
+        MapOutputTab   mapTab,
+        FloodMap       floodMap,
+        Canvas         wrapper,
+        boolean        digitize)
+    {
+        super(mapTab);
 
         setWidth100();
         setHeight(30);
@@ -79,6 +92,11 @@
         removeButton    = createRemoveFeatureControl();
         elevationButton = createElevationControl();
 
+        if (mapTab != null) {
+            datacageButton = createDatacageControl();
+            addMember(datacageButton);
+        }
+
         addMember(zoomToMaxButton);
         addMember(zoomBoxButton);
         addMember(zoomOutButton);
@@ -443,5 +461,17 @@
 
         return new MeasureControl(floodMap, cmd);
     }
+
+
+    protected Button createDatacageControl() {
+        Button btn = new Button(MSG.databasket());
+        btn.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent evt) {
+                openDatacageWindow((MapOutputTab) getOutputTab());
+            }
+        });
+
+        return btn;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org