# HG changeset patch # User Ingo Weinzierl # Date 1329471698 0 # Node ID 90c339e26a0ad19aff47a38efc1ae21902358bd0 # Parent ea6065c2dabee6d765470e392036cae5036c2fd4 #459 Take the current zoom into account for chart exports. flys-client/trunk@4073 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ea6065c2dabe -r 90c339e26a0a flys-client/ChangeLog --- a/flys-client/ChangeLog Fri Feb 17 09:26:34 2012 +0000 +++ b/flys-client/ChangeLog Fri Feb 17 09:41:38 2012 +0000 @@ -1,3 +1,16 @@ +2012-02-17 Ingo Weinzierl + + flys/issue459 (Diagramm-Export hat nicht die gleiche Axenskalierung wie + Diagramm-Ansicht) + + * src/main/java/de/intevation/flys/client/client/ui/ImgLink.java: Added a + method setSource() that allows to reset the url of the export. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + Implements ZoomHandler to update the export url of PNG, PDF and SVG + download links. This is necessary to take the current zoom information + into account. + 2012-02-17 Ingo Weinzierl * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: diff -r ea6065c2dabe -r 90c339e26a0a flys-client/src/main/java/de/intevation/flys/client/client/ui/ImgLink.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ImgLink.java Fri Feb 17 09:26:34 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ImgLink.java Fri Feb 17 09:41:38 2012 +0000 @@ -1,17 +1,42 @@ package de.intevation.flys.client.client.ui; +import com.google.gwt.core.client.GWT; + import com.smartgwt.client.types.Overflow; import com.smartgwt.client.widgets.HTMLPane; public class ImgLink extends HTMLPane { + private int width; + private int height; + + private String href; + private String imgUrl; + + public ImgLink(String imgUrl, String href, int width, int height) { super(); + this.width = width; + this.height = height; + this.href = href; + this.imgUrl = imgUrl; + + update(); + } + + + protected void update() { setContents(""); setWidth(width); setHeight(height); setOverflow(Overflow.VISIBLE); } + + + public void setSource(String href) { + this.href = href; + update(); + } } diff -r ea6065c2dabe -r 90c339e26a0a flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Fri Feb 17 09:26:34 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Fri Feb 17 09:41:38 2012 +0000 @@ -10,6 +10,8 @@ import com.smartgwt.client.widgets.events.ClickHandler; import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.ZoomEvent; +import de.intevation.flys.client.client.event.ZoomHandler; import de.intevation.flys.client.client.ui.ImgLink; import de.intevation.flys.client.client.ui.Toolbar; @@ -20,7 +22,7 @@ * * @author Ingo Weinzierl */ -public class ChartToolbar extends Toolbar { +public class ChartToolbar extends Toolbar implements ZoomHandler { protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -30,11 +32,11 @@ protected Button datacage; - protected Canvas downloadPNG; + protected ImgLink downloadPNG; - protected Canvas downloadPDF; + protected ImgLink downloadPDF; - protected Canvas downloadSVG; + protected ImgLink downloadSVG; protected Canvas downloadCSV; @@ -134,6 +136,7 @@ }); zoombox.addZoomHandler(chartTab); + zoombox.addZoomHandler(this); zoombox.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { panControl.deselect(); @@ -220,5 +223,12 @@ new ManualPointsEditor(chartTab.getView().getCollection(), this.chartTab, this.chartTab.getMode().getName()).show(); } + + + public void onZoom(ZoomEvent evt) { + downloadPNG.setSource(chartTab.getExportUrl(-1, -1, "png")); + downloadPDF.setSource(chartTab.getExportUrl(-1, -1, "pdf")); + downloadSVG.setSource(chartTab.getExportUrl(-1, -1, "svg")); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :