diff flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java @ 543:9c2cf4811a7d

Added a control to reset the zoom of a chart. In addition, the zoom buttons are displayed as ImgButtons now. flys-client/trunk@2049 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Jun 2011 08:20:22 +0000
parents ed29599e06e5
children 0f4095a522ab
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Fri Jun 03 06:34:32 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Fri Jun 03 08:20:22 2011 +0000
@@ -3,6 +3,7 @@
 import com.google.gwt.core.client.GWT;
 
 import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.ImgButton;
 import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.events.ClickEvent;
@@ -39,6 +40,8 @@
 
     protected ZoomboxControl zoombox;
 
+    protected ImgButton zoomToMaxExtent;
+
 
 
     public ChartToolbar(CollectionView view, ChartOutputTab chartTab) {
@@ -47,9 +50,10 @@
         this.view       = view;
         this.chartTab   = chartTab;
 
-        datacage = new Button(MSG.databasket());
-        position = new MousePositionPanel(chartTab);
-        zoombox  = new ZoomboxControl(chartTab);
+        datacage        = new Button(MSG.databasket());
+        position        = new MousePositionPanel(chartTab);
+        zoombox         = new ZoomboxControl(chartTab, MSG.zoom_in());
+        zoomToMaxExtent = new ImgButton();
 
         datacage.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent event) {
@@ -58,6 +62,22 @@
             }
         });
 
+        String baseUrl = GWT.getHostPageBaseURL();
+        zoomToMaxExtent.setSrc(baseUrl + MSG.zoom_all());
+        zoomToMaxExtent.setWidth(20);
+        zoomToMaxExtent.setHeight(20);
+        zoomToMaxExtent.setShowDown(false);
+        zoomToMaxExtent.setShowRollOver(false);
+        zoomToMaxExtent.setShowDisabled(false);
+        zoomToMaxExtent.setShowDisabledIcon(true);
+        zoomToMaxExtent.setShowDownIcon(false);
+        zoomToMaxExtent.setShowFocusedIcon(false);
+        zoomToMaxExtent.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                getChartOutputTab().resetRanges();
+            }
+        });
+
         zoombox.addZoomHandler(chartTab);
 
         initLayout();
@@ -69,6 +89,11 @@
     }
 
 
+    public ChartOutputTab getChartOutputTab() {
+        return chartTab;
+    }
+
+
     protected void initLayout() {
         setWidth100();
         setHeight(PANEL_HEIGHT);
@@ -82,6 +107,7 @@
         position.setWidth("200px");
 
         addMember(datacage);
+        addMember(zoomToMaxExtent);
         addMember(zoombox);
         addMember(spacer);
         addMember(position);

http://dive4elements.wald.intevation.org