You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(165) |
Nov
(296) |
Dec
(92) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(84) |
Feb
(20) |
Mar
(20) |
Apr
(42) |
May
(26) |
Jun
(30) |
Jul
(77) |
Aug
(151) |
Sep
(61) |
Oct
(259) |
Nov
(160) |
Dec
(76) |
2007 |
Jan
(159) |
Feb
(155) |
Mar
(183) |
Apr
(113) |
May
(110) |
Jun
(178) |
Jul
(56) |
Aug
(21) |
Sep
(50) |
Oct
(251) |
Nov
(218) |
Dec
(42) |
2008 |
Jan
(14) |
Feb
(37) |
Mar
(60) |
Apr
(77) |
May
(146) |
Jun
(256) |
Jul
(72) |
Aug
(51) |
Sep
(283) |
Oct
(22) |
Nov
(55) |
Dec
(53) |
2009 |
Jan
(56) |
Feb
(45) |
Mar
(56) |
Apr
(98) |
May
(84) |
Jun
(87) |
Jul
(32) |
Aug
(6) |
Sep
(19) |
Oct
|
Nov
(10) |
Dec
(6) |
2010 |
Jan
(2) |
Feb
(6) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(158) |
Nov
(17) |
Dec
(15) |
2012 |
Jan
(9) |
Feb
(3) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(22) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(259) |
Aug
(125) |
Sep
(24) |
Oct
(8) |
Nov
(132) |
Dec
(3) |
2014 |
Jan
(3) |
Feb
(26) |
Mar
(17) |
Apr
(8) |
May
|
Jun
(31) |
Jul
(126) |
Aug
(22) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
|
Nov
(1) |
Dec
|
2016 |
Jan
(19) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mu...@us...> - 2014-06-30 14:22:02
|
Revision: 3147 http://sourceforge.net/p/jfreechart/code/3147 Author: mungady Date: 2014-06-30 14:21:57 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XIntervalSeries.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XIntervalSeries.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XIntervalSeries.java 2014-06-30 14:21:27 UTC (rev 3146) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XIntervalSeries.java 2014-06-30 14:21:57 UTC (rev 3147) @@ -44,6 +44,7 @@ import org.jfree.data.ComparableObjectItem; import org.jfree.data.ComparableObjectSeries; +import org.jfree.data.general.SeriesChangeEvent; /** * A list of (x, x-low, x-high, y) data items. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 14:21:34
|
Revision: 3146 http://sourceforge.net/p/jfreechart/code/3146 Author: mungady Date: 2014-06-30 14:21:27 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/VectorSeries.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/VectorSeries.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/VectorSeries.java 2014-06-30 14:16:22 UTC (rev 3145) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/VectorSeries.java 2014-06-30 14:21:27 UTC (rev 3146) @@ -48,6 +48,7 @@ import org.jfree.data.ComparableObjectItem; import org.jfree.data.ComparableObjectSeries; +import org.jfree.data.general.SeriesChangeEvent; /** * A list of (x,y, deltaX, deltaY) data items. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 14:16:25
|
Revision: 3145 http://sourceforge.net/p/jfreechart/code/3145 Author: mungady Date: 2014-06-30 14:16:22 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Don't print stacktraces. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java 2014-06-30 14:14:19 UTC (rev 3144) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeries.java 2014-06-30 14:16:22 UTC (rev 3145) @@ -104,6 +104,7 @@ import org.jfree.chart.util.ParamChecks; import org.jfree.data.Range; import org.jfree.data.general.Series; +import org.jfree.data.general.SeriesChangeEvent; import org.jfree.data.general.SeriesException; import org.jfree.util.ObjectUtilities; @@ -375,7 +376,7 @@ * x-values (where the x-values are interpreted as milliseconds since the * epoch and converted to time periods using the specified timezone). * - * @param xRange the subset of x-values to use (<coded>null</code> not + * @param xRange the subset of x-values to use (<code>null</code> not * permitted). * @param xAnchor the anchor point for the x-values (<code>null</code> * not permitted). @@ -1008,13 +1009,13 @@ index = newest.getSerialIndex(); } catch (NoSuchMethodException e) { - e.printStackTrace(); + throw new RuntimeException(e); } catch (IllegalAccessException e) { - e.printStackTrace(); + throw new RuntimeException(e); } catch (InvocationTargetException e) { - e.printStackTrace(); + throw new RuntimeException(e); } // check if there are any values earlier than specified by the history @@ -1158,7 +1159,7 @@ copy.add(clone); } catch (SeriesException e) { - e.printStackTrace(); + throw new RuntimeException(e); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 14:14:23
|
Revision: 3144 http://sourceforge.net/p/jfreechart/code/3144 Author: mungady Date: 2014-06-30 14:14:19 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ExportUtils.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ExportUtils.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ExportUtils.java 2014-06-30 14:13:18 UTC (rev 3143) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ExportUtils.java 2014-06-30 14:14:19 UTC (rev 3144) @@ -148,7 +148,7 @@ } /** - * Writes a {@link Drawable3D} to the specified file in PDF format. This + * Writes a {@link Drawable} to the specified file in PDF format. This * will only work when the OrsonPDF library is found on the classpath. * Reflection is used to ensure there is no compile-time dependency on * OrsonPDF. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 14:13:26
|
Revision: 3143 http://sourceforge.net/p/jfreechart/code/3143 Author: mungady Date: 2014-06-30 14:13:18 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYStepAreaRenderer.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYStepAreaRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYStepAreaRenderer.java 2014-06-30 14:12:19 UTC (rev 3142) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/XYStepAreaRenderer.java 2014-06-30 14:13:18 UTC (rev 3143) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * ----------------------- * XYStepAreaRenderer.java * ----------------------- - * (C) Copyright 2003-2013, by Matthias Rose and Contributors. + * (C) Copyright 2003-2014, by Matthias Rose and Contributors. * * Original Author: Matthias Rose (based on XYAreaRenderer.java); * Contributor(s): David Gilbert (for Object Refinery Limited); @@ -67,6 +67,7 @@ import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.EntityCollection; +import org.jfree.chart.event.RendererChangeEvent; import org.jfree.chart.labels.XYToolTipGenerator; import org.jfree.chart.plot.CrosshairState; import org.jfree.chart.plot.PlotOrientation; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 14:12:23
|
Revision: 3142 http://sourceforge.net/p/jfreechart/code/3142 Author: mungady Date: 2014-06-30 14:12:19 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java 2014-06-30 13:51:44 UTC (rev 3141) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/LogAxis.java 2014-06-30 14:12:19 UTC (rev 3142) @@ -78,6 +78,7 @@ import java.util.List; import java.util.Locale; +import org.jfree.chart.event.AxisChangeEvent; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.ValueAxisPlot; @@ -105,7 +106,7 @@ private double baseLog = Math.log(10.0); /** - * The base symbol to display (if <code>null</code> then the numerical + * The base symbol to display (if {@code null} then the numerical * value of the base is displayed). */ private String baseSymbol = null; @@ -126,16 +127,16 @@ private NumberFormat numberFormatOverride; /** - * Creates a new <code>LogAxis</code> with no label. + * Creates a new {@code LogAxis} with no label. */ public LogAxis() { this(null); } /** - * Creates a new <code>LogAxis</code> with the given label. + * Creates a new {@code LogAxis} with the given label. * - * @param label the axis label (<code>null</code> permitted). + * @param label the axis label ({@code null} permitted). */ public LogAxis(String label) { super(label, new NumberTickUnitSource()); @@ -145,7 +146,7 @@ /** * Returns the base for the logarithm calculation. The default value is - * <code>10.0</code>. + * {@code 10.0}. * * @return The base for the logarithm calculation. * @@ -174,10 +175,10 @@ /** * Returns the symbol used to represent the base of the logarithmic scale - * for the axis. If this is <code>null</code> (the default) then the + * for the axis. If this is {@code null} (the default) then the * numerical value of the base is displayed. * - * @return The base symbol (possibly <code>null</code>). + * @return The base symbol (possibly {@code null}). * * @since 1.0.18 */ @@ -189,7 +190,7 @@ * Sets the symbol used to represent the base value of the logarithmic * scale and sends a change event to all registered listeners. * - * @param symbol the symbol (<code>null</code> permitted). + * @param symbol the symbol ({@code null} permitted). * * @since 1.0.18 */ @@ -201,9 +202,9 @@ /** * Returns the formatter used to format the base value of the logarithmic * scale when it is displayed numerically. The default value is - * <code>new DecimalFormat("0")</code>. + * {@code new DecimalFormat("0")}. * - * @return The base formatter (never <code>null</code>). + * @return The base formatter (never {@code null}). * * @since 1.0.18 */ @@ -216,7 +217,7 @@ * scale when it is displayed numerically and sends a change event to all * registered listeners. * - * @param formatter the formatter (<code>null</code> not permitted). + * @param formatter the formatter ({@code null} not permitted). * * @since 1.0.18 */ @@ -271,7 +272,7 @@ * restore it using the {@link ValueAxis#setAutoTickUnitSelection(boolean)} * method). * - * @param unit the new tick unit (<code>null</code> not permitted). + * @param unit the new tick unit ({@code null} not permitted). * * @see #getTickUnit() */ @@ -287,7 +288,7 @@ * (you can restore it using the * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method). * - * @param unit the new tick unit (<code>null</code> not permitted). + * @param unit the new tick unit ({@code null} not permitted). * @param notify notify listeners? * @param turnOffAutoSelect turn off the auto-tick selection? * @@ -306,10 +307,10 @@ } /** - * Returns the number format override. If this is non-<code>null</code>, + * Returns the number format override. If this is non-{@code null}, * then it will be used to format the numbers on the axis. * - * @return The number formatter (possibly <code>null</code>). + * @return The number formatter (possibly {@code null}). * * @see #setNumberFormatOverride(NumberFormat) */ @@ -319,10 +320,10 @@ /** * Sets the number format override and sends a change event to all - * registered listeners. If this is non-<code>null</code>, then it will be + * registered listeners. If this is non-{@code null}, then it will be * used to format the numbers on the axis. * - * @param formatter the number formatter (<code>null</code> permitted). + * @param formatter the number formatter ({@code null} permitted). * * @see #getNumberFormatOverride() */ @@ -372,13 +373,12 @@ /** * Converts a Java2D coordinate to an axis value, assuming that the - * axis is aligned to the specified <code>edge</code> of the - * <code>area</code>. + * axis is aligned to the specified {@code edge} of the {@code area}. * * @param java2DValue the Java2D coordinate. - * @param area the area for plotting data (<code>null</code> not + * @param area the area for plotting data ({@code null} not * permitted). - * @param edge the edge that the axis is aligned to (<code>null</code> not + * @param edge the edge that the axis is aligned to ({@code null} not * permitted). * * @return A value along the axis scale. @@ -413,14 +413,14 @@ /** * Converts a value on the axis scale to a Java2D coordinate relative to - * the given <code>area</code>, based on the axis running along the - * specified <code>edge</code>. + * the given {@code area}, based on the axis running along the + * specified {@code edge}. * * @param value the data value. - * @param area the area (<code>null</code> not permitted). - * @param edge the edge (<code>null</code> not permitted). + * @param area the area ({@code null} not permitted). + * @param edge the edge ({@code null} not permitted). * - * @return The Java2D coordinate corresponding to <code>value</code>. + * @return The Java2D coordinate corresponding to {@code value}. */ @Override public double valueToJava2D(double value, Rectangle2D area, @@ -515,15 +515,15 @@ * Draws the axis on a Java 2D graphics device (such as the screen or a * printer). * - * @param g2 the graphics device (<code>null</code> not permitted). + * @param g2 the graphics device ({@code null} not permitted). * @param cursor the cursor location (determines where to draw the axis). * @param plotArea the area within which the axes and plot should be drawn. * @param dataArea the area within which the data should be drawn. - * @param edge the axis location (<code>null</code> not permitted). - * @param plotState collects information about the plot - * (<code>null</code> permitted). + * @param edge the axis location ({@code null} not permitted). + * @param plotState collects information about the plot ({@code null} + * permitted). * - * @return The axis state (never <code>null</code>). + * @return The axis state (never {@code null}). */ @Override public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, @@ -579,9 +579,9 @@ /** * Returns a list of ticks for an axis at the top or bottom of the chart. * - * @param g2 the graphics device (<code>null</code> not permitted). - * @param dataArea the data area (<code>null</code> not permitted). - * @param edge the edge (<code>null</code> not permitted). + * @param g2 the graphics device ({@code null} not permitted). + * @param dataArea the data area ({@code null} not permitted). + * @param edge the edge ({@code null} not permitted). * * @return A list of ticks. */ @@ -636,9 +636,9 @@ /** * Returns a list of ticks for an axis at the left or right of the chart. * - * @param g2 the graphics device (<code>null</code> not permitted). - * @param dataArea the data area (<code>null</code> not permitted). - * @param edge the edge that the axis is aligned to (<code>null</code> + * @param g2 the graphics device ({@code null} not permitted). + * @param dataArea the data area ({@code null} not permitted). + * @param edge the edge that the axis is aligned to ({@code null} * not permitted). * * @return A list of ticks. @@ -696,10 +696,10 @@ * display as many ticks as possible (selected from an array of 'standard' * tick units) without the labels overlapping. * - * @param g2 the graphics device (<code>null</code> not permitted). - * @param dataArea the area defined by the axes (<code>null</code> not + * @param g2 the graphics device ({@code null} not permitted). + * @param dataArea the area defined by the axes ({@code null} not * permitted). - * @param edge the axis location (<code>null</code> not permitted). + * @param edge the axis location ({@code null} not permitted). * * @since 1.0.7 */ @@ -1000,9 +1000,9 @@ /** * Resizes the axis length to the specified percentage of the current * range and sends a change event to all registered listeners. If - * <code>percent</code> is greater than 1.0 (100 percent) then the axis + * {@code percent} is greater than 1.0 (100 percent) then the axis * range is increased (which has the effect of zooming out), while if the - * <code>percent</code> is less than 1.0 the axis range is decreased + * {@code percent} is less than 1.0 the axis range is decreased * (which has the effect of zooming in). The resize occurs around an * anchor value (which may not be in the center of the axis). This is used * to support mouse wheel zooming around an arbitrary point on the plot. @@ -1037,7 +1037,7 @@ /** * Tests this axis for equality with an arbitrary object. * - * @param obj the object (<code>null</code> permitted). + * @param obj the object ({@code null} permitted). * * @return A boolean. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 13:51:47
|
Revision: 3141 http://sourceforge.net/p/jfreechart/code/3141 Author: mungady Date: 2014-06-30 13:51:44 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/title/ImageTitle.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/title/ImageTitle.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/title/ImageTitle.java 2014-06-30 13:51:08 UTC (rev 3140) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/title/ImageTitle.java 2014-06-30 13:51:44 UTC (rev 3141) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------- * ImageTitle.java * --------------- - * (C) Copyright 2000-2008, by David Berry and Contributors; + * (C) Copyright 2000-2014, by David Berry and Contributors; * * Original Author: David Berry; * Contributor(s): David Gilbert (for Object Refinery Limited); @@ -94,7 +94,7 @@ /** * Creates a new image title. * - * @param image the image (<code>null</code> not permitted). + * @param image the image ({@code null} not permitted). */ public ImageTitle(Image image) { this(image, image.getHeight(null), image.getWidth(null), @@ -105,7 +105,7 @@ /** * Creates a new image title. * - * @param image the image (<code>null</code> not permitted). + * @param image the image ({@code null} not permitted). * @param position the title position. * @param horizontalAlignment the horizontal alignment. * @param verticalAlignment the vertical alignment. @@ -123,7 +123,7 @@ * Creates a new image title with the given image scaled to the given * width and height in the given location. * - * @param image the image (<code>null</code> not permitted). + * @param image the image ({@code null} not permitted). * @param height the height used to draw the image. * @param width the width used to draw the image. * @param position the title position. @@ -151,7 +151,7 @@ /** * Returns the image for the title. * - * @return The image for the title (never <code>null</code>). + * @return The image for the title (never {@code null}). */ public Image getImage() { return this.image; @@ -161,7 +161,7 @@ * Sets the image for the title and notifies registered listeners that the * title has been modified. * - * @param image the new image (<code>null</code> not permitted). + * @param image the new image ({@code null} not permitted). */ public void setImage(Image image) { if (image == null) { @@ -176,9 +176,9 @@ * returns the block size. * * @param g2 the graphics device. - * @param constraint the constraint (<code>null</code> not permitted). + * @param constraint the constraint ({@code null} not permitted). * - * @return The block size (in Java2D units, never <code>null</code>). + * @return The block size (in Java2D units, never {@code null}). */ @Override public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) { @@ -326,9 +326,9 @@ * * @param g2 the graphics device. * @param area the area. - * @param params ignored (<code>null</code> permitted). + * @param params ignored ({@code null} permitted). * - * @return Always <code>null</code>. + * @return Always {@code null}. */ @Override public Object draw(Graphics2D g2, Rectangle2D area, Object params) { @@ -337,16 +337,16 @@ } /** - * Tests this <code>ImageTitle</code> for equality with an arbitrary - * object. Returns <code>true</code> if: + * Tests this {@code ImageTitle} for equality with an arbitrary + * object. Returns {@code true} if: * <ul> - * <li><code>obj</code> is an instance of <code>ImageTitle</code>; - * <li><code>obj</code> references the same image as this - * <code>ImageTitle</code>; - * <li><code>super.equals(obj)<code> returns <code>true</code>; + * <li>{@code obj} is an instance of {@code ImageTitle}; + * <li>{@code obj} references the same image as this + * {@code ImageTitle}; + * <li>{@code super.equals(obj)} returns {@code true}; * </ul> * - * @param obj the object (<code>null</code> permitted). + * @param obj the object ({@code null} permitted). * * @return A boolean. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 13:51:16
|
Revision: 3140 http://sourceforge.net/p/jfreechart/code/3140 Author: mungady Date: 2014-06-30 13:51:08 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseEventFX.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseEventFX.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseEventFX.java 2014-06-30 13:50:41 UTC (rev 3139) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseEventFX.java 2014-06-30 13:51:08 UTC (rev 3140) @@ -45,6 +45,7 @@ import javafx.scene.input.MouseEvent; import org.jfree.chart.JFreeChart; import org.jfree.chart.entity.ChartEntity; +import org.jfree.chart.fx.ChartViewer; /** * A mouse event for a chart that is displayed in a (JavaFX) @@ -75,11 +76,11 @@ /** * Constructs a new event. * - * @param chart the source chart (<code>null</code> not permitted). + * @param chart the source chart ({@code null} not permitted). * @param trigger the mouse event that triggered this event - * (<code>null</code> not permitted). + * ({@code null} not permitted). * @param entity the chart entity (if any) under the mouse point - * (<code>null</code> permitted). + * ({@code null} permitted). */ public ChartMouseEventFX(JFreeChart chart, MouseEvent trigger, ChartEntity entity) { @@ -92,7 +93,7 @@ /** * Returns the chart that the mouse event relates to. * - * @return The chart (never <code>null</code>). + * @return The chart (never {@code null}). */ public JFreeChart getChart() { return this.chart; @@ -101,7 +102,7 @@ /** * Returns the mouse event that triggered this event. * - * @return The event (never <code>null</code>). + * @return The event (never {@code null}). */ public MouseEvent getTrigger() { return this.trigger; @@ -110,7 +111,7 @@ /** * Returns the chart entity (if any) under the mouse point. * - * @return The chart entity (possibly <code>null</code>). + * @return The chart entity (possibly {@code null}). */ public ChartEntity getEntity() { return this.entity; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 13:50:49
|
Revision: 3139 http://sourceforge.net/p/jfreechart/code/3139 Author: mungady Date: 2014-06-30 13:50:41 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/data/statistics/Statistics.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/statistics/Statistics.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/statistics/Statistics.java 2014-06-30 13:49:25 UTC (rev 3138) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/statistics/Statistics.java 2014-06-30 13:50:41 UTC (rev 3139) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------- * Statistics.java * --------------- - * (C) Copyright 2000-2013, by Matthew Wright and Contributors. + * (C) Copyright 2000-2014, by Matthew Wright and Contributors. * * Original Author: Matthew Wright; * Contributor(s): David Gilbert (for Object Refinery Limited); @@ -63,9 +63,9 @@ /** * Returns the mean of an array of numbers. This is equivalent to calling - * <code>calculateMean(values, true)</code>. + * {@code calculateMean(values, true)}. * - * @param values the values (<code>null</code> not permitted). + * @param values the values ({@code null} not permitted). * * @return The mean. */ @@ -76,9 +76,9 @@ /** * Returns the mean of an array of numbers. * - * @param values the values (<code>null</code> not permitted). + * @param values the values ({@code null} not permitted). * @param includeNullAndNaN a flag that controls whether or not - * <code>null</code> and <code>Double.NaN</code> values are included + * {@code null} and {@code Double.NaN} values are included * in the calculation (if either is present in the array, the result is * {@link Double#NaN}). * @@ -112,9 +112,9 @@ } /** - * Returns the mean of a collection of <code>Number</code> objects. + * Returns the mean of a collection of {@code Number} objects. * - * @param values the values (<code>null</code> not permitted). + * @param values the values ({@code null} not permitted). * * @return The mean. */ @@ -123,11 +123,11 @@ } /** - * Returns the mean of a collection of <code>Number</code> objects. + * Returns the mean of a collection of {@code Number} objects. * - * @param values the values (<code>null</code> not permitted). + * @param values the values ({@code null} not permitted). * @param includeNullAndNaN a flag that controls whether or not - * <code>null</code> and <code>Double.NaN</code> values are included + * {@code null} and {@code Double.NaN} values are included * in the calculation (if either is present in the array, the result is * {@link Double#NaN}). * @@ -169,13 +169,13 @@ } /** - * Calculates the median for a list of values (<code>Number</code> objects). + * Calculates the median for a list of values ({@code Number} objects). * The list of values will be copied, and the copy sorted, before * calculating the median. To avoid this step (if your list of values * is already sorted), use the {@link #calculateMedian(List, boolean)} * method. * - * @param values the values (<code>null</code> permitted). + * @param values the values ({@code null} permitted). * * @return The median. */ @@ -184,11 +184,11 @@ } /** - * Calculates the median for a list of values (<code>Number</code> objects). - * If <code>copyAndSort</code> is <code>false</code>, the list is assumed + * Calculates the median for a list of values ({@code Number} objects). + * If {@code copyAndSort} is {@code false}, the list is assumed * to be presorted in ascending order by value. * - * @param values the values (<code>null</code> permitted). + * @param values the values ({@code null} permitted). * @param copyAndSort a flag that controls whether the list of values is * copied and sorted. * @@ -232,10 +232,9 @@ /** * Calculates the median for a sublist within a list of values - * (<code>Number</code> objects). + * ({@code Number} objects). * - * @param values the values, in any order (<code>null</code> not - * permitted). + * @param values the values, in any order ({@code null} not permitted). * @param start the start index. * @param end the end index. * @@ -247,10 +246,10 @@ /** * Calculates the median for a sublist within a list of values - * (<code>Number</code> objects). The entire list will be sorted if the - * <code>ascending</code< argument is <code>false</code>. + * ({@code Number} objects). The entire list will be sorted if the + * {@code ascending} argument is {@code false}. * - * @param values the values (<code>null</code> not permitted). + * @param values the values ({@code null} not permitted). * @param start the start index. * @param end the end index. * @param copyAndSort a flag that that controls whether the list of values @@ -299,7 +298,7 @@ /** * Returns the standard deviation of a set of numbers. * - * @param data the data (<code>null</code> or zero length array not + * @param data the data ({@code null} or zero length array not * permitted). * * @return The standard deviation of a set of numbers. @@ -323,8 +322,8 @@ * Fits a straight line to a set of (x, y) data, returning the slope and * intercept. * - * @param xData the x-data (<code>null</code> not permitted). - * @param yData the y-data (<code>null</code> not permitted). + * @param xData the x-data ({@code null} not permitted). + * @param yData the y-data ({@code null} not permitted). * * @return A double array with the intercept in [0] and the slope in [1]. */ @@ -350,8 +349,8 @@ /** * Finds the slope of a regression line using least squares. * - * @param xData the x-values (<code>null</code> not permitted). - * @param yData the y-values (<code>null</code> not permitted). + * @param xData the x-values ({@code null} not permitted). + * @param yData the y-values ({@code null} not permitted). * * @return The slope. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-30 13:49:36
|
Revision: 3138 http://sourceforge.net/p/jfreechart/code/3138 Author: mungady Date: 2014-06-30 13:49:25 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix Javadoc warnings. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/MouseHandlerFX.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/MouseHandlerFX.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/MouseHandlerFX.java 2014-06-27 10:49:47 UTC (rev 3137) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/MouseHandlerFX.java 2014-06-30 13:49:25 UTC (rev 3138) @@ -47,7 +47,7 @@ * mouse events on a {@link ChartCanvas} and performs a function in response * to those events (typical functions include tooltip display, drag zooming, * mouse wheel zooming and panning). A handler can be registered with the - * {@ChartCanvas} as a regular handler or as an auxiliary handler. Upon a + * {@link ChartCanvas} as a regular handler or as an auxiliary handler. Upon a * mouse pressed event, the canvas will select *one* regular handler to be the * current "live" handler - this selection normally takes into account the * modifier keys that are specified for the handler. The live handler is @@ -68,23 +68,23 @@ /** * Returns the ID for the handler. * - * @return The ID (never <code>null</code>). + * @return The ID (never {@code null}). */ String getID(); /** - * Returns <code>true</code> if the mouse handler is enabled, and - * <code>false</code> if it is disabled. + * Returns {@code true} if the mouse handler is enabled, and + * {@code false} if it is disabled. * * @return A boolean. */ boolean isEnabled(); /** - * Returns <code>true</code> if the specified mouse event has modifier + * Returns {@code true} if the specified mouse event has modifier * keys that match this handler. * - * @param e the mouse event (<code>null</code> not permitted). + * @param e the mouse event ({@code null} not permitted). * * @return A boolean. */ @@ -93,48 +93,48 @@ /** * Handles a mouse moved event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleMouseMoved(ChartCanvas canvas, MouseEvent e); /** * Handles a mouse clicked event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleMouseClicked(ChartCanvas canvas, MouseEvent e); /** * Handles a mouse pressed event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleMousePressed(ChartCanvas canvas, MouseEvent e); /** * Handles a mouse dragged event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleMouseDragged(ChartCanvas canvas, MouseEvent e); /** * Handles a mouse released event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleMouseReleased(ChartCanvas canvas, MouseEvent e); /** * Handles a scroll event. * - * @param canvas the canvas (<code>null</code> not permitted). - * @param e the event (<code>null</code> not permitted). + * @param canvas the canvas ({@code null} not permitted). + * @param e the event ({@code null} not permitted). */ void handleScroll(ChartCanvas canvas, ScrollEvent e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-27 10:49:50
|
Revision: 3137 http://sourceforge.net/p/jfreechart/code/3137 Author: mungady Date: 2014-06-27 10:49:47 +0000 (Fri, 27 Jun 2014) Log Message: ----------- Latest updates. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-27 10:49:27 UTC (rev 3136) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-27 10:49:47 UTC (rev 3137) @@ -1,3 +1,25 @@ +2014-06-27 David Gilbert <dav...@ob...> + + * org/jfree/chart/fx/ChartCanvas.java: New file, + * org/jfree/chart/fx/ChartViewer.java: Likewise, + * org/jfree/chart/fx/ChartViewerSkin.java: Likewise, + * org/jfree/chart/fx/FXGraphics2D.java: Likewise, + * org/jfree/chart/fx/chart-viewer.css: Likewise, + * org/jfree/chart/fx/demo/BarChartFXDemo1.java: Likewise, + * org/jfree/chart/fx/demo/PieChartFXDemo1.java: Likewise, + * org/jfree/chart/fx/demo/TimeSeriesChartFXDemo1.java: Likewise, + * org/jfree/chart/fx/interaction/AbstractMouseHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/AnchorHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/ChartMouseEventFX.java: Likewise, + * org/jfree/chart/fx/interaction/ChartMouseListenerFX.java: Likewise, + * org/jfree/chart/fx/interaction/DispatchHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/MouseHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/PanHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/ScrollHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/TooltipHandlerFX.java: Likewise, + * org/jfree/chart/fx/interaction/ZoomHandlerFX.java: Likewise, + * org/jfree/chart/utils/ExportUtils.java: Likewise. + 2014-06-25 David Gilbert <dav...@ob...> * org/jfree/chart/plot/PlotOrientation.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-27 10:49:34
|
Revision: 3136 http://sourceforge.net/p/jfreechart/code/3136 Author: mungady Date: 2014-06-27 10:49:27 +0000 (Fri, 27 Jun 2014) Log Message: ----------- Ignore new JavaFX packages for standard build. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ant/build.xml Modified: branches/jfreechart-1.0.x-branch/ant/build.xml =================================================================== --- branches/jfreechart-1.0.x-branch/ant/build.xml 2014-06-27 10:48:49 UTC (rev 3135) +++ branches/jfreechart-1.0.x-branch/ant/build.xml 2014-06-27 10:49:27 UTC (rev 3136) @@ -23,13 +23,13 @@ <property name="jfreechart.version" value="1.0.18-pre" /> <property name="jfreechart-bundle-file" value="${jfreechart.name}-${jfreechart.version}-bundle.jar" /> <property name="jcommon.name" value="jcommon" /> - <property name="jcommon.version" value="1.0.21" /> + <property name="jcommon.version" value="1.0.22" /> <property name="jcommon.jar" value="${basedir}/lib/${jcommon.name}-${jcommon.version}.jar"/> <property name="jfreesvg.name" value="jfreesvg" /> - <property name="jfreesvg.version" value="1.7" /> + <property name="jfreesvg.version" value="1.9" /> <property name="orsonpdf.name" value="orsonpdf" /> - <property name="orsonpdf.version" value="1.4-eval" /> - <property name="orsoncharts.version" value="1.0-eval" /> + <property name="orsonpdf.version" value="1.6-eval" /> + <property name="orsoncharts.version" value="1.4-eval" /> <property name="builddir" value="${basedir}/build" /> <property name="servlet.jar" value="${basedir}/lib/servlet.jar"/> <property name="junit.jar" value="${basedir}/lib/junit-4.11.jar"/> @@ -62,6 +62,7 @@ <classpath refid="build.classpath" /> <include name="org/jfree/**"/> <exclude name="org/jfree/chart/xml/**"/> + <exclude name="org/jfree/chart/fx/**"/> </javac> <!-- copy across gorilla.jpg --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-27 10:48:52
|
Revision: 3135 http://sourceforge.net/p/jfreechart/code/3135 Author: mungady Date: 2014-06-27 10:48:49 +0000 (Fri, 27 Jun 2014) Log Message: ----------- Build script that includes JavaFX support. Added Paths: ----------- branches/jfreechart-1.0.x-branch/ant/build-fx.xml Added: branches/jfreechart-1.0.x-branch/ant/build-fx.xml =================================================================== --- branches/jfreechart-1.0.x-branch/ant/build-fx.xml (rev 0) +++ branches/jfreechart-1.0.x-branch/ant/build-fx.xml 2014-06-27 10:48:49 UTC (rev 3135) @@ -0,0 +1,391 @@ +<!-- An ANT build file for JFreeChart --> + +<!-- Written by David Gilbert. --> + +<!-- Tested recently with Ant 1.8.2 --> +<!-- To run this script, you need to make sure the libraries used by --> +<!-- JFreeChart are copied to the ../lib directory (or edit the --> +<!-- initialise task to point to the appropriate jar files). --> + +<!-- This script will create temporary directories ../build and --> +<!-- ../distribution, as working areas. A ../javadoc directory will --> +<!-- be created for the Javadoc HTML pages. --> + +<!-- If you have comments about this script, please post a message --> +<!-- on the JFreeChart developers mailing list. --> + +<project name="jfreechart" default="all" basedir=".."> + + <!-- Initialisation. --> + <target name="initialise" description="Initialise required settings."> + <tstamp /> + <property name="jfreechart.name" value="jfreechart" /> + <property name="jfreechart.version" value="1.0.18-pre-fx" /> + <property name="jfreechart-bundle-file" value="${jfreechart.name}-${jfreechart.version}-bundle.jar" /> + <property name="jcommon.name" value="jcommon" /> + <property name="jcommon.version" value="1.0.22" /> + <property name="jcommon.jar" value="${basedir}/lib/${jcommon.name}-${jcommon.version}.jar"/> + <property name="jfreesvg.name" value="jfreesvg" /> + <property name="jfreesvg.version" value="1.9" /> + <property name="orsonpdf.name" value="orsonpdf" /> + <property name="orsonpdf.version" value="1.6-eval" /> + <property name="orsoncharts.version" value="1.4-eval" /> + <property name="builddir" value="${basedir}/build" /> + <property name="servlet.jar" value="${basedir}/lib/servlet.jar"/> + <property name="junit.jar" value="${basedir}/lib/junit-4.11.jar"/> + <property name="hamcrest.jar" value="${basedir}/lib/hamcrest-core-1.3.jar"/> + <property name="src.version" value="1.8"/> + <property name="target.version" value="1.8"/> + <path id="build.classpath"> + <fileset dir="${basedir}/lib/"> + <include name="${jcommon.name}-${jcommon.version}.jar"/> + <include name="servlet.jar"/> + </fileset> + </path> + + </target> + + <!-- Compile the JFreeChart classes --> + <target name="compile" depends="initialise" + description="Compile the JFreeChart source code."> + + <!-- create a temp build directory --> + <mkdir dir="${basedir}/build" /> + + <!-- compile the source --> + <javac srcdir="${basedir}/source" + destdir="${basedir}/build" + debug="on" + deprecation="false" + source="${src.version}" + target="${target.version}"> + <classpath refid="build.classpath" /> + <include name="org/jfree/**"/> + <exclude name="org/jfree/chart/xml/**"/> + </javac> + + <!-- copy across gorilla.jpg --> + <copy file="${basedir}/source/org/jfree/chart/gorilla.jpg" tofile="${basedir}/build/org/jfree/chart/gorilla.jpg" /> + + <!-- copy across .properties files --> + <copy todir="${basedir}/build/org/jfree/chart/"> + <fileset dir="${basedir}/source/org/jfree/chart"> + <include name="*.properties" /> + </fileset> + </copy> + <copy todir="${basedir}/build/org/jfree/chart/plot"> + <fileset dir="${basedir}/source/org/jfree/chart/plot"> + <include name="*.properties" /> + </fileset> + </copy> + <copy todir="${basedir}/build/org/jfree/chart/editor"> + <fileset dir="${basedir}/source/org/jfree/chart/editor"> + <include name="*.properties" /> + </fileset> + </copy> + + <!-- make the jar --> + <jar jarfile="${basedir}/lib/${jfreechart.name}-${jfreechart.version}.jar" + basedir="${basedir}/build" > + <manifest> + <attribute name="Specification-Title" value="JFreeChart" /> + <attribute name="Specification-Version" value="${jfreechart.version}" /> + <attribute name="Specification-Vendor" value="jfree.org" /> + <attribute name="Implementation-Title" value="JFreeChart" /> + <attribute name="Implementation-Version" value="${jfreechart.version}" /> + <attribute name="Implementation-Vendor" value="jfree.org" /> + </manifest> + </jar> + + <!-- delete the temp directory --> + <delete dir="${basedir}/build" /> + + </target> + + + <!-- Compile the experimental classes --> + <target name="compile-experimental" depends="compile" + description="Compile the JFreeChart experimental classes"> + + <!-- create a temp build directory --> + <mkdir dir="${basedir}/build" /> + + <path id="build.experimental.classpath"> + <pathelement location="${jcommon.jar}"/> + <pathelement location="${servlet.jar}"/> + <pathelement location="${basedir}/lib/${jfreechart.name}-${jfreechart.version}.jar"/> + </path> + + <!-- compile the source --> + <javac srcdir="${basedir}/experimental" + destdir="${basedir}/build" + debug="on" + deprecation="false" + source="${src.version}" + target="${target.version}"> + <classpath refid="build.experimental.classpath" /> + <include name="org/jfree/experimental/**"/> + <exclude name="org/jfree/experimental/**/junit/*"/> + </javac> + + <!-- make the jar --> + <jar jarfile="${basedir}/lib/${jfreechart.name}-${jfreechart.version}-experimental.jar" + basedir="${basedir}/build" > + </jar> + + <!-- delete the temp directory --> + <delete dir="${basedir}/build" /> + </target> + + + <!-- Generate the JFreeChart API HTML pages --> + <target name="javadoc" + description="Generate the Javadoc HTML pages." + depends="initialise"> + <delete dir="${basedir}/javadoc" /> + <mkdir dir="${basedir}/javadoc" /> + <javadoc destdir="${basedir}/javadoc" + windowtitle="JFreeChart Class Library (version ${jfreechart.version})" + overview="${basedir}/source/overview.html" + use="yes" + linksource="yes" + splitindex="yes"> + <classpath refid="build.classpath" /> + <packageset dir="${basedir}/source" defaultexcludes="yes"> + <include name="org/jfree/**"/> + <exclude name="org/jfree/chart/xml/**"/> + </packageset> + </javadoc> + <!-- copy across .png files --> + <copy todir="${basedir}/javadoc/images"> + <fileset dir="${basedir}/docfiles"> + <include name="*.png" /> + </fileset> + </copy> + </target> + + + <!-- Create zip file containing the API HTML pages. --> + <target name="zip-javadocs" + description="Create ZIP file containing Javadoc HTML pages." + depends="javadoc"> + <!-- make the zip file --> + <zip zipfile="${basedir}/${jfreechart.name}-${jfreechart.version}-javadocs.zip"> + <zipfileset dir="${basedir}/javadoc" + prefix="${jfreechart.name}-${jfreechart.version}-javadocs" /> + </zip> + </target> + + + <!-- Fill the 'distribution' directory. --> + <target name="fill-distribution" depends="compile"> + + <!-- delete the temporary distribution directory, if there is one --> + <delete dir="${basedir}/distribution" /> + + <!-- make a temporary distribution directory --> + <mkdir dir="${basedir}/distribution" /> + + <!-- copy across README and CHANGELOG --> + <copy file="${basedir}/README.txt" tofile="${basedir}/distribution/README.txt" /> + <copy file="${basedir}/NEWS" tofile="${basedir}/distribution/NEWS" /> + <copy file="${basedir}/ChangeLog" tofile="${basedir}/distribution/ChangeLog" /> + <copy file="${basedir}/pom.xml" tofile="${basedir}/distribution/pom.xml" /> + + <!-- copy across LICENCE --> + <copy file="${basedir}/licence-LGPL.txt" tofile="${basedir}/distribution/licence-LGPL.txt" /> + + <!-- copy across runtime jar file and demo jar file --> + <copy file="${basedir}/lib/${jfreechart.name}-${jfreechart.version}.jar" tofile="${basedir}/distribution/lib/${jfreechart.name}-${jfreechart.version}.jar" /> + <copy file="${basedir}/lib/${jfreechart.name}-${jfreechart.version}-experimental.jar" tofile="${basedir}/distribution/lib/${jfreechart.name}-${jfreechart.version}-experimental.jar" /> + <copy file="${basedir}/${jfreechart.name}-${jfreechart.version}-demo.jar" tofile="${basedir}/distribution/${jfreechart.name}-${jfreechart.version}-demo.jar" failonerror="false" /> + + <!-- copy across source files --> + <copy todir="${basedir}/distribution/source"> + <fileset dir="${basedir}/source"> + <exclude name="**/CVS/*"/> + <exclude name="org/jfree/chart/xml/**"/> + </fileset> + </copy> + + <copy todir="${basedir}/distribution/experimental"> + <fileset dir="${basedir}/experimental"> + <exclude name="**/CVS/*"/> + </fileset> + </copy> + + <copy todir="${basedir}/distribution/tests"> + <fileset dir="${basedir}/tests"> + <exclude name="**/CVS/*"/> + </fileset> + </copy> + + <copy todir="${basedir}/distribution/swt"> + <fileset dir="${basedir}/swt"> + <exclude name="**/CVS/*"/> + </fileset> + </copy> + + <copy todir="${basedir}/distribution/docfiles"> + <fileset dir="${basedir}/docfiles"> + </fileset> + </copy> + + <!-- copy across lib files --> + <copy file="${jcommon.jar}" tofile="${basedir}/distribution/lib/${jcommon.name}-${jcommon.version}.jar" /> + <copy file="${basedir}/lib/swtgraphics2d.jar" tofile="${basedir}/distribution/lib/swtgraphics2d.jar" failonerror="false" /> + <copy file="${basedir}/lib/jfreechart-${jfreechart.version}-swt.jar" tofile="${basedir}/distribution/lib/${jfreechart.name}-${jfreechart.version}-swt.jar" failonerror="false" /> + <copy file="${servlet.jar}" tofile="${basedir}/distribution/lib/servlet.jar" /> + <copy file="${junit.jar}" tofile="${basedir}/distribution/lib/junit-4.11.jar" /> + <copy file="${hamcrest.jar}" tofile="${basedir}/distribution/lib/hamcrest-core-1.3.jar" /> + <copy file="${basedir}/lib/${jfreesvg.name}-${jfreesvg.version}.jar" tofile="${basedir}/distribution/lib/${jfreesvg.name}-${jfreesvg.version}.jar" /> + <copy file="${basedir}/lib/${orsonpdf.name}-${orsonpdf.version}.jar" tofile="${basedir}/distribution/lib/${orsonpdf.name}-${orsonpdf.version}.jar" /> + <copy file="${basedir}/lib/orsoncharts-${orsoncharts.version}.jar" tofile="${basedir}/distribution/lib/orsoncharts-${orsoncharts.version}.jar" failonerror="false" /> + + <!-- copy across ant build files --> + <copy file="${basedir}/ant/build.xml" tofile="${basedir}/distribution/ant/build.xml" /> + <copy file="${basedir}/ant/build-swt.xml" tofile="${basedir}/distribution/ant/build-swt.xml" /> + + <!-- copy across checkstyle property file --> + <copy todir="${basedir}/distribution/checkstyle"> + <fileset dir="${basedir}/checkstyle" /> + </copy> + + <!-- convert end-of-line characters in text files --> + <fixcrlf srcdir="${basedir}/distribution/source" + eol="crlf" eof="remove" + excludes="**/*.jpg" /> + + <fixcrlf srcdir="${basedir}/distribution/experimental" + eol="lf" eof="remove" + excludes="**/*.jpg" /> + + <fixcrlf srcdir="${basedir}/distribution/swt" + eol="lf" eof="remove" + excludes="**/*.jpg" /> + + <fixcrlf srcdir="${basedir}/distribution/tests" + eol="lf" eof="remove" + excludes="**/*.jpg" /> + + </target> + + <!-- Make .zip distribution for JFreeChart --> + <target name="zip" depends="fill-distribution"> + + <!-- make the zip file --> + <zip zipfile="${basedir}/${jfreechart.name}-${jfreechart.version}.zip"> + <zipfileset dir="${basedir}/distribution" + prefix="${jfreechart.name}-${jfreechart.version}" /> + </zip> + + </target> + + <!-- Make .tar.gz distribution for JFreeChart --> + <target name="targz" depends="fill-distribution"> + + <!-- make the tar.gz file --> + <tar tarfile="${basedir}/${jfreechart.name}-${jfreechart.version}.tar"> + <tarfileset dir="${basedir}/distribution" + prefix="${jfreechart.name}-${jfreechart.version}" /> + </tar> + <gzip zipfile="${basedir}/${jfreechart.name}-${jfreechart.version}.tar.gz" + src="${basedir}/${jfreechart.name}-${jfreechart.version}.tar" /> + <delete file="${basedir}/${jfreechart.name}-${jfreechart.version}.tar" /> + + </target> + + <target name="maven-bundle" depends="zip" > + <!-- make a temporary distribution directory --> + <mkdir dir="distribution"/> + <!-- copy across LICENCE --> + <copy file="licence-LGPL.txt" tofile="distribution/LICENSE.txt"/> + + <filterchain id="version.filters"> + <replacetokens> + <token key="VERSION" value="${jfreechart.version}"/> + <token key="JCOMMON.VERSION" value="${jcommon.version}"/> + </replacetokens> + </filterchain> + <copy file="pom.xml" tofile="distribution/pom.xml"> + <filterchain refid="version.filters"/> + </copy> + + <!-- copy across runtime jar file --> + <copy file="lib/${jfreechart.name}-${jfreechart.version}.jar" tofile="distribution/${jfreechart.name}-${jfreechart.version}.jar"/> + + <!-- make the jar --> + <jar jarfile="${jfreechart-bundle-file}" basedir="distribution"/> + + <!-- delete the temporary distribution directory --> + <delete dir="distribution"/> + </target> + + + <!-- COMPILE THE JUNIT TESTS. --> + <target name="compile-tests" + depends="compile,compile-experimental" + description="Compile the test code"> + + <mkdir dir="${basedir}/build-tests"/> + <javac srcdir="${basedir}/tests" + destdir="${basedir}/build-tests" + source="1.6" + target="1.6" + debug="true" + deprecation="false" + optimize="false"> + <classpath> + <path refid="build.classpath"/> + <pathelement location="${junit.jar}"/> + <pathelement location="${hamcrest.jar}"/> + <pathelement location="${basedir}/lib/${jfreechart.name}-${jfreechart.version}.jar"/> + <pathelement location="${basedir}/lib/${jfreechart.name}-${jfreechart.version}-experimental.jar"/> + <pathelement location="${basedir}/build-tests"/> + </classpath> + </javac> + + </target> + + + <!-- RUN THE JUNIT TESTS. --> + <target name="test" + depends="compile-tests" + description="Run the test cases"> + + <mkdir dir="${basedir}/build-tests-reports"/> + + <junit printSummary="yes" + haltonerror="false" + haltonfailure="false" + fork="false" + dir="."> + + <sysproperty key="basedir" value="."/> + <formatter type="plain" usefile="false"/> + <classpath> + <path refid="build.classpath"/> + <pathelement location="${junit.jar}"/> + <pathelement location="${hamcrest.jar}"/> + <pathelement location="${basedir}/lib/${jfreechart.name}-${jfreechart.version}.jar"/> + <pathelement location="${basedir}/lib/${jfreechart.name}-${jfreechart.version}-experimental.jar"/> + <pathelement location="${basedir}/build-tests"/> + </classpath> + <batchtest todir="${basedir}/build-tests-reports"> + <fileset dir="${basedir}/tests"> + <include name="**/*Test.java"/> + </fileset> + </batchtest> + </junit> + </target> + + <!-- ALL --> + <target name="all" + depends="compile,compile-experimental,zip-javadocs,zip,targz,maven-bundle" + description="Compiles JFreeChart, builds the jar files, generates the Javadoc HTML pages and creates distribution files (.zip and .tar.gz)."> + + <!-- delete the temporary distribution directory --> + <delete dir="${basedir}/distribution" /> + </target> + +</project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-27 10:43:42
|
Revision: 3134 http://sourceforge.net/p/jfreechart/code/3134 Author: mungady Date: 2014-06-27 10:43:29 +0000 (Fri, 27 Jun 2014) Log Message: ----------- 2014-06-27 David Gilbert <dav...@ob...> * org/jfree/chart/fx/ChartCanvas.java: New file, * org/jfree/chart/fx/ChartViewer.java: Likewise, * org/jfree/chart/fx/ChartViewerSkin.java: Likewise, * org/jfree/chart/fx/FXGraphics2D.java: Likewise, * org/jfree/chart/fx/chart-viewer.css: Likewise, * org/jfree/chart/fx/demo/BarChartFXDemo1.java: Likewise, * org/jfree/chart/fx/demo/PieChartFXDemo1.java: Likewise, * org/jfree/chart/fx/demo/TimeSeriesChartFXDemo1.java: Likewise, * org/jfree/chart/fx/interaction/AbstractMouseHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/AnchorHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/ChartMouseEventFX.java: Likewise, * org/jfree/chart/fx/interaction/ChartMouseListenerFX.java: Likewise, * org/jfree/chart/fx/interaction/DispatchHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/MouseHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/PanHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/ScrollHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/TooltipHandlerFX.java: Likewise, * org/jfree/chart/fx/interaction/ZoomHandlerFX.java: Likewise, * org/jfree/chart/utils/ExportUtils.java: Likewise. Added Paths: ----------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartCanvas.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewerSkin.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/FXGraphics2D.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/chart-viewer.css branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/demo/ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/demo/BarChartFXDemo1.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/demo/PieChartFXDemo1.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/demo/TimeSeriesChartFXDemo1.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/demo/package-info.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/AbstractMouseHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/AnchorHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseEventFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ChartMouseListenerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/DispatchHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/MouseHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/PanHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ScrollHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/TooltipHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/ZoomHandlerFX.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/interaction/package-info.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/package-info.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/ExportUtils.java Added: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartCanvas.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartCanvas.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartCanvas.java 2014-06-27 10:43:29 UTC (rev 3134) @@ -0,0 +1,555 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * ---------------- + * ChartCanvas.java + * ---------------- + * (C) Copyright 2014, by Object Refinery Limited and Contributors. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes: + * -------- + * 25-Jun-2014 : Version 1 (DG); + * + */ + +package org.jfree.chart.fx; + +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.util.ArrayList; +import java.util.List; +import javafx.scene.canvas.Canvas; +import javafx.scene.control.Tooltip; +import javafx.scene.input.MouseEvent; +import javafx.scene.input.ScrollEvent; +import org.jfree.chart.ChartMouseEvent; +import org.jfree.chart.ChartRenderingInfo; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.entity.ChartEntity; +import org.jfree.chart.event.ChartChangeEvent; +import org.jfree.chart.event.ChartChangeListener; +import org.jfree.chart.fx.interaction.AnchorHandlerFX; +import org.jfree.chart.fx.interaction.DispatchHandlerFX; +import org.jfree.chart.fx.interaction.ChartMouseEventFX; +import org.jfree.chart.fx.interaction.ChartMouseListenerFX; +import org.jfree.chart.fx.interaction.TooltipHandlerFX; +import org.jfree.chart.fx.interaction.ScrollHandlerFX; +import org.jfree.chart.fx.interaction.PanHandlerFX; +import org.jfree.chart.fx.interaction.MouseHandlerFX; +import org.jfree.chart.plot.PlotRenderingInfo; +import org.jfree.chart.util.ParamChecks; + +/** + * A canvas for displaying a {@link JFreeChart} in JavaFX. You can use the + * canvas directly to display charts, but usually the {@link ChartViewer} + * class (which embeds a canvas) is a better option. + * <p> + * The canvas installs several default mouse handlers, if you don't like the + * behaviour provided by these you can retrieve the handler by ID and + * disable or remove it (the IDs are "tooltip", "scroll", "anchor", "pan" and + * "dispatch"). + * + * <p>THE API FOR THIS CLASS IS SUBJECT TO CHANGE IN FUTURE RELEASES. This is + * so that we can incorporate feedback on the (new) JavaFX support in + * JFreeChart.</p> + * + * @since 1.0.18 + */ +public class ChartCanvas extends Canvas implements ChartChangeListener { + + /** The chart being displayed in the canvas (never null). */ + private JFreeChart chart; + + /** + * The graphics drawing context (will be an instance of FXGraphics2D). + */ + private Graphics2D g2; + + /** + * The anchor point (can be null) is usually updated to reflect the most + * recent mouse click and is used during chart rendering to update + * crosshairs belonging to the chart. + */ + private Point2D anchor; + + /** The chart rendering info from the most recent drawing of the chart. */ + private ChartRenderingInfo info; + + /** The tooltip object for the canvas (can be null). */ + private Tooltip tooltip; + + /** + * A flag that controls whether or not tooltips will be generated from the + * chart as the mouse pointer moves over it. + */ + private boolean tooltipEnabled; + + /** Storage for registered chart mouse listeners. */ + private transient List<ChartMouseListenerFX> chartMouseListeners; + + /** The current live handler (can be null). */ + private MouseHandlerFX liveHandler; + + /** + * The list of available live mouse handlers (can be empty but not null). + */ + private List<MouseHandlerFX> availableMouseHandlers; + + /** The auxiliary mouse handlers (can be empty but not null). */ + private List<MouseHandlerFX> auxiliaryMouseHandlers; + + /** + * Creates a new canvas to display the supplied chart in JavaFX. + * + * @param chart the chart ({@code null} not permitted). + */ + public ChartCanvas(JFreeChart chart) { + ParamChecks.nullNotPermitted(chart, "chart"); + this.chart = chart; + this.chart.addChangeListener(this); + this.tooltip = null; + this.tooltipEnabled = true; + this.chartMouseListeners = new ArrayList<ChartMouseListenerFX>(); + + widthProperty().addListener(evt -> draw()); + heightProperty().addListener(evt -> draw()); + this.g2 = new FXGraphics2D(getGraphicsContext2D()); + this.liveHandler = null; + this.availableMouseHandlers = new ArrayList<MouseHandlerFX>(); + + this.availableMouseHandlers.add(new PanHandlerFX("pan", true, false, + false, false)); + + this.auxiliaryMouseHandlers = new ArrayList<MouseHandlerFX>(); + this.auxiliaryMouseHandlers.add(new TooltipHandlerFX("tooltip")); + this.auxiliaryMouseHandlers.add(new ScrollHandlerFX("scroll")); + this.auxiliaryMouseHandlers.add(new AnchorHandlerFX("anchor")); + this.auxiliaryMouseHandlers.add(new DispatchHandlerFX("dispatch")); + + setOnMouseMoved((MouseEvent e) -> { handleMouseMoved(e); }); + setOnMouseClicked((MouseEvent e) -> { handleMouseClicked(e); }); + setOnMousePressed((MouseEvent e) -> { handleMousePressed(e); }); + setOnMouseDragged((MouseEvent e) -> { handleMouseDragged(e); }); + setOnMouseReleased((MouseEvent e) -> { handleMouseReleased(e); }); + setOnScroll((ScrollEvent event) -> { handleScroll(event); }); + } + + /** + * Returns the chart that is being displayed by this node. + * + * @return The chart (never {@code null}). + */ + public JFreeChart getChart() { + return this.chart; + } + + /** + * Sets the chart to be displayed by this node. + * + * @param chart the chart ({@code null} not permitted). + */ + public void setChart(JFreeChart chart) { + ParamChecks.nullNotPermitted(chart, "chart"); + this.chart.removeChangeListener(this); + this.chart = chart; + this.chart.addChangeListener(this); + draw(); + } + + /** + * Returns the rendering info from the most recent drawing of the chart. + * + * @return The rendering info (possibly {@code null}). + */ + public ChartRenderingInfo getRenderingInfo() { + return this.info; + } + + /** + * Returns the flag that controls whether or not tooltips are enabled. + * The default value is {@code true}. The {@link ToolTipHandlerFX} + * class will only update the tooltip if this flag is set to + * {@code true}. + * + * @return The flag. + */ + public boolean isTooltipEnabled() { + return this.tooltipEnabled; + } + + /** + * Sets the flag that controls whether or not tooltips are enabled. + * + * @param tooltipEnabled the new flag value. + */ + public void setTooltipEnabled(boolean tooltipEnabled) { + this.tooltipEnabled = tooltipEnabled; + } + + /** + * Set the anchor point and forces a redraw of the chart (the anchor point + * is used to determine the position of the crosshairs on the chart, if + * they are visible). + * + * @param anchor the anchor ({@code null} permitted). + */ + public void setAnchor(Point2D anchor) { + this.anchor = anchor; + this.chart.setNotify(true); // force a redraw + } + + /** + * Registers a listener to receive {@link ChartMouseEvent} notifications. + * + * @param listener the listener ({@code null} not permitted). + */ + public void addChartMouseListener(ChartMouseListenerFX listener) { + ParamChecks.nullNotPermitted(listener, "listener"); + this.chartMouseListeners.add(listener); + } + + /** + * Removes a listener from the list of objects listening for chart mouse + * events. + * + * @param listener the listener. + */ + public void removeChartMouseListener(ChartMouseListenerFX listener) { + this.chartMouseListeners.remove(listener); + } + + /** + * Returns the mouse handler with the specified ID, or {@code null} if + * there is no handler with that ID. This method will look for handlers + * in both the regular and auxiliary handler lists. + * + * @param id the ID ({@code null} not permitted). + * + * @return The handler with the specified ID + */ + public MouseHandlerFX getMouseHandler(String id) { + for (MouseHandlerFX h: this.availableMouseHandlers) { + if (h.getID().equals(id)) { + return h; + } + } + for (MouseHandlerFX h: this.auxiliaryMouseHandlers) { + if (h.getID().equals(id)) { + return h; + } + } + return null; + } + + /** + * Adds a mouse handler to the list of available handlers (handlers that + * are candidates to take the position of live handler). The handler must + * have an ID that uniquely identifies it amongst the handlers registered + * with this canvas. + * + * @param handler the handler ({@code null} not permitted). + */ + public void addMouseHandler(MouseHandlerFX handler) { + if (!this.hasUniqueID(handler)) { + throw new IllegalArgumentException( + "There is already a handler with that ID (" + + handler.getID() + ")."); + } + this.availableMouseHandlers.add(handler); + } + + /** + * Removes a handler from the list of available handlers. + * + * @param handler the handler ({@code null} not permitted). + */ + public void removeMouseHandler(MouseHandlerFX handler) { + this.availableMouseHandlers.remove(handler); + } + + /** + * Validates that the specified handler has an ID that uniquely identifies + * it amongst the existing handlers for this canvas. + * + * @param handler the handler ({@code null} not permitted). + * + * @return A boolean. + */ + private boolean hasUniqueID(MouseHandlerFX handler) { + for (MouseHandlerFX h: this.availableMouseHandlers) { + if (handler.getID().equals(h.getID())) { + return false; + } + } + for (MouseHandlerFX h: this.auxiliaryMouseHandlers) { + if (handler.getID().equals(h.getID())) { + return false; + } + } + return true; + } + + /** + * Clears the current live handler. This method is intended for use by the + * handlers themselves, you should not call it directly. + */ + public void clearLiveHandler() { + this.liveHandler = null; + } + + /** + * Draws the content of the canvas and updates the + * {@code renderingInfo} attribute with the latest rendering + * information. + */ + public final void draw() { + getGraphicsContext2D().save(); + double width = getWidth(); + double height = getHeight(); + if (width > 0 && height > 0) { + this.info = new ChartRenderingInfo(); + this.chart.draw(this.g2, new Rectangle((int) width, (int) height), + this.anchor, this.info); + } + getGraphicsContext2D().restore(); + this.anchor = null; + } + + /** + * Returns the data area (the area inside the axes) for the plot or subplot. + * + * @param point the selection point (for subplot selection). + * + * @return The data area. + */ + public Rectangle2D findDataArea(Point2D point) { + PlotRenderingInfo plotInfo = this.info.getPlotInfo(); + Rectangle2D result; + if (plotInfo.getSubplotCount() == 0) { + result = plotInfo.getDataArea(); + } + else { + int subplotIndex = plotInfo.getSubplotIndex(point); + if (subplotIndex == -1) { + return null; + } + result = plotInfo.getSubplotInfo(subplotIndex).getDataArea(); + } + return result; + } + + /** + * Return {@code true} to indicate the canvas is resizable. + * + * @return {@code true}. + */ + @Override + public boolean isResizable() { + return true; + } + + /** + * Sets the tooltip text, with the (x, y) location being used for the + * anchor. If the text is {@code null}, no tooltip will be displayed. + * This method is intended for calling by the {@link TooltipHandlerFX} + * class, you won't normally call it directly. + * + * @param text the text ({@code null} permitted). + * @param x the x-coordinate of the mouse pointer. + * @param y the y-coordinate of the mouse pointer. + */ + public void setTooltip(String text, double x, double y) { + if (text != null) { + if (this.tooltip == null) { + this.tooltip = new Tooltip(text); + Tooltip.install(this, this.tooltip); + } else { + this.tooltip.setText(text); + this.tooltip.setAnchorX(x); + this.tooltip.setAnchorY(y); + } + } else { + Tooltip.uninstall(this, this.tooltip); + this.tooltip = null; + } + } + + /** + * Handles a mouse pressed event by (1) selecting a live handler if one + * is not already selected, (2) passing the event to the live handler if + * there is one, and (3) passing the event to all enabled auxiliary + * handlers. + * + * @param e the mouse event. + */ + private void handleMousePressed(MouseEvent e) { + if (this.liveHandler == null) { + for (MouseHandlerFX handler: this.availableMouseHandlers) { + if (handler.isEnabled() && handler.hasMatchingModifiers(e)) { + this.liveHandler = handler; + } + } + } + + if (this.liveHandler != null) { + this.liveHandler.handleMousePressed(this, e); + } + + // pass on the event to the auxiliary handlers + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleMousePressed(this, e); + } + } + } + + /** + * Handles a mouse moved event by passing it on to the registered handlers. + * + * @param e the mouse event. + */ + private void handleMouseMoved(MouseEvent e) { + if (this.liveHandler != null && this.liveHandler.isEnabled()) { + this.liveHandler.handleMouseMoved(this, e); + } + + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleMouseMoved(this, e); + } + } + } + + /** + * Handles a mouse dragged event by passing it on to the registered + * handlers. + * + * @param e the mouse event. + */ + private void handleMouseDragged(MouseEvent e) { + if (this.liveHandler != null && this.liveHandler.isEnabled()) { + this.liveHandler.handleMouseDragged(this, e); + } + + // pass on the event to the auxiliary handlers + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleMouseDragged(this, e); + } + } + } + + /** + * Handles a mouse released event by passing it on to the registered + * handlers. + * + * @param e the mouse event. + */ + private void handleMouseReleased(MouseEvent e) { + if (this.liveHandler != null && this.liveHandler.isEnabled()) { + this.liveHandler.handleMouseReleased(this, e); + } + + // pass on the event to the auxiliary handlers + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleMouseReleased(this, e); + } + } + } + + /** + * Handles a mouse released event by passing it on to the registered + * handlers. + * + * @param e the mouse event. + */ + private void handleMouseClicked(MouseEvent e) { + if (this.liveHandler != null && this.liveHandler.isEnabled()) { + this.liveHandler.handleMouseClicked(this, e); + } + + // pass on the event to the auxiliary handlers + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleMouseClicked(this, e); + } + } + } + + /** + * Handles a scroll event by passing it on to the registered handlers. + * + * @param e the scroll event. + */ + protected void handleScroll(ScrollEvent e) { + if (this.liveHandler != null && this.liveHandler.isEnabled()) { + this.liveHandler.handleScroll(this, e); + } + for (MouseHandlerFX handler: this.auxiliaryMouseHandlers) { + if (handler.isEnabled()) { + handler.handleScroll(this, e); + } + } + } + + /** + * Receives a notification from the chart that it has been changed and + * responds by redrawing the chart entirely. + * + * @param event event information. + */ + @Override + public void chartChanged(ChartChangeEvent event) { + draw(); + } + + public void dispatchMouseMovedEvent(Point2D point, MouseEvent e) { + double x = point.getX(); + double y = point.getY(); + ChartEntity entity = this.info.getEntityCollection().getEntity(x, y); + ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity); + for (ChartMouseListenerFX listener : this.chartMouseListeners) { + listener.chartMouseMoved(event); + } + } + + public void dispatchMouseClickedEvent(Point2D point, MouseEvent e) { + double x = point.getX(); + double y = point.getY(); + ChartEntity entity = this.info.getEntityCollection().getEntity(x, y); + ChartMouseEventFX event = new ChartMouseEventFX(this.chart, e, entity); + for (ChartMouseListenerFX listener : this.chartMouseListeners) { + listener.chartMouseClicked(event); + } + } +} + Added: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewer.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewer.java 2014-06-27 10:43:29 UTC (rev 3134) @@ -0,0 +1,338 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * ---------------- + * ChartViewer.java + * ---------------- + * (C) Copyright 2014, by Object Refinery Limited and Contributors. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes: + * -------- + * 27-Jun-2014 : Version 1 (DG); + * + */ + +package org.jfree.chart.fx; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javafx.event.ActionEvent; +import javafx.scene.control.ContextMenu; +import javafx.scene.control.Control; +import javafx.scene.control.Menu; +import javafx.scene.control.MenuItem; +import javafx.scene.control.Skinnable; +import javafx.stage.FileChooser; +import javafx.stage.WindowEvent; +import org.jfree.chart.ChartMouseEvent; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.fx.interaction.ChartMouseEventFX; +import org.jfree.chart.fx.interaction.ChartMouseListenerFX; +import org.jfree.chart.util.ExportUtils; +import org.jfree.chart.util.ParamChecks; + +/** + * A control for displaying a {@link JFreeChart} in JavaFX (embeds a + * {@link ChartCanvas}, adds drag zooming and provides a popup menu for export + * to PNG/JPG/SVG and PDF formats). Many behaviours(tooltips, zooming etc) are + * provided directly by the canvas. + * + * <p>THE API FOR THIS CLASS IS SUBJECT TO CHANGE IN FUTURE RELEASES. This is + * so that we can incorporate feedback on the (new) JavaFX support in + * JFreeChart.</p> + * + * @since 1.0.18 + */ +public class ChartViewer extends Control implements Skinnable, + ChartMouseListenerFX { + + /** The chart to display. */ + private JFreeChart chart; + + /** The context menu that will be attached to the canvas. */ + private ContextMenu contextMenu; + + /** Does the viewer show tooltips from the chart? */ + private boolean tooltipEnabled; + + /** Storage for registered chart mouse listeners. */ + private transient List<ChartMouseListenerFX> chartMouseListeners; + + /** + * Creates a new viewer to display the supplied chart in JavaFX. + * + * @param chart the chart ({@code null} not permitted). + */ + public ChartViewer(JFreeChart chart) { + this(chart, true); + } + + /** + * Creates a new viewer instance. + * + * @param chart the chart ({@code null} not permitted). + * @param contextMenuEnabled enable the context menu? + */ + public ChartViewer(JFreeChart chart, boolean contextMenuEnabled) { + ParamChecks.nullNotPermitted(chart, "chart"); + this.chart = chart; + getStyleClass().add("chart-control"); + this.contextMenu = createContextMenu(); + this.contextMenu.setOnShowing((WindowEvent event) -> { + ChartViewer.this.setTooltipEnabled(false); + }); + this.contextMenu.setOnHiding((WindowEvent event) -> { + ChartViewer.this.setTooltipEnabled(true); + }); + setContextMenu(this.contextMenu); + this.tooltipEnabled = true; + this.chartMouseListeners = new ArrayList<ChartMouseListenerFX>(); + } + + @Override + protected String getUserAgentStylesheet() { + return ChartViewer.class.getResource("chart-viewer.css") + .toExternalForm(); + } + + /** + * Returns the chart that is being displayed by this node. + * + * @return The chart (never {@code null}). + */ + public JFreeChart getChart() { + return this.chart; + } + + /** + * Sets the chart to be displayed by this node. + * + * @param chart the chart ({@code null} not permitted). + */ + public void setChart(JFreeChart chart) { + ParamChecks.nullNotPermitted(chart, "chart"); + this.chart = chart; + ChartViewerSkin skin = (ChartViewerSkin) getSkin(); + skin.setChart(chart); + } + + /** + * Returns the flag that controls whether or not tooltips are displayed + * for the chart. + * + * @return A boolean. + */ + public boolean isTooltipEnabled() { + return this.tooltipEnabled; + } + + /** + * Sets the flag that controls whether or not the chart tooltips are shown + * by this viewer. + * + * @param enabled the new flag value. + */ + public void setTooltipEnabled(boolean enabled) { + this.tooltipEnabled = enabled; + ChartViewerSkin skin = (ChartViewerSkin) getSkin(); + if (skin != null) { + skin.setTooltipEnabled(enabled); + } + } + + /** + * Hides the zoom rectangle. The work is delegated to the control's + * current skin. + */ + public void hideZoomRectangle() { + ChartViewerSkin skin = (ChartViewerSkin) getSkin(); + skin.setZoomRectangleVisible(false); + } + + /** + * Sets the size and location of the zoom rectangle and makes it visible + * if it wasn't already visible. The work is delegated to the control's + * current skin. + * + * @param x the x-location. + * @param y the y-location. + * @param w the width. + * @param h the height. + */ + public void showZoomRectangle(double x, double y, double w, double h) { + ChartViewerSkin skin = (ChartViewerSkin) getSkin(); + skin.showZoomRectangle(x, y, w, h); + } + + /** + * Registers a listener to receive {@link ChartMouseEvent} notifications + * from this viewer. + * + * @param listener the listener ({@code null} not permitted). + */ + public void addChartMouseListener(ChartMouseListenerFX listener) { + ParamChecks.nullNotPermitted(listener, "listener"); + this.chartMouseListeners.add(listener); + } + + /** + * Removes a listener from the list of objects listening for chart mouse + * events. + * + * @param listener the listener. + */ + public void removeChartMouseListener(ChartMouseListenerFX listener) { + ParamChecks.nullNotPermitted(listener, "listener"); + this.chartMouseListeners.remove(listener); + } + + /** + * Creates the context menu. + * + * @return The context menu. + */ + private ContextMenu createContextMenu() { + final ContextMenu menu = new ContextMenu(); + + Menu export = new Menu("Export As"); + + MenuItem pngItem = new MenuItem("PNG..."); + pngItem.setOnAction((ActionEvent e) -> { handleExportToPNG(); }); + export.getItems().add(pngItem); + + MenuItem jpegItem = new MenuItem("JPEG..."); + jpegItem.setOnAction((ActionEvent e) -> { handleExportToJPEG(); }); + export.getItems().add(jpegItem); + + if (ExportUtils.isOrsonPDFAvailable()) { + MenuItem pdfItem = new MenuItem("PDF..."); + pdfItem.setOnAction((ActionEvent e) -> { + handleExportToPDF(); + }); + export.getItems().add(pdfItem); + } + if (ExportUtils.isJFreeSVGAvailable()) { + MenuItem svgItem = new MenuItem("SVG..."); + svgItem.setOnAction((ActionEvent e) -> { + handleExportToSVG(); + }); + export.getItems().add(svgItem); + } + menu.getItems().add(export); + return menu; + } + + /** + * A handler for the export to PDF option in the context menu. + */ + private void handleExportToPDF() { + FileChooser fileChooser = new FileChooser(); + fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter( + "Portable Document Format (PDF)", "pdf")); + fileChooser.setTitle("Export to PDF"); + File file = fileChooser.showSaveDialog(this.getScene().getWindow()); + if (file != null) { + ExportUtils.writeAsPDF(this.chart, (int) getWidth(), + (int) getHeight(), file); + } + } + + /** + * A handler for the export to SVG option in the context menu. + */ + private void handleExportToSVG() { + FileChooser fileChooser = new FileChooser(); + fileChooser.setTitle("Export to SVG"); + fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter( + "Scalable Vector Graphics (SVG)", "svg")); + File file = fileChooser.showSaveDialog(this.getScene().getWindow()); + if (file != null) { + ExportUtils.writeAsSVG(this.chart, (int) getWidth(), + (int) getHeight(), file); + } + } + + /** + * A handler for the export to PNG option in the context menu. + */ + private void handleExportToPNG() { + FileChooser fileChooser = new FileChooser(); + fileChooser.setTitle("Export to PNG"); + fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter( + "Portable Network Graphics (PNG)", "png")); + File file = fileChooser.showSaveDialog(this.getScene().getWindow()); + if (file != null) { + try { + ExportUtils.writeAsPNG(this.chart, (int) getWidth(), + (int) getHeight(), file); + } catch (IOException ex) { + // FIXME: show a dialog with the error + } + } + } + + /** + * A handler for the export to JPEG option in the context menu. + */ + private void handleExportToJPEG() { + FileChooser fileChooser = new FileChooser(); + fileChooser.setTitle("Export to JPEG"); + fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter( + "JPEG", "jpg")); + File file = fileChooser.showSaveDialog(this.getScene().getWindow()); + if (file != null) { + try { + ExportUtils.writeAsJPEG(this.chart, (int) getWidth(), + (int) getHeight(), file); + } catch (IOException ex) { + // FIXME: show a dialog with the error + } + } + } + + @Override + public void chartMouseClicked(ChartMouseEventFX event) { + // relay the event from the canvas to our registered listeners + for (ChartMouseListenerFX listener: this.chartMouseListeners) { + listener.chartMouseClicked(event); + } + } + + @Override + public void chartMouseMoved(ChartMouseEventFX event) { + // relay the event from the canvas to our registered listeners + for (ChartMouseListenerFX listener: this.chartMouseListeners) { + listener.chartMouseMoved(event); + } + } + +} + Added: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewerSkin.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewerSkin.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/ChartViewerSkin.java 2014-06-27 10:43:29 UTC (rev 3134) @@ -0,0 +1,192 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * -------------------- + * ChartViewerSkin.java + * -------------------- + * (C) Copyright 2014, by Object Refinery Limited and Contributors. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + * + * Changes: + * -------- + * 20-Jun-2014 : Version 1 (DG); + */ + + +package org.jfree.chart.fx; + +import org.jfree.chart.fx.interaction.ZoomHandlerFX; +import javafx.scene.control.SkinBase; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.paint.Paint; +import javafx.scene.shape.Rectangle; +import org.jfree.chart.ChartMouseEvent; +import org.jfree.chart.JFreeChart; +import org.jfree.chart.fx.interaction.ChartMouseListenerFX; +import org.jfree.chart.util.ParamChecks; + +/** + * A default skin for the {@link ChartViewer} control. + * + * <p>THE API FOR THIS CLASS IS SUBJECT TO CHANGE IN FUTURE RELEASES. This is + * so that we can incorporate feedback on the (new) JavaFX support in + * JFreeChart.</p> + * + * @since 1.0.18 + */ +public class ChartViewerSkin extends SkinBase<ChartViewer> { + + /** The chart canvas. */ + private ChartCanvas canvas; + + /** + * The zoom rectangle is used to display the zooming region when + * doing a drag-zoom with the mouse. Most of the time this rectangle + * is not visible. + */ + private Rectangle zoomRectangle; + + /** + * Creates a new instance. + * + * @param control the control ({@code null} not permitted). + */ + public ChartViewerSkin(ChartViewer control) { + super(control); + getChildren().add(createNode(control)); + this.zoomRectangle = new Rectangle(0, 0, new Color(0, 0, 1, 0.25)); + this.zoomRectangle.setManaged(false); + this.zoomRectangle.setVisible(false); + getChildren().add(this.zoomRectangle); + } + + /** + * Sets the chart displayed by this control. + * + * @param chart the chart ({@code null} not permitted). + */ + public void setChart(JFreeChart chart) { + this.canvas.setChart(chart); + } + + public void setTooltipEnabled(boolean enabled) { + this.canvas.setTooltipEnabled(enabled); + } + + /** + * Returns the current fill paint for the zoom rectangle. + * + * @return The fill paint. + */ + public Paint getZoomFillPaint() { + return this.zoomRectangle.getFill(); + } + + /** + * Sets the fill paint for the zoom rectangle. + * + * @param paint the new paint. + */ + public void setZoomFillPaint(Paint paint) { + this.zoomRectangle.setFill(paint); + } + + /** + * Registers a listener to receive {@link ChartMouseEvent} notifications + * from the chart viewer. + * + * @param listener the listener ({@code null} not permitted). + */ + public void addChartMouseListener(ChartMouseListenerFX listener) { + ParamChecks.nullNotPermitted(listener, "listener"); + this.canvas.addChartMouseListener(listener); + } + + /** + * Removes a listener from the list of objects listening for chart mouse + * events. + * + * @param listener the listener. + */ + public void removeChartMouseListener(ChartMouseListenerFX listener) { + this.canvas.removeChartMouseListener(listener); + } + + /** + * Sets the visibility of the zoom rectangle. + * + * @param visible + */ + public void setZoomRectangleVisible(boolean visible) { + this.zoomRectangle.setVisible(visible); + } + + /** + * Sets the location and size of the zoom rectangle and makes it visible + * if it is not already visible. + * + * @param x the x-coordinate. + * @param y the y-coordinate. + * @param w the width. + * @param h the height. + */ + public void showZoomRectangle(double x, double y, double w, double h) { + this.zoomRectangle.setX(x); + this.zoomRectangle.setY(y); + this.zoomRectangle.setWidth(w); + this.zoomRectangle.setHeight(h); + this.zoomRectangle.setVisible(true); + } + + /** + * Creates the node representing this control. + * + * @return The node. + */ + private BorderPane createNode(ChartViewer control) { + BorderPane borderPane = new BorderPane(); + borderPane.setPrefSize(800, 500); + StackPane sp = new StackPane(); + sp.setMinSize(10, 10); + sp.setPrefSize(600, 400); + this.canvas = new ChartCanvas(getSkinnable().getChart()); + this.canvas.setTooltipEnabled(control.isTooltipEnabled()); + this.canvas.addChartMouseListener(control); + this.canvas.widthProperty().bind(sp.widthProperty()); + this.canvas.heightProperty().bind(sp.heightProperty()); + + this.canvas.addMouseHandler(new ZoomHandlerFX("zoom", control)); + sp.getChildren().add(this.canvas); + + borderPane.setCenter(sp); + return borderPane; + } + +} Added: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/FXGraphics2D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/FXGraphics2D.java (rev 0) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/fx/FXGraphics2D.java 2014-06-27 10:43:29 UTC (rev 3134) @@ -0,0 +1,1777 @@ +/* =========================================================== + * JFreeChart : a free chart library for the Java(tm) platform + * =========================================================== + * + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. + * + * Project Info: http://www.jfree.org/jfreechart/index.html + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners.] + * + * ----------------- + * FXGraphics2D.java + * ----------------- + * (C) Copyright 2014, by Object Refinery Limited and Contributors. + * + * Original Author: David Gilbert (for Object Refinery Limited); + * Contributor(s): -; + + * Changes: + * -------- + * 20-Jun-2014 : Version 1 (DG); + */ + + +package org.jfree.chart.fx; + +import java.awt.AlphaComposite; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.Image; +import java.awt.LinearGradientPaint; +import java.awt.MultipleGradientPaint; +import java.awt.Paint; +import java.awt.RadialGradientPaint; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.font.TextLayout; +import java.awt.geom.AffineTransform; +import java.awt.geom.Arc2D; +import java.awt.geom.Area; +import java.awt.geom.Ellipse2D; +import java.awt.geom.GeneralPath; +import java.awt.geom.Line2D; +import java.awt.geom.NoninvertibleTransformException; +import java.awt.geom.Path2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.awt.geom.RoundRectangle2D; +import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; +import java.awt.image.ColorModel; +import java.awt.image.ImageObserver; +import java.awt.image.RenderedImage; +import java.awt.image.WritableRaster; +import java.awt.image.renderable.RenderableImage; +import java.text.AttributedCharacterIterator; +import java.util.Hashtable; +import java.util.Map; +import java.util.Set; +import javafx.embed.swing.SwingFXUtils; +import javafx.scene.canvas.Canvas; +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.paint.CycleMethod; +import javafx.scene.paint.LinearGradient; +import javafx.scene.paint.RadialGradient; +import javafx.scene.paint.Stop; +import javafx.scene.shape.ArcType; +import javafx.scene.shape.StrokeLineCap; +import javafx.scene.shape.StrokeLineJoin; +import javafx.scene.text.FontPosture; +import javafx.scene.text.FontWeight; + +/** + * A {@link Graphics2D} implementation that writes to a JavaFX {@link Canvas}. + * This class is copied directly from the FXGraphics2D project, we keep a local + * copy to avoid having a dependency to manage. + * + * @since 1.0.18 + */ +public class FXGraphics2D extends Graphics2D { + + private final GraphicsContext gc; + + private boolean clippingDisabled = false; + + /** Rendering hints (all ignored). */ + private final RenderingHints hints; + + private Shape clip; + + private Paint paint = Color.BLACK; + + private Color awtColor = Color.BLACK; + + private Composite composite = AlphaComposite.getInstance( + AlphaComposite.SRC_OVER, 1.0f); + + private Stroke stroke = new BasicStroke(1.0f); + + /** + * The width of the stroke to use when the user supplies a + * BasicStroke with a width of 0.0 (in this case the Java specification + * says "If width is set to 0.0f, the stroke is rendered as the thinnest + * possible line for the target device and the antialias hint setting.") + */ + private double zeroStrokeWidth; + + private Font font = new Font("SansSerif", Font.PLAIN, 12); + + private AffineTransform transform = new AffineTransform(); + + /** The background color, presently ignored. */ + private Color background = Color.BLACK; + + /** A hidden image used for font metrics. */ + private final BufferedImage image = new BufferedImage(10, 10, + BufferedImage.TYPE_INT_RGB); + + /** + * An instance that is lazily instantiated in drawLine and then + * subsequently reused to avoid creating a lot of garbage. + */ + private Line2D line; + + /** + * An instance that is lazily instantiated in fillRect and then + * subsequently reused to avoid creating a lot of garbage. + */ + Rectangle2D rect; + + /** + * An instance that is lazily instantiated in draw/fillRoundRect and then + * subsequently reused to avoid creating a lot of garbage. + */ + private RoundRectangle2D roundRect; + + /** + * An instance that is lazily instantiated in draw/fillOval and then + * subsequently reused to avoid creating a lot of garbage. + */ + private Ellipse2D oval; + + /** + * An instance that is lazily instantiated in draw/fillArc and then + * subsequently reused to avoid creating a lot of garbage. + */ + private Arc2D arc; + + /** A hidden image used for font metrics. */ + private final BufferedImage fmImage = new BufferedImage(10, 10, + BufferedImage.TYPE_INT_RGB); + + /** + * Throws an {@code IllegalArgumentException} if {@code arg} is + * {@code null}. + * + * @param arg the argument to check. + * @param name the name of the + */ + private static void nullNotPermitted(Object arg, String name) { + if (arg == null) { + throw new IllegalArgumentException("Null '" + name + "' argument."); + } + } + + /** + * Creates a new instance that will render to the specified JavaFX + * {@code GraphicsContext}. + * + * @param gc the graphics context ({@code null} not permitted). + */ + public FXGraphics2D(GraphicsContext gc) { + nullNotPermitted(gc, "gc"); + this.gc = gc; + this.zeroStrokeWidth = 0.5; + this.hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_DEFAULT); + } + + /** + * Returns the width to use for the stroke when the AWT stroke + * specified has a zero width (the default value is {@code 0.5}). + * <p>In the Java specification for {@code BasicStroke} it states "If width + * is set to 0.0f, the stroke is rendered as the thinnest possible + * line for the target device and the antialias hint setting." We don't + * have a means to implement that accurately since we must specify a fixed + * width to the JavaFX canvas - this attribute is the width that is + * used.</p> + * + * @return The width. + */ + public double getZeroStrokeWidth() { + return this.zeroStrokeWidth; + } + + /** + * Sets the width to use for the stroke when the current AWT stroke + * has a width of {@code 0.0}. + * + * @param width the new width (must be 0 or greater). + */ + public void setZeroStrokeWidth(double width) { + if (width < 0.0) { + throw new IllegalArgumentException("Width cannot be negative."); + } + this.zeroStrokeWidth = width; + } + + /** + * Returns the flag that controls whether or not clipping is actually + * applied to the JavaFX canvas. The default value is currently + * {@code false} (the clipping is ENABLED) but since it does not always + * work correctly you have the option to disable it. See <a href="https://javafx-jira.kenai.com/browse/RT-36891"> + * https://javafx-jira.kenai.com/browse/RT-36891</a> for details (requires + * an account). + * + * @return A boolean. + * + * @see #setClippingDisabled(boolean) + */ + public boolean isClippingDisabled() { + return this.clippingDisabled; + } + + /** + * Sets the flag that controls whether or not clipping is disabled. + * + * @param disabled the new flag value. + * + * @see #isClippingDisabled() + */ + public void setClippingDisabled(boolean disabled) { + this.clippingDisabled = disabled; + } + + /** + * This method is not implemented yet. + * @return {@code null}. + */ + @Override + public GraphicsConfiguration getDeviceConfiguration() { + // FIXME + return null; + } + + /** + * Creates a new graphics object that is a copy of this graphics object. + * + * @return A new graphics object. + */ + @Override + public Graphics create() { + FXGraphics2D copy = new FXGraphics2D(this.gc); + copy.setRenderingHints(getRenderingHints()); + copy.setClip(getClip()); + copy.setPaint(getPaint()); + copy.setColor(getColor()); + copy.setComposite(getComposite()); + copy.setStroke(getStroke()); + copy.setFont(getFont()); + copy.setTransform(getTransform()); + copy.setBackground(getBackground()); + return copy; + } + + /** + * Returns the paint used to draw or fill shapes (or text). The default + * value is {@link Color#BLACK}. + * + * @return The paint (never {@code null}). + * + * @see #setPaint(java.awt.Paint) + */ + @Override + public Paint getPaint() { + return this.paint; + } + + /** + * Sets the paint used to draw or fill shapes (or text). If + * {@code paint} is an instance of {@code Color}, this method will + * also update the current color attribute (see {@link #getColor()}). If + * you pass {@code null} to this method, it does nothing (in + * accordance with the JDK specification). + * <br><br> + * Note that this implementation will map {@link Color}, + * {@link GradientPaint}, {@link LinearGradientPaint} and + * {@link RadialGradientPaint}, other paint implementations are not + * handled. + * + * @param paint the paint ({@code null} is permitted but ignored). + * + * @see #getPaint() + */ + @Override + public void setPaint(Paint paint) { + if (paint == null) { + return; + } + this.paint = paint; + if (paint instanceof Color) { + setColor((Color) paint); + } else if (paint instanceof GradientPaint) { + GradientPaint gp = (GradientPaint) paint; + Stop[] stops = new Stop[] { new Stop(0, + awtColorToJavaFX(gp.getColor1())), + new Stop(1, awtColorToJavaFX(gp.getColor2())) }; + Point2D p1 = gp.getPoint1(); + Point2D p2 = gp.getPoint2(); + LinearGradient lg = new LinearGradient(p1.getX(), p1.getY(), + p2.getX(), p2.getY(), false, CycleMethod.NO_CYCLE, stops); + this.gc.setStroke(lg); + this.gc.setFill(lg); + } else if (paint instanceof MultipleGradientPaint) { + MultipleGradientPaint mgp = (MultipleGradientPaint) paint; + Color[] colors = mgp.getColors(); + float[] fractions = mgp.getFractions(); + Stop[] stops = new Stop[colors.length]; + for (int i = 0; i < colors.length; i++) { + stops[i] = new Stop(fractions[i], awtColorToJavaFX(colors[i])); + } + + if (paint instanceof RadialGradientPaint) { + RadialGradientPaint rgp = (RadialGradientPaint) paint; + Point2D center = rgp.getCenterPoint(); + Point2D focus = rgp.getFocusPoint(); + double focusDistance = focus.distance(center); + double focusAngle = 0.0; + if (!focus.equals(center)) { + focusAngle = Math.atan2(focus.getY() - center.getY(), + focus.getX() - center.getX()); + } + double radius = rgp.getRadius(); + RadialGradient rg = new RadialGradient( + focusAngle * Math.PI / 180, focusDistance, + center.getX(), center.getY(), radius, false, + CycleMethod.NO_CYCLE, stops); + this.gc.setStroke(rg); + this.gc.setFill(rg); + } else if (paint instanceof LinearGradientPaint) { + LinearGradientPaint lgp = (LinearGradientPaint) paint; + Point2D start = lgp.getStartPoint(); + Point2D end = lgp.getEndPoint(); + LinearGradient lg = new LinearGradient(start.getX(), + start.getY(), end.getX(), end.getY(), false, + CycleMethod.NO_CYCLE, stops); + this.gc.setStroke(lg); + this.gc.setFill(lg); + } + } else { + // this is a paint we don't recognise + } + } + + /** + * Returns the foreground color. This method exists for backwards + * compatibility in AWT, you should use the {@link #getPaint()} method. + * + * @return The foreground color (never <code>null</code>). + * + * @see #getPaint() + */ + @Override + public Color getColor() { + return this.awtColor; + } + + /** + * Sets the foreground color. This method exists for backwards + * compatibility in AWT, you should use the + * {@link #setPaint(java.awt.Paint)} method. + * + * @param c the color (<code>null</code> permitted but ignored). + * + * @see #setPaint(java.awt.Paint) + */ + @Override + public void setColor(Color c) { + if (c == null) { + return; + } + this.awtColor = c; + this.paint = c; + javafx.scene.paint.Color fxcolor = awtColorToJavaFX(c); + this.gc.setFill(fxcolor); + this.gc.setStroke(fxcolor); + } + + /** + * Returns a JavaFX color that is equivalent to the specified AWT color. + * + * @param c the color (<code>null</code> not permitted). + * + * @return A JavaFX color. + */ + private javafx.scene.paint.Color awtColorToJavaFX(Color c) { + return javafx.scene.paint.Color.rgb(c.getRed(), c.getGreen(), + c.getBlue(), c.getAlpha() / 255.0); + } + + /** + * Returns the background color (the default value is {@link Color#BLACK}). + * This attribute is used by the {@link #clearRect(int, int, int, int)} + * method. + * + * @return The background color (possibly {@code null}). + * + * @see #setBackground(java.awt.Color) + */ + @Override + public Color getBackground() { + return this.background; + } + + /** + * Sets the background color. This attribute is used by the + * {@link #clearRect(int, int, int, int)} method. The reference + * implementation allows {@code null} for the background color so + * we allow that too (but for that case, the {@link #clearRect(int, int, int, int)} + * method will do nothing). + * + * @param color the color ({@code null} permitted). + * + * @see #getBackground() + */ + @Override + public void setBackground(Color color) { + this.background = color; + } + + /** + * Returns the current composite. + * + * @return The current composite (never {@code null}). + * + * @see #setComposite(java.awt.Composite) + */ + @Override + public Composite getComposite() { + return this.composite; + } + + /** + * Sets the composite (only {@code AlphaComposite} is handled). + * + * @param comp the composite ({@code null} not permitted). + * + * @see #getComposite() + */ + @Override + public void setComposite(Composite comp) { + nullNotPermitted(comp, "comp"); + this.composite = comp; + } + + /** + * Returns the current stroke (this attribute is used when drawing shapes). + * + * @return The current stroke (never {@code null}). + * + * @see #setStroke(java.awt.Stroke) + */ + @Override + public Stroke getStroke() { + return this.stroke; + } + + /** + * Sets the stroke that will be used to draw shapes. + * + * @param s the stroke ({@code null} not permitted). + * + * @see #getStroke() + */ + @Override + public void setStroke(Stroke s) { + nullNotPermitted(s, "s"); + ... [truncated message content] |
From: <mu...@us...> - 2014-06-27 10:32:17
|
Revision: 3133 http://sourceforge.net/p/jfreechart/code/3133 Author: mungady Date: 2014-06-27 10:32:15 +0000 (Fri, 27 Jun 2014) Log Message: ----------- Fix typo. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/annotations/package.html Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/annotations/package.html =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/annotations/package.html 2014-06-27 10:31:22 UTC (rev 3132) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/annotations/package.html 2014-06-27 10:32:15 UTC (rev 3133) @@ -1,6 +1,6 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <body bgcolor="white"> -A framework for addings annotations to charts. +A framework for adding annotations to charts. </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-27 10:31:28
|
Revision: 3132 http://sourceforge.net/p/jfreechart/code/3132 Author: mungady Date: 2014-06-27 10:31:22 +0000 (Fri, 27 Jun 2014) Log Message: ----------- Update overview. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/overview.html Modified: branches/jfreechart-1.0.x-branch/source/overview.html =================================================================== --- branches/jfreechart-1.0.x-branch/source/overview.html 2014-06-26 14:07:39 UTC (rev 3131) +++ branches/jfreechart-1.0.x-branch/source/overview.html 2014-06-27 10:31:22 UTC (rev 3132) @@ -2,7 +2,8 @@ <html> <body bgcolor="white"> <b>JFreeChart</b> is a free chart library for Java that can generate a -wide variety of charts for use in applications, applets and servlets. +wide variety of charts for use in both client (Swing and JavaFX) and server +(web) applications. <p> Please visit <a href="http://www.jfree.org/jfreechart/index.html" target="_blank"> http://www.jfree.org/jfreechart/index.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-26 14:07:47
|
Revision: 3131 http://sourceforge.net/p/jfreechart/code/3131 Author: mungady Date: 2014-06-26 14:07:39 +0000 (Thu, 26 Jun 2014) Log Message: ----------- Fix typo. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java 2014-06-25 07:40:19 UTC (rev 3130) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartPanel.java 2014-06-26 14:07:39 UTC (rev 3131) @@ -1016,7 +1016,7 @@ } /** - * Sets the flag that controls whether or not zooming is enable for the + * Sets the flag that controls whether or not zooming is enabled for the * domain axis. A check is made to ensure that the current plot supports * zooming for the domain values. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-25 07:40:24
|
Revision: 3130 http://sourceforge.net/p/jfreechart/code/3130 Author: mungady Date: 2014-06-25 07:40:19 +0000 (Wed, 25 Jun 2014) Log Message: ----------- 2014-06-25 David Gilbert <dav...@ob...> * org/jfree/chart/plot/PlotOrientation.java (isHorizontal): New method, (isVertical): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PlotOrientation.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PlotOrientation.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PlotOrientation.java 2014-06-25 07:40:02 UTC (rev 3129) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PlotOrientation.java 2014-06-25 07:40:19 UTC (rev 3130) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * -------------------- * PlotOrientation.java * -------------------- - * (C) Copyright 2003-2008, by Object Refinery Limited. + * (C) Copyright 2003-2014, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): -; @@ -37,6 +37,7 @@ * 02-May-2003 : Version 1 (DG); * 17-Jul-2003 : Added readResolve() method (DG); * 21-Nov-2007 : Implemented hashCode() (DG); + * 14-May-2014 : Added isHorizontal() and isVertical() methods (DG); * */ @@ -47,6 +48,8 @@ /** * Used to indicate the orientation (horizontal or vertical) of a 2D plot. + * It is the direction of the y-axis that is the determinant (a conventional + * plot has a vertical y-axis). */ public final class PlotOrientation implements Serializable { @@ -74,6 +77,30 @@ } /** + * Returns <code>true</code> if this orientation is <code>HORIZONTAL</code>, + * and <code>false</code> otherwise. + * + * @return A boolean. + * + * @since 1.0.18 + */ + public boolean isHorizontal() { + return this.equals(PlotOrientation.HORIZONTAL); + } + + /** + * Returns <code>true</code> if this orientation is <code>VERTICAL</code>, + * and <code>false</code> otherwise. + * + * @return A boolean. + * + * @since 1.0.18 + */ + public boolean isVertical() { + return this.equals(PlotOrientation.VERTICAL); + } + + /** * Returns a string representing the object. * * @return The string. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-25 07:40:06
|
Revision: 3129 http://sourceforge.net/p/jfreechart/code/3129 Author: mungady Date: 2014-06-25 07:40:02 +0000 (Wed, 25 Jun 2014) Log Message: ----------- 2014-06-25 David Gilbert <dav...@ob...> * org/jfree/chart/plot/PlotOrientation.java (isHorizontal): New method, (isVertical): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-20 23:15:02 UTC (rev 3128) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-25 07:40:02 UTC (rev 3129) @@ -1,3 +1,9 @@ +2014-06-25 David Gilbert <dav...@ob...> + + * org/jfree/chart/plot/PlotOrientation.java + (isHorizontal): New method, + (isVertical): Likewise. + 2014-06-21 David Gilbert <dav...@ob...> * org/jfree/chart/JFreeChart.java This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-06-20 23:15:12
|
Revision: 3128 http://sourceforge.net/p/jfreechart/code/3128 Author: mungady Date: 2014-06-20 23:15:02 +0000 (Fri, 20 Jun 2014) Log Message: ----------- 2014-06-21 David Gilbert <dav...@ob...> * org/jfree/chart/JFreeChart.java (JFreeChart): Add new rendering hint, (setAntiAlias): Simplify, (readObject): Update initialisation of rendering hints. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-11 15:08:18 UTC (rev 3127) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-06-20 23:15:02 UTC (rev 3128) @@ -1,11 +1,18 @@ -2013-04-07 David Gilbert <dav...@ob...> +2014-06-21 David Gilbert <dav...@ob...> + + * org/jfree/chart/JFreeChart.java + (JFreeChart): Add new rendering hint, + (setAntiAlias): Simplify, + (readObject): Update initialisation of rendering hints. + +2014-04-07 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeriesCollection.java (getRangeBounds(List, Range, boolean)): Observe the xRange, * org/jfree/data/Range.java (combineIgnoringNaN): Improve NaN handling consistency. -2013-04-07 David Gilbert <dav...@ob...> +2014-04-07 David Gilbert <dav...@ob...> * org/jfree/chart/labels/StandardPieSectionLabelGenerator.java (attributedLabels): Change from ObjectList to Map, @@ -20,13 +27,13 @@ * org/jfree/chart/plot/PiePlot.java (clone): Clone required fields. -2013-03-19 David Gilbert <dav...@ob...> +2014-03-19 David Gilbert <dav...@ob...> * org/jfree/chart/axis/SymbolAxis.java (drawGridBandsHorizontal): Take into account inverted axis, (drawGridBandsVertical): Likewise. -2013-03-18 David Gilbert <dav...@ob...> +2014-03-18 David Gilbert <dav...@ob...> * org/jfree/chart/utils/AttrStringUtils.java (getTextBounds): New method, Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java 2014-04-11 15:08:18 UTC (rev 3127) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/JFreeChart.java 2014-06-20 23:15:02 UTC (rev 3128) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------- * JFreeChart.java * --------------- - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Andrzej Porebski; @@ -149,6 +149,7 @@ * 19-May-2009 : Fixed FindBugs warnings, patch by Michal Wozniak (DG); * 29-Jun-2009 : Check visibility flag in main title (DG); * 02-Jul-2013 : Use ParamChecks class (DG); + * 21-Jun-2014 : Set default hint value for stroke control (DG); * */ @@ -402,7 +403,11 @@ this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - + // added the following hint because of + // http://stackoverflow.com/questions/7785082/ + this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_PURE); + this.borderVisible = false; this.borderStroke = new BasicStroke(1.0f); this.borderPaint = Color.black; @@ -877,26 +882,10 @@ * @see #getAntiAlias() */ public void setAntiAlias(boolean flag) { - - Object val = this.renderingHints.get(RenderingHints.KEY_ANTIALIASING); - if (val == null) { - val = RenderingHints.VALUE_ANTIALIAS_DEFAULT; - } - if (!flag && RenderingHints.VALUE_ANTIALIAS_OFF.equals(val) - || flag && RenderingHints.VALUE_ANTIALIAS_ON.equals(val)) { - // no change, do nothing - return; - } - if (flag) { - this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_ON); - } - else { - this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, - RenderingHints.VALUE_ANTIALIAS_OFF); - } + Object hint = flag ? RenderingHints.VALUE_ANTIALIAS_ON + : RenderingHints.VALUE_ANTIALIAS_OFF; + this.renderingHints.put(RenderingHints.KEY_ANTIALIASING, hint); fireChartChanged(); - } /** @@ -1148,9 +1137,8 @@ * (<code>null</code> permitted). * @param info records info about the drawing (null means collect no info). */ - public void draw(Graphics2D g2, - Rectangle2D chartArea, Point2D anchor, - ChartRenderingInfo info) { + public void draw(Graphics2D g2, Rectangle2D chartArea, Point2D anchor, + ChartRenderingInfo info) { notifyListeners(new ChartProgressEvent(this, this, ChartProgressEvent.DRAWING_STARTED, 0)); @@ -1678,7 +1666,9 @@ this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - + this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, + RenderingHints.VALUE_STROKE_PURE); + // register as a listener with sub-components... if (this.title != null) { this.title.addChangeListener(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-11 15:08:22
|
Revision: 3127 http://sourceforge.net/p/jfreechart/code/3127 Author: mungady Date: 2014-04-11 15:08:18 +0000 (Fri, 11 Apr 2014) Log Message: ----------- Update README for release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2014-04-11 15:07:14 UTC (rev 3126) +++ branches/jfreechart-1.0.x-branch/README.txt 2014-04-11 15:08:18 UTC (rev 3127) @@ -1,10 +1,10 @@ ******************************** -* JFREECHART: Version 1.0.17 * +* JFREECHART: Version 1.0.18 * ******************************** -24 November 2013 +11 April 2014 -(C)opyright 2000-2013, by Object Refinery Limited and Contributors. +(C)opyright 2000-2014, by Object Refinery Limited and Contributors. ----------------- 1. INTRODUCTION @@ -38,7 +38,7 @@ 3. DOCUMENTATION ----------------- You can download installation instructions -(jfreechart-1.0.17-install.pdf) from the JFreeChart home +(jfreechart-1.0.18-install.pdf) from the JFreeChart home page or the project page on SourceForge. Further documentation for JFreeChart (the JFreeChart Developer Guide) is @@ -66,7 +66,7 @@ to get JFreeChart working on these older versions, but we are no longer supporting it. -(b) JCommon - version 1.0.0 or later. The runtime jar file (version 1.0.21) +(b) JCommon - version 1.0.0 or later. The runtime jar file (version 1.0.22) is included in the JFreeChart distribution. You can obtain the complete source code for JCommon from: @@ -123,7 +123,7 @@ generated is included in the JFreeChart distribution. To run the demo (using JDK 1.6.0 or later), use the following command: - java -jar jfreechart-1.0.17-demo.jar + java -jar jfreechart-1.0.18-demo.jar The complete source code for the demo application is available for download when you purchase the JFreeChart Developer Guide. @@ -132,7 +132,7 @@ provide export facilities to the SVG and PDF formats. These fast, lightweight libraries are not free, licenses can be purchased from Object Refinery Limited. -An additional tab added to the demo application in version 1.0.17 showcases +An additional tab added to the demo application in version 1.0.18 showcases Orson Charts 3D, a new library by Object Refinery Limited. You can find out more about Orson Charts at: @@ -161,6 +161,13 @@ -------------- A list of changes in recent versions: +1.0.18 : (11-Apr-2014) + - improved LogAxis labelling; + - center text support in RingPlot; + - 'stepPoint' attribute in the XYStepAreaRenderer; + - other minor improvements and bug fixes, see the NEWS and ChangeLog + files for further details. + 1.0.17 : (22-Nov-2013) - see the NEWS and ChangeLog files for details. @@ -754,6 +761,7 @@ - Gideon Krause - Dave Law; - Pierre-Marie Le Biot + - Simon Legner - Arnaud Lelievre - Wolfgang Lenhard - Leo Leung @@ -775,9 +783,10 @@ - Viktor Rajewski - Eduardo Ramalho - Michael Rauch + - Klaus Rheinwald - Cameron Riley - - Klaus Rheinwald - Dan Rivett + - Lukasz Rzeszotarski - Scott Sams - Michel Santos - Thierry Saura This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-11 15:07:17
|
Revision: 3126 http://sourceforge.net/p/jfreechart/code/3126 Author: mungady Date: 2014-04-11 15:07:14 +0000 (Fri, 11 Apr 2014) Log Message: ----------- Update NEWS for release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/NEWS Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2014-04-11 15:05:51 UTC (rev 3125) +++ branches/jfreechart-1.0.x-branch/NEWS 2014-04-11 15:07:14 UTC (rev 3126) @@ -1,3 +1,27 @@ +JFreeChart 1.0.18 +----------------- +11 April 2014 + +Modified LogAxis to support super-scripted labels, enhanced XYStepAreaRenderer +to support a 'stepPoint' attribute (patch from Lukasz Rzeszotarski), provided +configurable direction labels in CompassFormat (patch from Simon Legner), +added methods to add data item objects to VectorSeries, XIntervalSeries, +YIntervalSeries and XYIntervalSeries (for consistency with other data series +objects), improved the TimeSeries range calculations, provided center text +support for the RingPlot class, updated JCommon to version 1.0.22 (this fixes +a bug in pie label rendering). + +Bug Fixes: + +- BarRenderer3D now observes the 'visibleSeries' settings; +- TimeSeriesCollection now takes xRange into account when calculating the +range bounds; +- added missing localisation for 'Save As' option on ChartPanel; +- inverted SymbolAxis not displaying bands correctly; +- fixed fillDomainGridBand() method in AbstractXYItemRenderer; +- replaced ObjectList with java.util.Map to avoid bug in equals() methods. + + JFreeChart 1.0.17 ----------------- 24 November 2013 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-11 15:05:54
|
Revision: 3125 http://sourceforge.net/p/jfreechart/code/3125 Author: mungady Date: 2014-04-11 15:05:51 +0000 (Fri, 11 Apr 2014) Log Message: ----------- Update JCommon to 1.0.22 Added Paths: ----------- branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar Removed Paths: ------------- branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.21.jar Deleted: branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.21.jar =================================================================== (Binary files differ) Added: branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar =================================================================== (Binary files differ) Index: branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar =================================================================== --- branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar 2014-04-09 09:28:02 UTC (rev 3124) +++ branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar 2014-04-11 15:05:51 UTC (rev 3125) Property changes on: branches/jfreechart-1.0.x-branch/lib/jcommon-1.0.22.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-09 09:28:05
|
Revision: 3124 http://sourceforge.net/p/jfreechart/code/3124 Author: mungady Date: 2014-04-09 09:28:02 +0000 (Wed, 09 Apr 2014) Log Message: ----------- 2013-04-07 David Gilbert <dav...@ob...> * org/jfree/data/time/TimeSeriesCollection.java (getRangeBounds(List, Range, boolean)): Observe the xRange, * org/jfree/data/Range.java (combineIgnoringNaN): Improve NaN handling consistency. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2014-04-09 09:28:02 UTC (rev 3124) @@ -1,3 +1,25 @@ +2013-04-07 David Gilbert <dav...@ob...> + + * org/jfree/data/time/TimeSeriesCollection.java + (getRangeBounds(List, Range, boolean)): Observe the xRange, + * org/jfree/data/Range.java + (combineIgnoringNaN): Improve NaN handling consistency. + +2013-04-07 David Gilbert <dav...@ob...> + + * org/jfree/chart/labels/StandardPieSectionLabelGenerator.java + (attributedLabels): Change from ObjectList to Map, + (StandardPieSectionLabelGenerator): Modify initialisation of storage, + (setAttributedLabel): Storage changed to map, + (equals): Simplification, + (clone): Clone the attributed labels, + * org/jfree/chart/StrokeMap.java + (clone): Clone the storage, + * org/jfree/chart/PaintMap.java + (clone): Likewise, + * org/jfree/chart/plot/PiePlot.java + (clone): Clone required fields. + 2013-03-19 David Gilbert <dav...@ob...> * org/jfree/chart/axis/SymbolAxis.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/Range.java 2014-04-09 09:28:02 UTC (rev 3124) @@ -239,16 +239,34 @@ */ public static Range combineIgnoringNaN(Range range1, Range range2) { if (range1 == null) { + if (range2 != null && range2.isNaNRange()) { + return null; + } return range2; } if (range2 == null) { + if (range1.isNaNRange()) { + return null; + } return range1; } double l = min(range1.getLowerBound(), range2.getLowerBound()); double u = max(range1.getUpperBound(), range2.getUpperBound()); + if (Double.isNaN(l) && Double.isNaN(u)) { + return null; + } return new Range(l, u); } + /** + * Returns the minimum value. If either value is NaN, the other value is + * returned. If both are NaN, NaN is returned. + * + * @param d1 value 1. + * @param d2 value 2. + * + * @return The minimum of the two values. + */ private static double min(double d1, double d2) { if (Double.isNaN(d1)) { return d2; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java 2014-04-09 09:23:25 UTC (rev 3123) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/TimeSeriesCollection.java 2014-04-09 09:28:02 UTC (rev 3124) @@ -737,8 +737,8 @@ while (iterator.hasNext()) { Comparable seriesKey = (Comparable) iterator.next(); TimeSeries series = getSeries(seriesKey); - Range r = new Range(series.getMinY(), series.getMaxY()); - // FIXME: Here we are ignoring the xRange + Range r = series.findValueRange(xRange, this.xPosition, + this.workingCalendar.getTimeZone()); result = Range.combineIgnoringNaN(result, r); } return result; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2014-04-09 09:23:28
|
Revision: 3123 http://sourceforge.net/p/jfreechart/code/3123 Author: mungady Date: 2014-04-09 09:23:25 +0000 (Wed, 09 Apr 2014) Log Message: ----------- 2013-04-09 David Gilbert <dav...@ob...> * org/jfree/chart/renderer/AbstractRenderer.java (itemLabelFontMap): Change to Map, (positiveItemLabelPositionMap): Likewise, (negativeItemLabelPositionMap): Likewise, (legendTextFontMap): Likewise, (AbstractRenderer): Update field instantiation, (getSeriesItemLabelFont): Update for field change, (setSeriesItemLabelFont): Likewise, (getSeriesPositiveItemLabelPosition): Likewise, (setSeriesPositiveItemLabelPosition): Likewise, (getSeriesNegativeItemLabelPosition): Likewise, (setSeriesNegativeItemLabelPosition): Likewise, (getLegendTextFont): Likewise, (setLegendTextFont): Likewise, (equals): Update for field changes, (clone): Likewise, * org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java (itemLabelGeneratorMap): Change to Map, (toolTipGeneratorMap): Likewise, (AbstractXYItemRenderer): Update field instantiation, (getItemLabelGenerator): Update for field change, (getSeriesItemLabelGenerator): Likewise, (setSeriesItemLabelGenerator): Likewise, (getToolTipGenerator): Likewise, (getSeriesToolTipGenerator): Likewise, (setSeriesToolTipGenerator): Likewise, (clone): Update for field changes, (equals): Likewise, * org/jfree/chart/renderer/AbstractCategoryItemRenderer.java (itemLabelGeneratorMap): Change to Map, (toolTipGeneratorMap): Likewise, (itemURLGeneratorMap): Likewise, (AbstractCategoryItemRenderer): Update for field changes, (getSeriesItemLabelGenerator): Likewise, (setSeriesItemLabelGenerator): Likewise, (getSeriesToolTipGenerator): Likewise, (setSeriesToolTipGenerator): Likewise, (getSeriesItemURLGenerator): Likewise, (setSeriesItemURLGenerator): Likewise, (equals): Update for field changes, (clone): Likewise, * org/jfree/chart/util/CloneUtils.java: New file, * org/jfree/chart/plot/XYPlot.java (domainAxes): Change to Map, (domainAxisLocations): Likewise, (rangeAxes): Likewise, (rangeAxisLocations): Likewise, (datasets): Likewise, (renderers): Likewise, (XYPlot): Update for field changes, (setDomainAxis): Likewise, (setDomainAxisLocation): Likewise, (setRangeAxis): Likewise, (setRangeAxisLocation): Likewise, (setDataset): Likewise, (setRenderer): Likewise, (getIndexOf(XYItemRenderer)): Likewise, (getDomainAxisIndex): Likewise, (findDomainAxisIndex): New private method, (getRangeAxisIndex): Update for field changes, (findRangeAxisIndex): New private method, (clone): Updated for field changes, * org/jfree/chart/plot/CategoryPlot.java (domainAxes): Change to Map, (domainAxisLocations): Likewise, (rangeAxes): Likewise, (rangeAxisLocations): Likewise, (datasets): Likewise, (renderers): Likewise, (CategoryPlot): Updated for field changes, (setDomainAxis): Likewise, (getDomainAxisIndex): Likewise, (setDomainAxisLocation): Likewise, (setRangeAxis): Likewise, (getRangeAxisIndex): Likewise, (findRangeAxisIndex): New private method, (setRangeAxisLocation): Update for field changes, (setDataset): Likewise, (setRenderer): Likewise, (getIndexOf(CategoryItemRenderer)): Likewise, (getDataRange): Likewise, (datasetsMappedToDomainAxis): Likewise, (getCategoriesForAxis): Likewise, (clone): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/util/CloneUtils.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java 2014-04-09 08:52:25 UTC (rev 3122) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java 2014-04-09 09:23:25 UTC (rev 3123) @@ -181,6 +181,7 @@ * 02-Jul-2013 : Use ParamChecks (DG); * 12-Sep-2013 : Check for KEY_SUPPRESS_SHADOW_GENERATION rendering hint (DG); * 10-Mar-2014 : Updated Javadocs for issue #1123 (DG); + * 09-Apr-2014 : Remove use of ObjectList (DG); * */ @@ -212,6 +213,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.ResourceBundle; import java.util.Set; import java.util.TreeMap; @@ -238,6 +240,7 @@ import org.jfree.chart.renderer.category.AbstractCategoryItemRenderer; import org.jfree.chart.renderer.category.CategoryItemRenderer; import org.jfree.chart.renderer.category.CategoryItemRendererState; +import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.chart.util.ResourceBundleWrapper; import org.jfree.chart.util.ShadowGenerator; @@ -250,7 +253,6 @@ import org.jfree.ui.Layer; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; -import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PaintUtilities; import org.jfree.util.PublicCloneable; @@ -326,10 +328,10 @@ private RectangleInsets axisOffset; /** Storage for the domain axes. */ - private ObjectList domainAxes; + private Map<Integer, CategoryAxis> domainAxes; /** Storage for the domain axis locations. */ - private ObjectList domainAxisLocations; + private Map<Integer, AxisLocation> domainAxisLocations; /** * A flag that controls whether or not the shared domain axis is drawn @@ -338,13 +340,13 @@ private boolean drawSharedDomainAxis; /** Storage for the range axes. */ - private ObjectList rangeAxes; + private Map<Integer, ValueAxis> rangeAxes; /** Storage for the range axis locations. */ - private ObjectList rangeAxisLocations; + private Map<Integer, AxisLocation> rangeAxisLocations; /** Storage for the datasets. */ - private ObjectList datasets; + private Map<Integer, CategoryDataset> datasets; /** Storage for keys that map datasets to domain axes. */ private TreeMap datasetToDomainAxesMap; @@ -353,7 +355,7 @@ private TreeMap datasetToRangeAxesMap; /** Storage for the renderers. */ - private ObjectList renderers; + private Map<Integer, CategoryItemRenderer> renderers; /** The dataset rendering order. */ private DatasetRenderingOrder renderingOrder @@ -574,53 +576,50 @@ * @param renderer the item renderer (<code>null</code> permitted). * */ - public CategoryPlot(CategoryDataset dataset, - CategoryAxis domainAxis, - ValueAxis rangeAxis, - CategoryItemRenderer renderer) { + public CategoryPlot(CategoryDataset dataset, CategoryAxis domainAxis, + ValueAxis rangeAxis, CategoryItemRenderer renderer) { super(); this.orientation = PlotOrientation.VERTICAL; // allocate storage for dataset, axes and renderers - this.domainAxes = new ObjectList(); - this.domainAxisLocations = new ObjectList(); - this.rangeAxes = new ObjectList(); - this.rangeAxisLocations = new ObjectList(); + this.domainAxes = new HashMap<Integer, CategoryAxis>(); + this.domainAxisLocations = new HashMap<Integer, AxisLocation>(); + this.rangeAxes = new HashMap<Integer, ValueAxis>(); + this.rangeAxisLocations = new HashMap<Integer, AxisLocation>(); this.datasetToDomainAxesMap = new TreeMap(); this.datasetToRangeAxesMap = new TreeMap(); - this.renderers = new ObjectList(); + this.renderers = new HashMap<Integer, CategoryItemRenderer>(); - this.datasets = new ObjectList(); - this.datasets.set(0, dataset); + this.datasets = new HashMap<Integer, CategoryDataset>(); + this.datasets.put(0, dataset); if (dataset != null) { dataset.addChangeListener(this); } this.axisOffset = RectangleInsets.ZERO_INSETS; + this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT); + this.rangeAxisLocations.put(0, AxisLocation.TOP_OR_LEFT); - setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT, false); - setRangeAxisLocation(AxisLocation.TOP_OR_LEFT, false); - - this.renderers.set(0, renderer); + this.renderers.put(0, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } - this.domainAxes.set(0, domainAxis); - this.mapDatasetToDomainAxis(0, 0); + this.domainAxes.put(0, domainAxis); + mapDatasetToDomainAxis(0, 0); if (domainAxis != null) { domainAxis.setPlot(this); domainAxis.addChangeListener(this); } this.drawSharedDomainAxis = false; - this.rangeAxes.set(0, rangeAxis); - this.mapDatasetToRangeAxis(0, 0); + this.rangeAxes.put(0, rangeAxis); + mapDatasetToRangeAxis(0, 0); if (rangeAxis != null) { rangeAxis.setPlot(this); rangeAxis.addChangeListener(this); @@ -807,7 +806,7 @@ if (axis != null) { axis.setPlot(this); } - this.domainAxes.set(index, axis); + this.domainAxes.put(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); @@ -847,7 +846,12 @@ */ public int getDomainAxisIndex(CategoryAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); - return this.domainAxes.indexOf(axis); + for (Entry<Integer, CategoryAxis> entry : this.domainAxes.entrySet()) { + if (entry.getValue() == axis) { + return entry.getKey(); + } + } + return -1; } /** @@ -941,7 +945,7 @@ throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } - this.domainAxisLocations.set(index, location); + this.domainAxisLocations.put(index, location); if (notify) { fireChangeEvent(); } @@ -1082,7 +1086,7 @@ if (axis != null) { axis.setPlot(this); } - this.rangeAxes.set(index, axis); + this.rangeAxes.put(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); @@ -1122,7 +1126,7 @@ */ public int getRangeAxisIndex(ValueAxis axis) { ParamChecks.nullNotPermitted(axis, "axis"); - int result = this.rangeAxes.indexOf(axis); + int result = findRangeAxisIndex(axis); if (result < 0) { // try the parent plot Plot parent = getParent(); if (parent instanceof CategoryPlot) { @@ -1133,6 +1137,15 @@ return result; } + private int findRangeAxisIndex(ValueAxis axis) { + for (Entry<Integer, ValueAxis> entry : this.rangeAxes.entrySet()) { + if (entry.getValue() == axis) { + return entry.getKey(); + } + } + return -1; + } + /** * Returns the range axis location. * @@ -1215,12 +1228,12 @@ * @see #setDomainAxisLocation(int, AxisLocation, boolean) */ public void setRangeAxisLocation(int index, AxisLocation location, - boolean notify) { + boolean notify) { if (index == 0 && location == null) { throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } - this.rangeAxisLocations.set(index, location); + this.rangeAxisLocations.put(index, location); if (notify) { fireChangeEvent(); } @@ -1335,20 +1348,17 @@ * @see #getDataset(int) */ public void setDataset(int index, CategoryDataset dataset) { - CategoryDataset existing = (CategoryDataset) this.datasets.get(index); if (existing != null) { existing.removeChangeListener(this); } - this.datasets.set(index, dataset); + this.datasets.put(index, dataset); if (dataset != null) { dataset.addChangeListener(this); } - // send a dataset change event to self... DatasetChangeEvent event = new DatasetChangeEvent(this, dataset); datasetChanged(event); - } /** @@ -1642,25 +1652,18 @@ * @see #getRenderer(int) */ public void setRenderer(int index, CategoryItemRenderer renderer, - boolean notify) { - - // stop listening to the existing renderer... - CategoryItemRenderer existing - = (CategoryItemRenderer) this.renderers.get(index); + boolean notify) { + CategoryItemRenderer existing = this.renderers.get(index); if (existing != null) { existing.removeChangeListener(this); } - - // register the new renderer... - this.renderers.set(index, renderer); + this.renderers.put(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } - configureDomainAxes(); configureRangeAxes(); - if (notify) { fireChangeEvent(); } @@ -1707,7 +1710,13 @@ * @return The renderer index. */ public int getIndexOf(CategoryItemRenderer renderer) { - return this.renderers.indexOf(renderer); + for (Entry<Integer, CategoryItemRenderer> entry + : this.renderers.entrySet()) { + if (entry.getValue() == renderer) { + return entry.getKey(); + } + } + return -1; } /** @@ -4257,11 +4266,9 @@ */ @Override public Range getDataRange(ValueAxis axis) { - Range result = null; - List mappedDatasets = new ArrayList(); - - int rangeIndex = this.rangeAxes.indexOf(axis); + List<CategoryDataset> mappedDatasets = new ArrayList<CategoryDataset>(); + int rangeIndex = findRangeAxisIndex(axis); if (rangeIndex >= 0) { mappedDatasets.addAll(datasetsMappedToRangeAxis(rangeIndex)); } @@ -4271,16 +4278,13 @@ // iterate through the datasets that map to the axis and get the union // of the ranges. - Iterator iterator = mappedDatasets.iterator(); - while (iterator.hasNext()) { - CategoryDataset d = (CategoryDataset) iterator.next(); + for (CategoryDataset d : mappedDatasets) { CategoryItemRenderer r = getRendererForDataset(d); if (r != null) { result = Range.combine(result, r.findRangeBounds(d)); } } return result; - } /** @@ -4293,21 +4297,20 @@ * * @since 1.0.3 */ - private List datasetsMappedToDomainAxis(int axisIndex) { + private List<CategoryDataset> datasetsMappedToDomainAxis(int axisIndex) { Integer key = new Integer(axisIndex); - List result = new ArrayList(); + List<CategoryDataset> result = new ArrayList<CategoryDataset>(); for (int i = 0; i < this.datasets.size(); i++) { List mappedAxes = (List) this.datasetToDomainAxesMap.get( new Integer(i)); - CategoryDataset dataset = (CategoryDataset) this.datasets.get(i); + CategoryDataset dataset = this.datasets.get(i); if (mappedAxes == null) { if (key.equals(ZERO)) { if (dataset != null) { result.add(dataset); } } - } - else { + } else { if (mappedAxes.contains(key)) { if (dataset != null) { result.add(dataset); @@ -4480,11 +4483,8 @@ */ public List getCategoriesForAxis(CategoryAxis axis) { List result = new ArrayList(); - int axisIndex = this.domainAxes.indexOf(axis); - List datasets = datasetsMappedToDomainAxis(axisIndex); - Iterator iterator = datasets.iterator(); - while (iterator.hasNext()) { - CategoryDataset dataset = (CategoryDataset) iterator.next(); + int axisIndex = getDomainAxisIndex(axis); + for (CategoryDataset dataset : datasetsMappedToDomainAxis(axisIndex)) { // add the unique categories from this dataset for (int i = 0; i < dataset.getColumnCount(); i++) { Comparable category = dataset.getColumnKey(i); @@ -4994,33 +4994,30 @@ */ @Override public Object clone() throws CloneNotSupportedException { - CategoryPlot clone = (CategoryPlot) super.clone(); - - clone.domainAxes = new ObjectList(); - for (int i = 0; i < this.domainAxes.size(); i++) { - CategoryAxis xAxis = (CategoryAxis) this.domainAxes.get(i); - if (xAxis != null) { - CategoryAxis clonedAxis = (CategoryAxis) xAxis.clone(); - clone.setDomainAxis(i, clonedAxis); + clone.domainAxes = CloneUtils.cloneMapValues(this.domainAxes); + for (CategoryAxis axis : clone.domainAxes.values()) { + if (axis != null) { + axis.setPlot(clone); + axis.addChangeListener(clone); } } - clone.domainAxisLocations - = (ObjectList) this.domainAxisLocations.clone(); - - clone.rangeAxes = new ObjectList(); - for (int i = 0; i < this.rangeAxes.size(); i++) { - ValueAxis yAxis = (ValueAxis) this.rangeAxes.get(i); - if (yAxis != null) { - ValueAxis clonedAxis = (ValueAxis) yAxis.clone(); - clone.setRangeAxis(i, clonedAxis); + clone.rangeAxes = CloneUtils.cloneMapValues(this.rangeAxes); + for (ValueAxis axis : clone.rangeAxes.values()) { + if (axis != null) { + axis.setPlot(clone); + axis.addChangeListener(clone); } } - clone.rangeAxisLocations = (ObjectList) this.rangeAxisLocations.clone(); - clone.datasets = (ObjectList) this.datasets.clone(); - for (int i = 0; i < clone.datasets.size(); i++) { - CategoryDataset dataset = clone.getDataset(i); + // AxisLocation is immutable, so we can just copy the maps + clone.domainAxisLocations = new HashMap<Integer, AxisLocation>( + this.domainAxisLocations); + clone.rangeAxisLocations = new HashMap<Integer, AxisLocation>( + this.rangeAxisLocations); + + clone.datasets = new HashMap<Integer, CategoryDataset>(this.datasets); + for (CategoryDataset dataset : clone.datasets.values()) { if (dataset != null) { dataset.addChangeListener(clone); } @@ -5030,16 +5027,11 @@ clone.datasetToRangeAxesMap = new TreeMap(); clone.datasetToRangeAxesMap.putAll(this.datasetToRangeAxesMap); - clone.renderers = (ObjectList) this.renderers.clone(); - for (int i = 0; i < this.renderers.size(); i++) { - CategoryItemRenderer renderer2 = (CategoryItemRenderer) - this.renderers.get(i); - if (renderer2 instanceof PublicCloneable) { - PublicCloneable pc = (PublicCloneable) renderer2; - CategoryItemRenderer rc = (CategoryItemRenderer) pc.clone(); - clone.renderers.set(i, rc); - rc.setPlot(clone); - rc.addChangeListener(clone); + clone.renderers = CloneUtils.cloneMapValues(this.renderers); + for (CategoryItemRenderer renderer : clone.renderers.values()) { + if (renderer != null) { + renderer.setPlot(clone); + renderer.addChangeListener(clone); } } if (this.fixedDomainAxisSpace != null) { @@ -5065,7 +5057,6 @@ = (LegendItemCollection) this.fixedLegendItems.clone(); } return clone; - } /** Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java 2014-04-09 08:52:25 UTC (rev 3122) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java 2014-04-09 09:23:25 UTC (rev 3123) @@ -286,6 +286,7 @@ import org.jfree.chart.renderer.xy.AbstractXYItemRenderer; import org.jfree.chart.renderer.xy.XYItemRenderer; import org.jfree.chart.renderer.xy.XYItemRendererState; +import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.chart.util.ResourceBundleWrapper; import org.jfree.chart.util.ShadowGenerator; @@ -298,7 +299,6 @@ import org.jfree.ui.Layer; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; -import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PaintUtilities; import org.jfree.util.PublicCloneable; @@ -350,22 +350,22 @@ private RectangleInsets axisOffset; /** The domain axis / axes (used for the x-values). */ - private ObjectList domainAxes; + private Map<Integer, ValueAxis> domainAxes; /** The domain axis locations. */ - private ObjectList domainAxisLocations; + private Map<Integer, AxisLocation> domainAxisLocations; /** The range axis (used for the y-values). */ - private ObjectList rangeAxes; + private Map<Integer, ValueAxis> rangeAxes; /** The range axis location. */ - private ObjectList rangeAxisLocations; + private Map<Integer, AxisLocation> rangeAxisLocations; /** Storage for the datasets. */ - private ObjectList datasets; + private Map<Integer, XYDataset> datasets; /** Storage for the renderers. */ - private ObjectList renderers; + private Map<Integer, XYItemRenderer> renderers; /** * Storage for the mapping between datasets/renderers and domain axes. The @@ -623,62 +623,58 @@ * @param rangeAxis the range axis (<code>null</code> permitted). * @param renderer the renderer (<code>null</code> permitted). */ - public XYPlot(XYDataset dataset, - ValueAxis domainAxis, - ValueAxis rangeAxis, - XYItemRenderer renderer) { - + public XYPlot(XYDataset dataset, ValueAxis domainAxis, ValueAxis rangeAxis, + XYItemRenderer renderer) { super(); - this.orientation = PlotOrientation.VERTICAL; this.weight = 1; // only relevant when this is a subplot this.axisOffset = RectangleInsets.ZERO_INSETS; // allocate storage for datasets, axes and renderers (all optional) - this.domainAxes = new ObjectList(); - this.domainAxisLocations = new ObjectList(); + this.domainAxes = new HashMap<Integer, ValueAxis>(); + this.domainAxisLocations = new HashMap<Integer, AxisLocation>(); this.foregroundDomainMarkers = new HashMap(); this.backgroundDomainMarkers = new HashMap(); - this.rangeAxes = new ObjectList(); - this.rangeAxisLocations = new ObjectList(); + this.rangeAxes = new HashMap<Integer, ValueAxis>(); + this.rangeAxisLocations = new HashMap<Integer, AxisLocation>(); this.foregroundRangeMarkers = new HashMap(); this.backgroundRangeMarkers = new HashMap(); - this.datasets = new ObjectList(); - this.renderers = new ObjectList(); + this.datasets = new HashMap<Integer, XYDataset>(); + this.renderers = new HashMap<Integer, XYItemRenderer>(); this.datasetToDomainAxesMap = new TreeMap(); this.datasetToRangeAxesMap = new TreeMap(); this.annotations = new java.util.ArrayList(); - this.datasets.set(0, dataset); + this.datasets.put(0, dataset); if (dataset != null) { dataset.addChangeListener(this); } - this.renderers.set(0, renderer); + this.renderers.put(0, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); } - this.domainAxes.set(0, domainAxis); - this.mapDatasetToDomainAxis(0, 0); + this.domainAxes.put(0, domainAxis); + mapDatasetToDomainAxis(0, 0); if (domainAxis != null) { domainAxis.setPlot(this); domainAxis.addChangeListener(this); } - this.domainAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT); + this.domainAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT); - this.rangeAxes.set(0, rangeAxis); - this.mapDatasetToRangeAxis(0, 0); + this.rangeAxes.put(0, rangeAxis); + mapDatasetToRangeAxis(0, 0); if (rangeAxis != null) { rangeAxis.setPlot(this); rangeAxis.addChangeListener(this); } - this.rangeAxisLocations.set(0, AxisLocation.BOTTOM_OR_LEFT); + this.rangeAxisLocations.put(0, AxisLocation.BOTTOM_OR_LEFT); configureDomainAxes(); configureRangeAxes(); @@ -865,7 +861,7 @@ if (axis != null) { axis.setPlot(this); } - this.domainAxes.set(index, axis); + this.domainAxes.put(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); @@ -1035,12 +1031,11 @@ */ public void setDomainAxisLocation(int index, AxisLocation location, boolean notify) { - if (index == 0 && location == null) { throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } - this.domainAxisLocations.set(index, location); + this.domainAxisLocations.put(index, location); if (notify) { fireChangeEvent(); } @@ -1084,24 +1079,20 @@ * @see #setRangeAxis(int, ValueAxis) */ public void setRangeAxis(ValueAxis axis) { - if (axis != null) { axis.setPlot(this); } - // plot is likely registered as a listener with the existing axis... ValueAxis existing = getRangeAxis(); if (existing != null) { existing.removeChangeListener(this); } - - this.rangeAxes.set(0, axis); + this.rangeAxes.put(0, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); } fireChangeEvent(); - } /** @@ -1210,7 +1201,7 @@ if (axis != null) { axis.setPlot(this); } - this.rangeAxes.set(index, axis); + this.rangeAxes.put(index, axis); if (axis != null) { axis.configure(); axis.addChangeListener(this); @@ -1329,12 +1320,11 @@ */ public void setRangeAxisLocation(int index, AxisLocation location, boolean notify) { - if (index == 0 && location == null) { throw new IllegalArgumentException( "Null 'location' for index 0 not permitted."); } - this.rangeAxisLocations.set(index, location); + this.rangeAxisLocations.put(index, location); if (notify) { fireChangeEvent(); } @@ -1410,7 +1400,7 @@ if (existing != null) { existing.removeChangeListener(this); } - this.datasets.set(index, dataset); + this.datasets.put(index, dataset); if (dataset != null) { dataset.addChangeListener(this); } @@ -1632,13 +1622,13 @@ * * @see #getRenderer(int) */ - public void setRenderer(int index, XYItemRenderer renderer, - boolean notify) { + public void setRenderer(int index, XYItemRenderer renderer, + boolean notify) { XYItemRenderer existing = getRenderer(index); if (existing != null) { existing.removeChangeListener(this); } - this.renderers.set(index, renderer); + this.renderers.put(index, renderer); if (renderer != null) { renderer.setPlot(this); renderer.addChangeListener(this); @@ -1726,7 +1716,13 @@ * @return The renderer index. */ public int getIndexOf(XYItemRenderer renderer) { - return this.renderers.indexOf(renderer); + for (Map.Entry<Integer, XYItemRenderer> entry + : this.renderers.entrySet()) { + if (entry.getValue() == renderer) { + return entry.getKey(); + } + } + return -1; } /** @@ -4409,7 +4405,7 @@ * @see #getRangeAxisIndex(ValueAxis) */ public int getDomainAxisIndex(ValueAxis axis) { - int result = this.domainAxes.indexOf(axis); + int result = findDomainAxisIndex(axis); if (result < 0) { // try the parent plot Plot parent = getParent(); @@ -4420,6 +4416,15 @@ } return result; } + + private int findDomainAxisIndex(ValueAxis axis) { + for (Map.Entry<Integer, ValueAxis> entry : this.domainAxes.entrySet()) { + if (entry.getValue() == axis) { + return entry.getKey(); + } + } + return -1; + } /** * Returns the index of the given range axis. @@ -4431,7 +4436,7 @@ * @see #getDomainAxisIndex(ValueAxis) */ public int getRangeAxisIndex(ValueAxis axis) { - int result = this.rangeAxes.indexOf(axis); + int result = findRangeAxisIndex(axis); if (result < 0) { // try the parent plot Plot parent = getParent(); @@ -4443,6 +4448,15 @@ return result; } + private int findRangeAxisIndex(ValueAxis axis) { + for (Map.Entry<Integer, ValueAxis> entry : this.rangeAxes.entrySet()) { + if (entry.getValue() == axis) { + return entry.getKey(); + } + } + return -1; + } + /** * Returns the range for the specified axis. * @@ -5583,40 +5597,31 @@ */ @Override public Object clone() throws CloneNotSupportedException { - XYPlot clone = (XYPlot) super.clone(); - clone.domainAxes = (ObjectList) ObjectUtilities.clone(this.domainAxes); - for (int i = 0; i < this.domainAxes.size(); i++) { - ValueAxis axis = (ValueAxis) this.domainAxes.get(i); + clone.domainAxes = CloneUtils.cloneMapValues(this.domainAxes); + for (ValueAxis axis : clone.domainAxes.values()) { if (axis != null) { - ValueAxis clonedAxis = (ValueAxis) axis.clone(); - clone.domainAxes.set(i, clonedAxis); - clonedAxis.setPlot(clone); - clonedAxis.addChangeListener(clone); + axis.setPlot(clone); + axis.addChangeListener(clone); } } - clone.domainAxisLocations = (ObjectList) - this.domainAxisLocations.clone(); - - clone.rangeAxes = (ObjectList) ObjectUtilities.clone(this.rangeAxes); - for (int i = 0; i < this.rangeAxes.size(); i++) { - ValueAxis axis = (ValueAxis) this.rangeAxes.get(i); + clone.rangeAxes = CloneUtils.cloneMapValues(this.rangeAxes); + for (ValueAxis axis : clone.rangeAxes.values()) { if (axis != null) { - ValueAxis clonedAxis = (ValueAxis) axis.clone(); - clone.rangeAxes.set(i, clonedAxis); - clonedAxis.setPlot(clone); - clonedAxis.addChangeListener(clone); + axis.setPlot(clone); + axis.addChangeListener(clone); } } - clone.rangeAxisLocations = (ObjectList) ObjectUtilities.clone( + clone.domainAxisLocations = new HashMap<Integer, AxisLocation>( + this.domainAxisLocations); + clone.rangeAxisLocations = new HashMap<Integer, AxisLocation>( this.rangeAxisLocations); // the datasets are not cloned, but listeners need to be added... - clone.datasets = (ObjectList) ObjectUtilities.clone(this.datasets); - for (int i = 0; i < clone.datasets.size(); ++i) { - XYDataset d = getDataset(i); - if (d != null) { - d.addChangeListener(clone); + clone.datasets = new HashMap<Integer, XYDataset>(this.datasets); + for (XYDataset dataset : clone.datasets.values()) { + if (dataset != null) { + dataset.addChangeListener(clone); } } @@ -5625,15 +5630,11 @@ clone.datasetToRangeAxesMap = new TreeMap(); clone.datasetToRangeAxesMap.putAll(this.datasetToRangeAxesMap); - clone.renderers = (ObjectList) ObjectUtilities.clone(this.renderers); - for (int i = 0; i < this.renderers.size(); i++) { - XYItemRenderer renderer2 = (XYItemRenderer) this.renderers.get(i); - if (renderer2 instanceof PublicCloneable) { - PublicCloneable pc = (PublicCloneable) renderer2; - XYItemRenderer rc = (XYItemRenderer) pc.clone(); - clone.renderers.set(i, rc); - rc.setPlot(clone); - rc.addChangeListener(clone); + clone.renderers = CloneUtils.cloneMapValues(this.renderers); + for (XYItemRenderer renderer : clone.renderers.values()) { + if (renderer != null) { + renderer.setPlot(clone); + renderer.addChangeListener(clone); } } clone.foregroundDomainMarkers = (Map) ObjectUtilities.clone( Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java 2014-04-09 08:52:25 UTC (rev 3122) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/AbstractRenderer.java 2014-04-09 09:23:25 UTC (rev 3123) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------------- * AbstractRenderer.java * --------------------- - * (C) Copyright 2002-2013, by Object Refinery Limited. + * (C) Copyright 2002-2014, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Nicolas Brodu; @@ -91,6 +91,7 @@ * a line (DG); * 05-Jul-2012 : No need for BooleanUtilities now that min JDK = 1.4.2 (DG); * 03-Jul-2013 : Use ParamChecks (DG); + * 09-Apr-2014 : Remove use of ObjectList (DG); * */ @@ -110,7 +111,9 @@ import java.io.Serializable; import java.util.Arrays; import java.util.EventListener; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.swing.event.EventListenerList; @@ -122,11 +125,11 @@ import org.jfree.chart.plot.DrawingSupplier; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.title.LegendTitle; +import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.io.SerialUtilities; import org.jfree.ui.TextAnchor; import org.jfree.util.BooleanList; -import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PaintList; import org.jfree.util.PaintUtilities; @@ -277,7 +280,7 @@ private Boolean baseItemLabelsVisible; /** The item label font list (one font per series). */ - private ObjectList itemLabelFontList; + private Map<Integer, Font> itemLabelFontMap; /** The base item label font. */ private Font baseItemLabelFont; @@ -289,13 +292,13 @@ private transient Paint baseItemLabelPaint; /** The positive item label position (per series). */ - private ObjectList positiveItemLabelPositionList; + private Map<Integer, ItemLabelPosition> positiveItemLabelPositionMap; /** The fallback positive item label position. */ private ItemLabelPosition basePositiveItemLabelPosition; /** The negative item label position (per series). */ - private ObjectList negativeItemLabelPositionList; + private Map<Integer, ItemLabelPosition> negativeItemLabelPositionMap; /** The fallback negative item label position. */ private ItemLabelPosition baseNegativeItemLabelPosition; @@ -343,7 +346,7 @@ * * @since 1.0.11 */ - private ObjectList legendTextFont; + private Map<Integer, Font> legendTextFontMap; /** * The base legend font. @@ -389,7 +392,6 @@ * Default constructor. */ public AbstractRenderer() { - this.seriesVisible = null; this.seriesVisibleList = new BooleanList(); this.baseSeriesVisible = true; @@ -433,7 +435,7 @@ this.baseItemLabelsVisible = Boolean.FALSE; this.itemLabelFont = null; - this.itemLabelFontList = new ObjectList(); + this.itemLabelFontMap = new HashMap<Integer, Font>(); this.baseItemLabelFont = new Font("SansSerif", Font.PLAIN, 10); this.itemLabelPaint = null; @@ -441,12 +443,14 @@ this.baseItemLabelPaint = Color.black; this.positiveItemLabelPosition = null; - this.positiveItemLabelPositionList = new ObjectList(); + this.positiveItemLabelPositionMap + = new HashMap<Integer, ItemLabelPosition>(); this.basePositiveItemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); this.negativeItemLabelPosition = null; - this.negativeItemLabelPositionList = new ObjectList(); + this.negativeItemLabelPositionMap + = new HashMap<Integer, ItemLabelPosition>(); this.baseNegativeItemLabelPosition = new ItemLabelPosition( ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); @@ -461,14 +465,13 @@ this.treatLegendShapeAsLine = false; - this.legendTextFont = new ObjectList(); + this.legendTextFontMap = new HashMap<Integer, Font>(); this.baseLegendTextFont = null; this.legendTextPaint = new PaintList(); this.baseLegendTextPaint = null; this.listenerList = new EventListenerList(); - } /** @@ -1896,7 +1899,7 @@ * @see #setSeriesItemLabelFont(int, Font) */ public Font getSeriesItemLabelFont(int series) { - return (Font) this.itemLabelFontList.get(series); + return this.itemLabelFontMap.get(series); } /** @@ -1924,7 +1927,7 @@ * @see #getSeriesItemLabelFont(int) */ public void setSeriesItemLabelFont(int series, Font font, boolean notify) { - this.itemLabelFontList.set(series, font); + this.itemLabelFontMap.put(series, font); if (notify) { fireChangeEvent(); } @@ -2106,20 +2109,17 @@ * @see #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition) */ public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series) { - // return the override, if there is one... if (this.positiveItemLabelPosition != null) { return this.positiveItemLabelPosition; } - // otherwise look up the position table ItemLabelPosition position = (ItemLabelPosition) - this.positiveItemLabelPositionList.get(series); + this.positiveItemLabelPositionMap.get(series); if (position == null) { position = this.basePositiveItemLabelPosition; } return position; - } /** @@ -2148,9 +2148,8 @@ * @see #getSeriesPositiveItemLabelPosition(int) */ public void setSeriesPositiveItemLabelPosition(int series, - ItemLabelPosition position, - boolean notify) { - this.positiveItemLabelPositionList.set(series, position); + ItemLabelPosition position, boolean notify) { + this.positiveItemLabelPositionMap.put(series, position); if (notify) { fireChangeEvent(); } @@ -2225,20 +2224,17 @@ * @see #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition) */ public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) { - // return the override, if there is one... if (this.negativeItemLabelPosition != null) { return this.negativeItemLabelPosition; } - // otherwise look up the position list - ItemLabelPosition position = (ItemLabelPosition) - this.negativeItemLabelPositionList.get(series); + ItemLabelPosition position + = this.negativeItemLabelPositionMap.get(series); if (position == null) { position = this.baseNegativeItemLabelPosition; } return position; - } /** @@ -2267,9 +2263,8 @@ * @see #getSeriesNegativeItemLabelPosition(int) */ public void setSeriesNegativeItemLabelPosition(int series, - ItemLabelPosition position, - boolean notify) { - this.negativeItemLabelPositionList.set(series, position); + ItemLabelPosition position, boolean notify) { + this.negativeItemLabelPositionMap.put(series, position); if (notify) { fireChangeEvent(); } @@ -2606,7 +2601,7 @@ * @since 1.0.11 */ public Font getLegendTextFont(int series) { - return (Font) this.legendTextFont.get(series); + return this.legendTextFontMap.get(series); } /** @@ -2619,7 +2614,7 @@ * @since 1.0.11 */ public void setLegendTextFont(int series, Font font) { - this.legendTextFont.set(series, font); + this.legendTextFontMap.put(series, font); fireChangeEvent(); } @@ -3061,8 +3056,8 @@ if (!ObjectUtilities.equal(this.itemLabelFont, that.itemLabelFont)) { return false; } - if (!ObjectUtilities.equal(this.itemLabelFontList, - that.itemLabelFontList)) { + if (!ObjectUtilities.equal(this.itemLabelFontMap, + that.itemLabelFontMap)) { return false; } if (!ObjectUtilities.equal(this.baseItemLabelFont, @@ -3086,8 +3081,8 @@ that.positiveItemLabelPosition)) { return false; } - if (!ObjectUtilities.equal(this.positiveItemLabelPositionList, - that.positiveItemLabelPositionList)) { + if (!ObjectUtilities.equal(this.positiveItemLabelPositionMap, + that.positiveItemLabelPositionMap)) { return false; } if (!ObjectUtilities.equal(this.basePositiveItemLabelPosition, @@ -3099,8 +3094,8 @@ that.negativeItemLabelPosition)) { return false; } - if (!ObjectUtilities.equal(this.negativeItemLabelPositionList, - that.negativeItemLabelPositionList)) { + if (!ObjectUtilities.equal(this.negativeItemLabelPositionMap, + that.negativeItemLabelPositionMap)) { return false; } if (!ObjectUtilities.equal(this.baseNegativeItemLabelPosition, @@ -3128,7 +3123,8 @@ that.baseLegendShape)) { return false; } - if (!ObjectUtilities.equal(this.legendTextFont, that.legendTextFont)) { + if (!ObjectUtilities.equal(this.legendTextFontMap, + that.legendTextFontMap)) { return false; } if (!ObjectUtilities.equal(this.baseLegendTextFont, @@ -3254,9 +3250,9 @@ // 'basePaint' : immutable, no need to clone reference // 'itemLabelFont' : immutable, no need to clone reference - if (this.itemLabelFontList != null) { - clone.itemLabelFontList - = (ObjectList) this.itemLabelFontList.clone(); + if (this.itemLabelFontMap != null) { + clone.itemLabelFontMap + = CloneUtils.cloneMapValues(this.itemLabelFontMap); } // 'baseItemLabelFont' : immutable, no need to clone reference @@ -3268,16 +3264,16 @@ // 'baseItemLabelPaint' : immutable, no need to clone reference // 'postiveItemLabelAnchor' : immutable, no need to clone reference - if (this.positiveItemLabelPositionList != null) { - clone.positiveItemLabelPositionList - = (ObjectList) this.positiveItemLabelPositionList.clone(); + if (this.positiveItemLabelPositionMap != null) { + clone.positiveItemLabelPositionMap = CloneUtils.cloneMapValues( + this.positiveItemLabelPositionMap); } // 'baseItemLabelAnchor' : immutable, no need to clone reference // 'negativeItemLabelAnchor' : immutable, no need to clone reference - if (this.negativeItemLabelPositionList != null) { - clone.negativeItemLabelPositionList - = (ObjectList) this.negativeItemLabelPositionList.clone(); + if (this.negativeItemLabelPositionMap != null) { + clone.negativeItemLabelPositionMap = CloneUtils.cloneMapValues( + this.negativeItemLabelPositionMap); } // 'baseNegativeItemLabelAnchor' : immutable, no need to clone reference @@ -3289,8 +3285,9 @@ if (this.legendShapeList != null) { clone.legendShapeList = (ShapeList) this.legendShapeList.clone(); } - if (this.legendTextFont != null) { - clone.legendTextFont = (ObjectList) this.legendTextFont.clone(); + if (this.legendTextFontMap != null) { + clone.legendTextFontMap = CloneUtils.cloneMapValues( + this.legendTextFontMap); } if (this.legendTextPaint != null) { clone.legendTextPaint = (PaintList) this.legendTextPaint.clone(); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2014-04-09 08:52:25 UTC (rev 3122) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2014-04-09 09:23:25 UTC (rev 3123) @@ -2,7 +2,7 @@ * JFreeChart : a free chart library for the Java(tm) platform * =========================================================== * - * (C) Copyright 2000-2013, by Object Refinery Limited and Contributors. + * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * @@ -27,7 +27,7 @@ * --------------------------------- * AbstractCategoryItemRenderer.java * --------------------------------- - * (C) Copyright 2002-2013, by Object Refinery Limited. + * (C) Copyright 2002-2014, by Object Refinery Limited. * * Original Author: David Gilbert (for Object Refinery Limited); * Contributor(s): Richard Atkinson; @@ -104,6 +104,7 @@ * 01-Apr-2009 : Added new addEntity() method (DG); * 09-Feb-2010 : Fixed bug 2947660 (DG); * 02-Jul-2013 : Use ParamChecks (DG); + * 08-Apr-2014 : Remove use of ObjectList (DG); * */ @@ -124,7 +125,9 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.axis.CategoryAxis; @@ -148,6 +151,7 @@ import org.jfree.chart.plot.ValueMarker; import org.jfree.chart.renderer.AbstractRenderer; import org.jfree.chart.urls.CategoryURLGenerator; +import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.data.Range; import org.jfree.data.category.CategoryDataset; @@ -158,7 +162,6 @@ import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleEdge; import org.jfree.ui.RectangleInsets; -import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PublicCloneable; import org.jfree.util.SortOrder; @@ -180,19 +183,19 @@ private CategoryPlot plot; /** A list of item label generators (one per series). */ - private ObjectList itemLabelGeneratorList; + private Map<Integer, CategoryItemLabelGenerator> itemLabelGeneratorMap; /** The base item label generator. */ private CategoryItemLabelGenerator baseItemLabelGenerator; /** A list of tool tip generators (one per series). */ - private ObjectList toolTipGeneratorList; + private Map<Integer, CategoryToolTipGenerator> toolTipGeneratorMap; /** The base tool tip generator. */ private CategoryToolTipGenerator baseToolTipGenerator; /** A list of item label generators (one per series). */ - private ObjectList itemURLGeneratorList; + private Map<Integer, CategoryURLGenerator> itemURLGeneratorMap; /** The base item label generator. */ private CategoryURLGenerator baseItemURLGenerator; @@ -221,11 +224,13 @@ */ protected AbstractCategoryItemRenderer() { this.itemLabelGenerator = null; - this.itemLabelGeneratorList = new ObjectList(); + this.itemLabelGeneratorMap + = new HashMap<Integer, CategoryItemLabelGenerator>(); this.toolTipGenerator = null; - this.toolTipGeneratorList = new ObjectList(); + this.toolTipGeneratorMap + = new HashMap<Integer, CategoryToolTipGenerator>(); this.itemURLGenerator = null; - this.itemURLGeneratorList = new ObjectList(); + this.itemURLGeneratorMap = new HashMap<Integer, CategoryURLGenerator>(); this.legendItemLabelGenerator = new StandardCategorySeriesLabelGenerator(); } @@ -308,13 +313,12 @@ } // otherwise look up the generator table - CategoryItemLabelGenerator generator = (CategoryItemLabelGenerator) - this.itemLabelGeneratorList.get(series); + CategoryItemLabelGenerator generator = this.itemLabelGeneratorMap.get( + series); if (generator == null) { generator = this.baseItemLabelGenerator; } return generator; - } /** @@ -329,7 +333,7 @@ @Override public void setSeriesItemLabelGenerator(int series, CategoryItemLabelGenerator generator) { - this.itemLabelGeneratorList.set(series, generator); + this.itemLabelGeneratorMap.put(series, generator); fireChangeEvent(); } @@ -402,7 +406,7 @@ */ @Override public CategoryToolTipGenerator getSeriesToolTipGenerator(int series) { - return (CategoryToolTipGenerator) this.toolTipGeneratorList.get(series); + return this.toolTipGeneratorMap.get(series); } /** @@ -417,7 +421,7 @@ @Override public void setSeriesToolTipGenerator(int series, CategoryToolTipGenerator generator) { - this.toolTipGeneratorList.set(series, generator); + this.toolTipGeneratorMap.put(series, generator); fireChangeEvent(); } @@ -475,20 +479,16 @@ */ @Override public CategoryURLGenerator getSeriesItemURLGenerator(int series) { - // return the generator for ALL series, if there is one... if (this.itemURLGenerator != null) { return this.itemURLGenerator; } - // otherwise look up the generator table - CategoryURLGenerator generator - = (CategoryURLGenerator) this.itemURLGeneratorList.get(series); + CategoryURLGenerator generator = this.itemURLGeneratorMap.get(series); if (generator == null) { generator = this.baseItemURLGenerator; } return generator; - } /** @@ -503,7 +503,7 @@ @Override public void setSeriesItemURLGenerator(int series, CategoryURLGenerator generator) { - this.itemURLGeneratorList.set(series, generator); + this.itemURLGeneratorMap.put(series, generator); fireChangeEvent(); } @@ -1238,7 +1238,6 @@ */ @Override public boolean equals(Object obj) { - if (obj == this) { return true; } @@ -1251,8 +1250,8 @@ that.itemLabelGenerator)) { return false; } - if (!ObjectUtilities.equal(this.itemLabelGeneratorList, - that.itemLabelGeneratorList)) { + if (!ObjectUtilities.equal(this.itemLabelGeneratorMap, + that.itemLabelGeneratorMap)) { return false; } if (!ObjectUtilities.equal(this.baseItemLabelGenerator, @@ -1263,8 +1262,8 @@ that.toolTipGenerator)) { return false; } - if (!ObjectUtilities.equal(this.toolTipGeneratorList, - that.toolTipGeneratorList)) { + if (!ObjectUtilities.equal(this.toolTipGeneratorMap, + that.toolTipGeneratorMap)) { return false; } if (!ObjectUtilities.equal(this.baseToolTipGenerator, @@ -1275,8 +1274,8 @@ that.itemURLGenerator)) { return false; } - if (!ObjectUtilities.equal(this.itemURLGeneratorList, - that.itemURLGeneratorList)) { + if (!ObjectUtilities.equal(this.itemURLGeneratorMap, + that.itemURLGeneratorMap)) { return false; } if (!ObjectUtilities.equal(this.baseItemURLGenerator, @@ -1416,7 +1415,6 @@ */ @Override public Object clone() throws CloneNotSupportedException { - AbstractCategoryItemRenderer clone = (AbstractCategoryItemRenderer) super.clone(); @@ -1432,9 +1430,9 @@ } } - if (this.itemLabelGeneratorList != null) { - clone.itemLabelGeneratorList - = (ObjectList) this.itemLabelGeneratorList.clone(); + if (this.itemLabelGeneratorMap != null) { + clone.itemLabelGeneratorMap = CloneUtils.cloneMapValues( + this.itemLabelGeneratorMap); } if (this.baseItemLabelGenerator != null) { @@ -1461,9 +1459,9 @@ } } - if (this.toolTipGeneratorList != null) { - clone.toolTipGeneratorList - = (ObjectList) this.toolTipGeneratorList.clone(); + if (this.toolTipGeneratorMap != null) { + clone.toolTipGeneratorMap = CloneUtils.cloneMapValues( + this.toolTipGeneratorMap); } if (this.baseToolTipGenerator != null) { @@ -1490,9 +1488,9 @@ } } - if (this.itemURLGeneratorList != null) { - clone.itemURLGeneratorList - = (ObjectList) this.itemURLGeneratorList.clone(); + if (this.itemURLGeneratorMap != null) { + clone.itemURLGeneratorMap = CloneUtils.cloneMapValues( + this.itemURLGeneratorMap); } if (this.baseItemURLGenerator != null) { Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java 2014-04-09 08:52:25 UTC (rev 3122) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java 2014-04-09 09:23:25 UTC (rev 3123) @@ -120,6 +120,7 @@ * 06-Oct-2011 : Add utility methods to work with 1.4 API in GeneralPath (MK) * 03-Jul-2013 : Use ParamChecks (DG); * 11-Jan-2014 : Fix error in fillDomainGridBand method (DG); + * 07-Apr-2014 : Don't use ObjectList anymore (DG); * */ @@ -141,8 +142,10 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; @@ -170,6 +173,7 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.AbstractRenderer; import org.jfree.chart.urls.XYURLGenerator; +import org.jfree.chart.util.CloneUtils; import org.jfree.chart.util.ParamChecks; import org.jfree.data.Range; import org.jfree.data.general.DatasetUtilities; @@ -180,7 +184,6 @@ import org.jfree.ui.LengthAdjustmentType; import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleInsets; -import org.jfree.util.ObjectList; import org.jfree.util.ObjectUtilities; import org.jfree.util.PublicCloneable; @@ -199,13 +202,13 @@ private XYPlot plot; /** A list of item label generators (one per series). */ - private ObjectList itemLabelGeneratorList; + private Map<Integer, XYItemLabelGenerator> itemLabelGeneratorMap; /** The base item label generator. */ private XYItemLabelGenerator baseItemLabelGenerator; /** A list of tool tip generators (one per series). */ - private ObjectList toolTipGeneratorList; + private Map<Integer, XYToolTipGenerator> toolTipGeneratorMap; /** The base tool tip generator. */ private XYToolTipGenerator baseToolTipGenerator; @@ -241,9 +244,10 @@ protected AbstractXYItemRenderer() { super(); this.itemLabelGenerator = null; - this.itemLabelGeneratorList = new ObjectList(); + this.itemLabelGeneratorMap + = new HashMap<Integer, XYItemLabelGenerator>(); this.toolTipGenerator = null; - this.toolTipGeneratorList = new ObjectList(); + this.toolTipGeneratorMap = new HashMap<Integer, XYToolTipGenerator>(); this.urlGenerator = null; this.backgroundAnnotations = new java.util.ArrayList(); this.foregroundAnnotations = new java.util.ArrayList(); @@ -328,7 +332,7 @@ // otherwise look up the generator table XYItemLabelGenerator generator - = (XYItemLabelGenerator) this.itemLabelGeneratorList.get(series); + = (XYItemLabelGenerator) this.itemLabelGeneratorMap.get(series); if (generator == null) { generator = this.baseItemLabelGenerator; } @@ -344,7 +348,7 @@ */ @Override public XYItemLabelGenerator getSeriesItemLabelGenerator(int series) { - return (XYItemLabelGenerator) this.itemLabelGeneratorList.get(series); + return this.itemLabelGeneratorMap.get(series); } /** @@ -356,8 +360,8 @@ */ @Override public void setSeriesItemLabelGenerator(int series, - XYItemLabelGenerator generator) { - this.itemLabelGeneratorList.set(series, generator); + XYItemLabelGenerator generator) { + this.itemLabelGeneratorMap.put(series, generator); fireChangeEvent(); } @@ -404,7 +408,7 @@ // otherwise look up the generator table XYToolTipGenerator generator - ... [truncated message content] |