changeset 544:0f4095a522ab

Added a zoom-out control to the chart toolbar which zooms 10% of the current ranges out. flys-client/trunk@2051 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 03 Jun 2011 12:18:03 +0000
parents 9c2cf4811a7d
children 27fb059da15f
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/chart/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java
diffstat 7 files changed, 60 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/ChangeLog	Fri Jun 03 12:18:03 2011 +0000
@@ -1,3 +1,20 @@
+2011-06-03  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
+	  Added a method that allows zooming out for a specified factor (between
+	  0-100).
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
+	  Added a button to zoom out 10%.
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+
+	* src/main/webapp/images/zoom-out.png: New. The icon for the zoom-out
+	  control.
+
 2011-06-03  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Jun 03 12:18:03 2011 +0000
@@ -74,6 +74,8 @@
 
     String zoom_in();
 
+    String zoom_out();
+
     String fix();
 
     String next();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Jun 03 12:18:03 2011 +0000
@@ -73,6 +73,7 @@
 theme_bottom = images/theme_bottom.png
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
+zoom_out = images/zoom-out.png
 
 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	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Jun 03 12:18:03 2011 +0000
@@ -73,6 +73,7 @@
 theme_bottom = images/theme_bottom.png
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
+zoom_out = images/zoom-out.png
 
 discharge_curve = Abflusskurven an Pegeln
 computed_discharge_curve = Abflusskurve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Jun 03 12:18:03 2011 +0000
@@ -73,6 +73,7 @@
 theme_bottom = images/theme_bottom.png
 zoom_all = images/zoom-1.png
 zoom_in = images/zoom-in.png
+zoom_out = images/zoom-out.png
 
 discharge_curve = Discharge Curves at Gauges
 computed_discharge_curve = Discharge Curve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Jun 03 12:18:03 2011 +0000
@@ -171,6 +171,25 @@
 
 
     /**
+     * This method is used to zoom out.
+     *
+     * @param factor The factor should be between 0-100.
+     */
+    public void zoomOut(int factor) {
+        if (factor < 0 || factor > 100 || xrange == null || yrange == null) {
+            return;
+        }
+
+        xrange[0] -= xrange[0] / 100 * factor;
+        xrange[1] += xrange[1] / 100 * factor;
+        yrange[0] -= yrange[0] / 100 * factor;
+        yrange[1] += yrange[1] / 100 * factor;
+
+        updateChartPanel();
+    }
+
+
+    /**
      * Updates the Transform2D object using the chart info service.
      */
     public void updateTransformer() {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Fri Jun 03 08:20:22 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java	Fri Jun 03 12:18:03 2011 +0000
@@ -42,6 +42,8 @@
 
     protected ImgButton zoomToMaxExtent;
 
+    protected ImgButton zoomOut;
+
 
 
     public ChartToolbar(CollectionView view, ChartOutputTab chartTab) {
@@ -54,6 +56,7 @@
         position        = new MousePositionPanel(chartTab);
         zoombox         = new ZoomboxControl(chartTab, MSG.zoom_in());
         zoomToMaxExtent = new ImgButton();
+        zoomOut         = new ImgButton();
 
         datacage.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent event) {
@@ -78,6 +81,21 @@
             }
         });
 
+        zoomOut.setSrc(baseUrl + MSG.zoom_out());
+        zoomOut.setWidth(20);
+        zoomOut.setHeight(20);
+        zoomOut.setShowDown(false);
+        zoomOut.setShowRollOver(false);
+        zoomOut.setShowDisabled(false);
+        zoomOut.setShowDisabledIcon(true);
+        zoomOut.setShowDownIcon(false);
+        zoomOut.setShowFocusedIcon(false);
+        zoomOut.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                getChartOutputTab().zoomOut(10);
+            }
+        });
+
         zoombox.addZoomHandler(chartTab);
 
         initLayout();
@@ -108,6 +126,7 @@
 
         addMember(datacage);
         addMember(zoomToMaxExtent);
+        addMember(zoomOut);
         addMember(zoombox);
         addMember(spacer);
         addMember(position);

http://dive4elements.wald.intevation.org