From e848076b88967b44a3cc680ee0185173042fb7d9 Mon Sep 17 00:00:00 2001 From: Yuri Blankenstein Date: Wed, 24 May 2023 10:25:52 +0200 Subject: [PATCH] #364 Adding clearSeriesXXX methods for all series settings --- README.md | 1 + .../chart/renderer/AbstractRenderer.java | 178 ++++++++++++++++++ 2 files changed, 179 insertions(+) diff --git a/README.md b/README.md index cef781a25..d845c54cd 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ at GitHub: History ------- ##### Version 1.5.5 (not yet released) +- Add clearSeriesXXX methods for all series settings in AbstractRenderer ([#364](https://github.com/jfree/jfreechart/issues/364)) - fix cross hair painting ([#340](https://github.com/jfree/jfreechart/issues/340)) ##### Version 1.5.4 (8 January 2023) diff --git a/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java b/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java index 7fba691d4..1bf9cbc23 100644 --- a/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java +++ b/src/main/java/org/jfree/chart/renderer/AbstractRenderer.java @@ -501,6 +501,20 @@ public void setSeriesVisible(int series, Boolean visible, boolean notify) { } } + /** + * Clears the flags that controls whether a series is visible for this + * renderer and, if requested, sends a {@link RendererChangeEvent} to all + * registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesVisible(boolean notify) { + this.seriesVisibleList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default visibility for all series. * @@ -613,6 +627,20 @@ public void setSeriesVisibleInLegend(int series, Boolean visible, } } + /** + * Clears the series visible in the legend settings for this renderer and, + * if requested, sends a {@link RendererChangeEvent} to all registered + * listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesVisibleInLegend(boolean notify) { + this.seriesVisibleInLegendList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default visibility in the legend for all series. * @@ -901,6 +929,20 @@ public void setSeriesFillPaint(int series, Paint paint, boolean notify) { } } + /** + * Clears the series fill paint settings for this renderer and, if + * requested, sends a {@link RendererChangeEvent} to all registered + * listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesFillPaints(boolean notify) { + this.fillPaintList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default fill paint. * @@ -1054,6 +1096,20 @@ public void setSeriesOutlinePaint(int series, Paint paint, boolean notify) { } } + /** + * Clears the series outline paint settings for this renderer and, if + * requested, sends a {@link RendererChangeEvent} to all registered + * listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesOutlinePaints(boolean notify) { + this.outlinePaintList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default outline paint. * @@ -1368,6 +1424,20 @@ public void setSeriesOutlineStroke(int series, Stroke stroke, } } + /** + * Clears the series outline stroke settings for this renderer and, if + * requested, sends a {@link RendererChangeEvent} to all registered + * listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesOutlineStrokes(boolean notify) { + this.outlineStrokeList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default outline stroke. * @@ -1520,6 +1590,19 @@ public void setSeriesShape(int series, Shape shape, boolean notify) { } } + /** + * Clears the series shape settings for this renderer and, if requested, + * sends a {@link RendererChangeEvent} to all registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesShapes(boolean notify) { + this.shapeList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default shape. * @@ -1655,6 +1738,20 @@ public void setSeriesItemLabelsVisible(int series, Boolean visible, } } + /** + * Clears the visibility of item labels for a series settings for this + * renderer and, if requested, sends a {@link RendererChangeEvent} to all + * registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesItemLabelsVisible(boolean notify) { + this.itemLabelsVisibleList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the base setting for item label visibility. A {@code null} * result should be interpreted as equivalent to {@code Boolean.FALSE}. @@ -1759,6 +1856,19 @@ public void setSeriesItemLabelFont(int series, Font font, boolean notify) { } } + /** + * Clears the item label font settings for this renderer and, if requested, + * sends a {@link RendererChangeEvent} to all registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesItemLabelFonts(boolean notify) { + this.itemLabelFontMap.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default item label font (this is used when no other font * setting is available). @@ -1898,6 +2008,19 @@ public void setSeriesItemLabelPaint(int series, Paint paint, } } + /** + * Clears the item label paint settings for this renderer and, if requested, + * sends a {@link RendererChangeEvent} to all registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesItemLabelPaints(boolean notify) { + this.itemLabelPaintList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default item label paint. * @@ -2007,6 +2130,20 @@ public void setSeriesPositiveItemLabelPosition(int series, } } + /** + * Clears the item label position for all positive values for series + * settings for this renderer and, if requested, sends a + * {@link RendererChangeEvent} to all registered listeners. + * + * @param notify notify listeners? + */ + public void clearSeriesPositiveItemLabelPositions(boolean notify) { + this.positiveItemLabelPositionMap.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default positive item label position. * @@ -2382,6 +2519,19 @@ public void setLegendShape(int series, Shape shape) { fireChangeEvent(); } + /** + * Clears the series legend shapes for this renderer and, if requested, + * sends a {@link RendererChangeEvent} to all registered listeners. + * + * @param notify notify listeners? + */ + public void clearLegendShapes(boolean notify) { + this.legendShapeList.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default legend shape, which may be {@code null}. * @@ -2466,6 +2616,20 @@ public void setLegendTextFont(int series, Font font) { fireChangeEvent(); } + /** + * Clears the font used for the legend text for series settings for this + * renderer and, if requested, sends a {@link RendererChangeEvent} to all + * registered listeners. + * + * @param notify notify listeners? + */ + public void clearLegendTextFonts(boolean notify) { + this.legendTextFontMap.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default legend text font, which may be {@code null}. * @@ -2528,6 +2692,20 @@ public void setLegendTextPaint(int series, Paint paint) { fireChangeEvent(); } + /** + * Clears the paint used for the legend text for series settings for this + * renderer and, if requested, sends a {@link RendererChangeEvent} to all + * registered listeners. + * + * @param notify notify listeners? + */ + public void clearLegendTextPaints(boolean notify) { + this.legendTextPaint.clear(); + if (notify) { + fireChangeEvent(); + } + } + /** * Returns the default legend text paint, which may be {@code null}. *