# HG changeset patch # User Ingo Weinzierl # Date 1306937609 0 # Node ID ed29599e06e54ea52ed2b773d8f3ef67973278ab # Parent a866cdf1ca40a55c7520bfa02129b68746337d2f Added the ChartOutputTab as ZoomHandler for the ZoomboxControl - no zooming is done yet. flys-client/trunk@2041 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a866cdf1ca40 -r ed29599e06e5 flys-client/ChangeLog --- a/flys-client/ChangeLog Wed Jun 01 13:43:35 2011 +0000 +++ b/flys-client/ChangeLog Wed Jun 01 14:13:29 2011 +0000 @@ -1,3 +1,17 @@ +2011-06-01 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + Implements the ZoomHandler interface now. Currently, the values are just + received from ZoomboxControl. We still need to refresh the chart with + those zoom values. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + Registered the ChartOutputTab as ZoomHandler at the ZoomboxControl. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java: + Bugfix: fire the ZoomEvent when mouse up events occur. The events was + not fired anytime. + 2011-06-01 Ingo Weinzierl * src/main/java/de/intevation/flys/client/client/event/HasZoomHandlers.java, diff -r a866cdf1ca40 -r ed29599e06e5 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed Jun 01 13:43:35 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed Jun 01 14:13:29 2011 +0000 @@ -20,6 +20,8 @@ import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.event.OutputParameterChangeEvent; import de.intevation.flys.client.client.event.OutputParameterChangeHandler; +import de.intevation.flys.client.client.event.ZoomEvent; +import de.intevation.flys.client.client.event.ZoomHandler; import de.intevation.flys.client.client.services.ChartInfoService; import de.intevation.flys.client.client.services.ChartInfoServiceAsync; import de.intevation.flys.client.client.ui.CollectionView; @@ -31,7 +33,7 @@ */ public class ChartOutputTab extends OutputTab -implements ResizedHandler, OutputParameterChangeHandler +implements ResizedHandler, OutputParameterChangeHandler, ZoomHandler { public static final int DEFAULT_CHART_WIDTH = 600; public static final int DEFAULT_CHART_HEIGHT = 500; @@ -135,6 +137,24 @@ /** + * Listens to zoom events and refreshes the current chart in such case. + * + * @param evt The ZoomEvent that stores the coordinates for zooming. + */ + public void onZoom(ZoomEvent evt) { + double[] lower = transformer.transform(evt.getStartX(), evt.getStartY()); + double[] upper = transformer.transform(evt.getEndX(), evt.getEndY()); + + double xmin = lower[0]; + double xmax = upper[0]; + double ymin = upper[1]; + double ymax = lower[1]; + + // TODO Trigger the recreation of the chart + } + + + /** * Updates the Transform2D object using the chart info service. */ public void updateTransformer() { diff -r a866cdf1ca40 -r ed29599e06e5 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 Wed Jun 01 13:43:35 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Wed Jun 01 14:13:29 2011 +0000 @@ -58,6 +58,8 @@ } }); + zoombox.addZoomHandler(chartTab); + initLayout(); } diff -r a866cdf1ca40 -r ed29599e06e5 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java Wed Jun 01 13:43:35 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ZoomboxControl.java Wed Jun 01 14:13:29 2011 +0000 @@ -71,7 +71,7 @@ */ protected void initZoombox() { zoombox.setPosition(Positioning.ABSOLUTE); - zoombox.setBackgroundColor("red"); + zoombox.setBorder("2px solid black"); zoombox.setOpacity(50); zoombox.setWidth(0); zoombox.setHeight(0); @@ -149,6 +149,8 @@ end[0] = getRelativeX(event.getX()); end[1] = getRelativeY(event.getY()); + fireZoomEvent(); + clearZoombox(); chartTab.getChartPanel().removeChild(zoombox);