Mercurial > dive4elements > river
changeset 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
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri Jun 03 06:34:32 2011 +0000 +++ b/flys-client/ChangeLog Fri Jun 03 08:20:22 2011 +0000 @@ -1,3 +1,25 @@ +2011-06-03 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + New method to reset the zoom. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + Added a button that resets the zoom and triggers an update of the chart. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java: + This control inherits from ImgButton now. The icon displayed for this + control is the same as in the desktop version of this software. + + * 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: + Added links to zoom button images. + + * src/main/webapp/images/zoom-in_Selected.png, + src/main/webapp/images/zoom-1.png, + src/main/webapp/images/zoom-in.png: Images used for the zoom buttons. + 2011-06-03 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/server/ChartOutputServiceImpl.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Fri Jun 03 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Fri Jun 03 08:20:22 2011 +0000 @@ -70,6 +70,10 @@ String theme_bottom(); + String zoom_all(); + + String zoom_in(); + String fix(); String next();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Fri Jun 03 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Fri Jun 03 08:20:22 2011 +0000 @@ -71,6 +71,8 @@ theme_up = images/theme_up.png theme_down = images/theme_down.png theme_bottom = images/theme_bottom.png +zoom_all = images/zoom-1.png +zoom_in = images/zoom-in.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 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Fri Jun 03 08:20:22 2011 +0000 @@ -71,6 +71,8 @@ theme_up = images/theme_up.png theme_down = images/theme_down.png theme_bottom = images/theme_bottom.png +zoom_all = images/zoom-1.png +zoom_in = images/zoom-in.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 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Fri Jun 03 08:20:22 2011 +0000 @@ -71,6 +71,8 @@ theme_up = images/theme_up.png theme_down = images/theme_down.png theme_bottom = images/theme_bottom.png +zoom_all = images/zoom-1.png +zoom_in = images/zoom-in.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 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Fri Jun 03 08:20:22 2011 +0000 @@ -160,6 +160,16 @@ } + public void resetRanges() { + xrange[0] = 0; + xrange[1] = 0; + yrange[0] = 0; + yrange[1] = 0; + + updateChartPanel(); + } + + /** * Updates the Transform2D object using the chart info service. */
--- 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);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java Fri Jun 03 06:34:32 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java Fri Jun 03 08:20:22 2011 +0000 @@ -3,9 +3,11 @@ import java.util.ArrayList; import java.util.List; +import com.google.gwt.core.client.GWT; + import com.smartgwt.client.types.Positioning; import com.smartgwt.client.types.SelectionType; -import com.smartgwt.client.widgets.Button; +import com.smartgwt.client.widgets.ImgButton; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.events.MouseDownEvent; import com.smartgwt.client.widgets.events.MouseDownHandler; @@ -30,7 +32,7 @@ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class ZoomboxControl -extends Button +extends ImgButton implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, HasZoomHandlers { protected List<ZoomHandler> handlers; @@ -43,8 +45,8 @@ protected int[] end; - public ZoomboxControl(ChartOutputTab chartTab) { - super("Zoombox"); + public ZoomboxControl(ChartOutputTab chartTab, String imageUrl) { + super(); this.handlers = new ArrayList<ZoomHandler>(); this.chartTab = chartTab; @@ -54,7 +56,11 @@ initZoombox(); + String baseUrl = GWT.getHostPageBaseURL(); + setSrc(baseUrl + imageUrl); setActionType(SelectionType.CHECKBOX); + setSize(20); + setShowRollOver(false); setSelected(false); chartTab.getChartPanel().addMouseDownHandler(this);