From: <mu...@us...> - 2007-11-14 15:10:54
|
Revision: 584 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=584&view=rev Author: mungady Date: 2007-11-14 07:10:50 -0800 (Wed, 14 Nov 2007) Log Message: ----------- 2007-11-14 David Gilbert <dav...@ob...> * swt/org/jfree/experimental/chart/swt/ChartComposite.java (ChartComposite): Create canvas with SWT.DOUBLE_BUFFERED, (getChartRenderingInfo): New method, (isDomainZoomable): Likewise, (setDomainZoomable): Likewise, (isRangeZoomable): Likewise, (setRangeZoomable): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/swt/org/jfree/experimental/chart/swt/ChartComposite.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2007-11-14 11:37:00 UTC (rev 583) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2007-11-14 15:10:50 UTC (rev 584) @@ -1,5 +1,15 @@ 2007-11-14 David Gilbert <dav...@ob...> + * swt/org/jfree/experimental/chart/swt/ChartComposite.java + (ChartComposite): Create canvas with SWT.DOUBLE_BUFFERED, + (getChartRenderingInfo): New method, + (isDomainZoomable): Likewise, + (setDomainZoomable): Likewise, + (isRangeZoomable): Likewise, + (setRangeZoomable): Likewise. + +2007-11-14 David Gilbert <dav...@ob...> + * source/org/jfree/chart/plot/CategoryPlot.java (setWeight): Fire change event, (setFixedDomainAxisSpace(AxisSpace)): Delegate to new method, Modified: branches/jfreechart-1.0.x-branch/swt/org/jfree/experimental/chart/swt/ChartComposite.java =================================================================== --- branches/jfreechart-1.0.x-branch/swt/org/jfree/experimental/chart/swt/ChartComposite.java 2007-11-14 11:37:00 UTC (rev 583) +++ branches/jfreechart-1.0.x-branch/swt/org/jfree/experimental/chart/swt/ChartComposite.java 2007-11-14 15:10:50 UTC (rev 584) @@ -53,16 +53,20 @@ * than maximum draw width/height (HP); * 23-May-2007 : Added some dispose call to free SWT resources, patch sent by * Cédric Chabanois (CC); - * 06-Jun-2007 : Fixed minor issues with tooltips. bug reported and fix proposed - * by Christoph Beck, bug 1726404 (HP); - * 22-Oct-2007 : Added addChartMouseListener and removeChartMouseListener methods - * as suggested by Christoph Beck, bug 1742002 (HP); + * 06-Jun-2007 : Fixed minor issues with tooltips. bug reported and fix + * proposed by Christoph Beck, bug 1726404 (HP); + * 22-Oct-2007 : Added addChartMouseListener and removeChartMouseListener + * methods as suggested by Christoph Beck, bug 1742002 (HP); * 22-Oct-2007 : Fixed bug in zooming with multiple plots (HP); - * 22-Oct-2007 : Check for null zoom point when restoring auto range and domain bounds (HP); + * 22-Oct-2007 : Check for null zoom point when restoring auto range and domain + * bounds (HP); * 22-Oct-2007 : Pass mouse moved events to listening ChartMouseListeners (HP); * 22-Oct-2007 : Refactored class, now implements PaintListener, MouseListener, - * MouseMoveListener. Made the chart field be private again and added - * new method addSWTListener to allow custom behavior. + * MouseMoveListener. Made the chart field be private again and + * added new method addSWTListener to allow custom behavior. + * 14-Nov-2007 : Create canvas with SWT.DOUBLE_BUFFER, added + * getChartRenderingInfo(), is/setDomainZoomable() and + * is/setRangeZoomable() as per feature request (DG); */ package org.jfree.experimental.chart.swt; @@ -525,7 +529,7 @@ this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE; this.setDisplayToolTips(tooltips); // create the canvas and add the required listeners - this.canvas = new Canvas(this, SWT.NO_BACKGROUND); + this.canvas = new Canvas(this, SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND); this.canvas.addPaintListener(this); this.canvas.addMouseListener(this); this.canvas.addMouseMoveListener(this); @@ -636,6 +640,73 @@ } /** + * Returns the chart rendering info from the most recent chart redraw. + * + * @return The chart rendering info (possibly <code>null</code>). + */ + public ChartRenderingInfo getChartRenderingInfo() { + return this.info; + } + + /** + * Returns the flag that determines whether or not zooming is enabled for + * the domain axis. + * + * @return A boolean. + */ + public boolean isDomainZoomable() { + return this.domainZoomable; + } + + /** + * Sets the flag that controls whether or not zooming is enable for the + * domain axis. A check is made to ensure that the current plot supports + * zooming for the domain values. + * + * @param flag <code>true</code> enables zooming if possible. + */ + public void setDomainZoomable(boolean flag) { + if (flag) { + Plot plot = this.chart.getPlot(); + if (plot instanceof Zoomable) { + Zoomable z = (Zoomable) plot; + this.domainZoomable = flag && (z.isDomainZoomable()); + } + } + else { + this.domainZoomable = false; + } + } + + /** + * Returns the flag that determines whether or not zooming is enabled for + * the range axis. + * + * @return A boolean. + */ + public boolean isRangeZoomable() { + return this.rangeZoomable; + } + + /** + * A flag that controls mouse-based zooming on the vertical axis. + * + * @param flag <code>true</code> enables zooming. + */ + public void setRangeZoomable(boolean flag) { + if (flag) { + Plot plot = this.chart.getPlot(); + if (plot instanceof Zoomable) { + Zoomable z = (Zoomable) plot; + this.rangeZoomable = flag && (z.isRangeZoomable()); + } + } + else { + this.rangeZoomable = false; + } + } + + /** * Returns the zoom in factor. * * @return The zoom in factor. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |