001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2017, by Object Refinery Limited and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * ---------------------
028 * AbstractRenderer.java
029 * ---------------------
030 * (C) Copyright 2002-2016, by Object Refinery Limited.
031 *
032 * Original Author:  David Gilbert (for Object Refinery Limited);
033 * Contributor(s):   Nicolas Brodu;
034 *
035 * Changes:
036 * --------
037 * 22-Aug-2002 : Version 1, draws code out of AbstractXYItemRenderer to share
038 *               with AbstractCategoryItemRenderer (DG);
039 * 01-Oct-2002 : Fixed errors reported by Checkstyle (DG);
040 * 06-Nov-2002 : Moved to the com.jrefinery.chart.renderer package (DG);
041 * 21-Nov-2002 : Added a paint table for the renderer to use (DG);
042 * 17-Jan-2003 : Moved plot classes into a separate package (DG);
043 * 25-Mar-2003 : Implemented Serializable (DG);
044 * 29-Apr-2003 : Added valueLabelFont and valueLabelPaint attributes, based on
045 *               code from Arnaud Lelievre (DG);
046 * 29-Jul-2003 : Amended code that doesn't compile with JDK 1.2.2 (DG);
047 * 13-Aug-2003 : Implemented Cloneable (DG);
048 * 15-Sep-2003 : Fixed serialization (NB);
049 * 17-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
050 * 07-Oct-2003 : Moved PlotRenderingInfo into RendererState to allow for
051 *               multiple threads using a single renderer (DG);
052 * 20-Oct-2003 : Added missing setOutlinePaint() method (DG);
053 * 23-Oct-2003 : Split item label attributes into 'positive' and 'negative'
054 *               values (DG);
055 * 26-Nov-2003 : Added methods to get the positive and negative item label
056 *               positions (DG);
057 * 01-Mar-2004 : Modified readObject() method to prevent null pointer exceptions
058 *               after deserialization (DG);
059 * 19-Jul-2004 : Fixed bug in getItemLabelFont(int, int) method (DG);
060 * 04-Oct-2004 : Updated equals() method, eliminated use of NumberUtils,
061 *               renamed BooleanUtils --> BooleanUtilities, ShapeUtils -->
062 *               ShapeUtilities (DG);
063 * 15-Mar-2005 : Fixed serialization of baseFillPaint (DG);
064 * 16-May-2005 : Base outline stroke should never be null (DG);
065 * 01-Jun-2005 : Added hasListener() method for unit testing (DG);
066 * 08-Jun-2005 : Fixed equals() method to handle GradientPaint (DG);
067 * ------------- JFREECHART 1.0.x ---------------------------------------------
068 * 02-Feb-2007 : Minor API doc update (DG);
069 * 19-Feb-2007 : Fixes for clone() method (DG);
070 * 28-Feb-2007 : Use cached event to signal changes (DG);
071 * 19-Apr-2007 : Deprecated seriesVisible and seriesVisibleInLegend flags (DG);
072 * 20-Apr-2007 : Deprecated paint, fillPaint, outlinePaint, stroke,
073 *               outlineStroke, shape, itemLabelsVisible, itemLabelFont,
074 *               itemLabelPaint, positiveItemLabelPosition,
075 *               negativeItemLabelPosition and createEntities override
076 *               fields (DG);
077 * 13-Jun-2007 : Added new autoPopulate flags for core series attributes (DG);
078 * 23-Oct-2007 : Updated lookup methods to better handle overridden
079 *               methods (DG);
080 * 04-Dec-2007 : Modified hashCode() implementation (DG);
081 * 29-Apr-2008 : Minor API doc update (DG);
082 * 17-Jun-2008 : Added legendShape, legendTextFont and legendTextPaint
083 *               attributes (DG);
084 * 18-Aug-2008 : Added clearSeriesPaints() and clearSeriesStrokes() (DG);
085 * 28-Jan-2009 : Equals method doesn't test Shape equality correctly (DG);
086 * 27-Mar-2009 : Added dataBoundsIncludesVisibleSeriesOnly attribute, and
087 *               updated renderer events for series visibility changes (DG);
088 * 01-Apr-2009 : Factored up the defaultEntityRadius field from the
089 *               AbstractXYItemRenderer class (DG);
090 * 28-Apr-2009 : Added flag to allow a renderer to treat the legend shape as
091 *               a line (DG);
092 * 05-Jul-2012 : No need for BooleanUtilities now that min JDK = 1.4.2 (DG);
093 * 03-Jul-2013 : Use ParamChecks (DG);
094 * 09-Apr-2014 : Remove use of ObjectList (DG);
095 * 24-Aug-2014 : Add begin/endElementGroup() (DG);
096 * 25-Apr-2016 : Fix cloning test failure (DG);
097 *
098 */
099
100package org.jfree.chart.renderer;
101
102import java.awt.BasicStroke;
103import java.awt.Color;
104import java.awt.Font;
105import java.awt.Graphics2D;
106import java.awt.Paint;
107import java.awt.Shape;
108import java.awt.Stroke;
109import java.awt.geom.Point2D;
110import java.awt.geom.Rectangle2D;
111import java.io.IOException;
112import java.io.ObjectInputStream;
113import java.io.ObjectOutputStream;
114import java.io.Serializable;
115import java.util.Arrays;
116import java.util.EventListener;
117import java.util.HashMap;
118import java.util.List;
119import java.util.Map;
120
121import javax.swing.event.EventListenerList;
122
123import org.jfree.chart.ChartHints;
124import org.jfree.chart.HashUtils;
125import org.jfree.chart.event.RendererChangeEvent;
126import org.jfree.chart.event.RendererChangeListener;
127import org.jfree.chart.labels.ItemLabelAnchor;
128import org.jfree.chart.labels.ItemLabelPosition;
129import org.jfree.chart.plot.DrawingSupplier;
130import org.jfree.chart.plot.PlotOrientation;
131import org.jfree.chart.title.LegendTitle;
132import org.jfree.chart.ui.TextAnchor;
133import org.jfree.chart.util.BooleanList;
134import org.jfree.chart.util.ObjectUtils;
135import org.jfree.chart.util.PaintList;
136import org.jfree.chart.util.PaintUtils;
137import org.jfree.chart.util.Args;
138import org.jfree.chart.util.SerialUtils;
139import org.jfree.chart.util.ShapeList;
140import org.jfree.chart.util.ShapeUtils;
141import org.jfree.chart.util.StrokeList;
142import org.jfree.data.ItemKey;
143
144/**
145 * Base class providing common services for renderers.  Most methods that update
146 * attributes of the renderer will fire a {@link RendererChangeEvent}, which
147 * normally means the plot that owns the renderer will receive notification that
148 * the renderer has been changed (the plot will, in turn, notify the chart).
149 */
150public abstract class AbstractRenderer implements Cloneable, Serializable {
151
152    /** For serialization. */
153    private static final long serialVersionUID = -828267569428206075L;
154
155    /** Zero represented as a {@code double}. */
156    public static final Double ZERO = 0.0;
157
158    /** The default paint. */
159    public static final Paint DEFAULT_PAINT = Color.BLUE;
160
161    /** The default outline paint. */
162    public static final Paint DEFAULT_OUTLINE_PAINT = Color.GRAY;
163
164    /** The default stroke. */
165    public static final Stroke DEFAULT_STROKE = new BasicStroke(1.0f);
166
167    /** The default outline stroke. */
168    public static final Stroke DEFAULT_OUTLINE_STROKE = new BasicStroke(1.0f);
169
170    /** The default shape. */
171    public static final Shape DEFAULT_SHAPE
172            = new Rectangle2D.Double(-3.0, -3.0, 6.0, 6.0);
173
174    /** The default value label font. */
175    public static final Font DEFAULT_VALUE_LABEL_FONT
176            = new Font("SansSerif", Font.PLAIN, 10);
177
178    /** The default value label paint. */
179    public static final Paint DEFAULT_VALUE_LABEL_PAINT = Color.BLACK;
180
181    /** A list of flags that controls whether or not each series is visible. */
182    private BooleanList seriesVisibleList;
183
184    /** The default visibility for all series. */
185    private boolean defaultSeriesVisible;
186
187    /**
188     * A list of flags that controls whether or not each series is visible in
189     * the legend.
190     */
191    private BooleanList seriesVisibleInLegendList;
192
193    /** The default visibility for each series in the legend. */
194    private boolean defaultSeriesVisibleInLegend;
195
196    /** The paint list. */
197    private PaintList paintList;
198
199    /**
200     * A flag that controls whether or not the paintList is auto-populated
201     * in the {@link #lookupSeriesPaint(int)} method.
202     *
203     * @since 1.0.6
204     */
205    private boolean autoPopulateSeriesPaint;
206
207    /** The default paint, used when there is no paint assigned for a series. */
208    private transient Paint defaultPaint;
209
210    /** The fill paint list. */
211    private PaintList fillPaintList;
212
213    /**
214     * A flag that controls whether or not the fillPaintList is auto-populated
215     * in the {@link #lookupSeriesFillPaint(int)} method.
216     *
217     * @since 1.0.6
218     */
219    private boolean autoPopulateSeriesFillPaint;
220
221    /** The base fill paint. */
222    private transient Paint defaultFillPaint;
223
224    /** The outline paint list. */
225    private PaintList outlinePaintList;
226
227    /**
228     * A flag that controls whether or not the outlinePaintList is
229     * auto-populated in the {@link #lookupSeriesOutlinePaint(int)} method.
230     *
231     * @since 1.0.6
232     */
233    private boolean autoPopulateSeriesOutlinePaint;
234
235    /** The base outline paint. */
236    private transient Paint defaultOutlinePaint;
237
238    /** The stroke list. */
239    private StrokeList strokeList;
240
241    /**
242     * A flag that controls whether or not the strokeList is auto-populated
243     * in the {@link #lookupSeriesStroke(int)} method.
244     *
245     * @since 1.0.6
246     */
247    private boolean autoPopulateSeriesStroke;
248
249    /** The base stroke. */
250    private transient Stroke defaultStroke;
251
252    /** The outline stroke list. */
253    private StrokeList outlineStrokeList;
254
255    /** The base outline stroke. */
256    private transient Stroke defaultOutlineStroke;
257
258    /**
259     * A flag that controls whether or not the outlineStrokeList is
260     * auto-populated in the {@link #lookupSeriesOutlineStroke(int)} method.
261     *
262     * @since 1.0.6
263     */
264    private boolean autoPopulateSeriesOutlineStroke;
265
266    /** A shape list. */
267    private ShapeList shapeList;
268
269    /**
270     * A flag that controls whether or not the shapeList is auto-populated
271     * in the {@link #lookupSeriesShape(int)} method.
272     *
273     * @since 1.0.6
274     */
275    private boolean autoPopulateSeriesShape;
276
277    /** The base shape. */
278    private transient Shape defaultShape;
279
280    /** Visibility of the item labels PER series. */
281    private BooleanList itemLabelsVisibleList;
282
283    /** The base item labels visible. */
284    private boolean defaultItemLabelsVisible;
285
286    /** The item label font list (one font per series). */
287    private Map<Integer, Font> itemLabelFontMap;
288
289    /** The base item label font. */
290    private Font defaultItemLabelFont;
291
292    /** The item label paint list (one paint per series). */
293    private PaintList itemLabelPaintList;
294
295    /** The base item label paint. */
296    private transient Paint defaultItemLabelPaint;
297
298    /** The positive item label position (per series). */
299    private Map<Integer, ItemLabelPosition> positiveItemLabelPositionMap;
300
301    /** The fallback positive item label position. */
302    private ItemLabelPosition defaultPositiveItemLabelPosition;
303
304    /** The negative item label position (per series). */
305    private Map<Integer, ItemLabelPosition> negativeItemLabelPositionMap;
306
307    /** The fallback negative item label position. */
308    private ItemLabelPosition defaultNegativeItemLabelPosition;
309
310    /** The item label anchor offset. */
311    private double itemLabelAnchorOffset = 2.0;
312
313    /**
314     * Flags that control whether or not entities are generated for each
315     * series.  This will be overridden by 'createEntities'.
316     */
317    private BooleanList createEntitiesList;
318
319    /**
320     * The default flag that controls whether or not entities are generated.
321     * This flag is used when both the above flags return null.
322     */
323    private boolean defaultCreateEntities;
324
325    /**
326     * The per-series legend shape settings.
327     *
328     * @since 1.0.11
329     */
330    private ShapeList legendShapeList;
331
332    /**
333     * The base shape for legend items.  If this is {@code null}, the
334     * series shape will be used.
335     *
336     * @since 1.0.11
337     */
338    private transient Shape defaultLegendShape;
339
340    /**
341     * A special flag that, if true, will cause the getLegendItem() method
342     * to configure the legend shape as if it were a line.
343     *
344     * @since 1.0.14
345     */
346    private boolean treatLegendShapeAsLine;
347
348    /**
349     * The per-series legend text font.
350     *
351     * @since 1.0.11
352     */
353    private Map<Integer, Font> legendTextFontMap;
354
355    /**
356     * The base legend font.
357     *
358     * @since 1.0.11
359     */
360    private Font defaultLegendTextFont;
361
362    /**
363     * The per series legend text paint settings.
364     *
365     * @since 1.0.11
366     */
367    private PaintList legendTextPaint;
368
369    /**
370     * The default paint for the legend text items (if this is
371     * {@code null}, the {@link LegendTitle} class will determine the
372     * text paint to use.
373     *
374     * @since 1.0.11
375     */
376    private transient Paint defaultLegendTextPaint;
377
378    /**
379     * A flag that controls whether or not the renderer will include the
380     * non-visible series when calculating the data bounds.
381     *
382     * @since 1.0.13
383     */
384    private boolean dataBoundsIncludesVisibleSeriesOnly = true;
385
386    /** The default radius for the entity 'hotspot' */
387    private int defaultEntityRadius;
388
389    /** Storage for registered change listeners. */
390    private transient EventListenerList listenerList;
391
392    /** An event for re-use. */
393    private transient RendererChangeEvent event;
394
395    /**
396     * Default constructor.
397     */
398    public AbstractRenderer() {
399        this.seriesVisibleList = new BooleanList();
400        this.defaultSeriesVisible = true;
401
402        this.seriesVisibleInLegendList = new BooleanList();
403        this.defaultSeriesVisibleInLegend = true;
404
405        this.paintList = new PaintList();
406        this.defaultPaint = DEFAULT_PAINT;
407        this.autoPopulateSeriesPaint = true;
408
409        this.fillPaintList = new PaintList();
410        this.defaultFillPaint = Color.WHITE;
411        this.autoPopulateSeriesFillPaint = false;
412
413        this.outlinePaintList = new PaintList();
414        this.defaultOutlinePaint = DEFAULT_OUTLINE_PAINT;
415        this.autoPopulateSeriesOutlinePaint = false;
416
417        this.strokeList = new StrokeList();
418        this.defaultStroke = DEFAULT_STROKE;
419        this.autoPopulateSeriesStroke = true;
420
421        this.outlineStrokeList = new StrokeList();
422        this.defaultOutlineStroke = DEFAULT_OUTLINE_STROKE;
423        this.autoPopulateSeriesOutlineStroke = false;
424
425        this.shapeList = new ShapeList();
426        this.defaultShape = DEFAULT_SHAPE;
427        this.autoPopulateSeriesShape = true;
428
429        this.itemLabelsVisibleList = new BooleanList();
430        this.defaultItemLabelsVisible = false;
431
432        this.itemLabelFontMap = new HashMap<Integer, Font>();
433        this.defaultItemLabelFont = new Font("SansSerif", Font.PLAIN, 10);
434
435        this.itemLabelPaintList = new PaintList();
436        this.defaultItemLabelPaint = Color.BLACK;
437
438        this.positiveItemLabelPositionMap 
439                = new HashMap<Integer, ItemLabelPosition>();
440        this.defaultPositiveItemLabelPosition = new ItemLabelPosition(
441                ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
442
443        this.negativeItemLabelPositionMap 
444                = new HashMap<Integer, ItemLabelPosition>();
445        this.defaultNegativeItemLabelPosition = new ItemLabelPosition(
446                ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
447
448        this.createEntitiesList = new BooleanList();
449        this.defaultCreateEntities = true;
450
451        this.defaultEntityRadius = 3;
452
453        this.legendShapeList = new ShapeList();
454        this.defaultLegendShape = null;
455
456        this.treatLegendShapeAsLine = false;
457
458        this.legendTextFontMap = new HashMap<Integer, Font>();
459        this.defaultLegendTextFont = null;
460
461        this.legendTextPaint = new PaintList();
462        this.defaultLegendTextPaint = null;
463
464        this.listenerList = new EventListenerList();
465    }
466
467    /**
468     * Returns the drawing supplier from the plot.
469     *
470     * @return The drawing supplier.
471     */
472    public abstract DrawingSupplier getDrawingSupplier();
473
474    /**
475     * Adds a {@code KEY_BEGIN_ELEMENT} hint to the graphics target.  This
476     * hint is recognised by <b>JFreeSVG</b> (in theory it could be used by 
477     * other {@code Graphics2D} implementations also).
478     * 
479     * @param g2  the graphics target ({@code null} not permitted).
480     * @param key  the key ({@code null} not permitted).
481     * 
482     * @see #endElementGroup(java.awt.Graphics2D) 
483     * @since 1.0.20
484     */
485    protected void beginElementGroup(Graphics2D g2, ItemKey key) {
486        Args.nullNotPermitted(key, "key");
487        Map<String, String> m = new HashMap<>(1);
488        m.put("ref", key.toJSONString());
489        g2.setRenderingHint(ChartHints.KEY_BEGIN_ELEMENT, m);        
490    }
491    
492    /**
493     * Adds a {@code KEY_END_ELEMENT} hint to the graphics target.
494     * 
495     * @param g2  the graphics target ({@code null} not permitted).
496     * 
497     * @see #beginElementGroup(java.awt.Graphics2D, org.jfree.data.ItemKey) 
498     * @since 1.0.20
499     */
500    protected void endElementGroup(Graphics2D g2) {
501        g2.setRenderingHint(ChartHints.KEY_END_ELEMENT, Boolean.TRUE);
502    }
503
504    // SERIES VISIBLE (not yet respected by all renderers)
505
506    /**
507     * Returns a boolean that indicates whether or not the specified item
508     * should be drawn.
509     *
510     * @param series  the series index.
511     * @param item  the item index.
512     *
513     * @return A boolean.
514     */
515    public boolean getItemVisible(int series, int item) {
516        return isSeriesVisible(series);
517    }
518
519    /**
520     * Returns a boolean that indicates whether or not the specified series
521     * should be drawn.  In fact this method should be named 
522     * lookupSeriesVisible() to be consistent with the other series
523     * attributes and avoid confusion with the getSeriesVisible() method.
524     *
525     * @param series  the series index.
526     *
527     * @return A boolean.
528     */
529    public boolean isSeriesVisible(int series) {
530        boolean result = this.defaultSeriesVisible;
531        Boolean b = this.seriesVisibleList.getBoolean(series);
532        if (b != null) {
533            result = b;
534        }
535        return result;
536    }
537
538    /**
539     * Returns the flag that controls whether a series is visible.
540     *
541     * @param series  the series index (zero-based).
542     *
543     * @return The flag (possibly {@code null}).
544     *
545     * @see #setSeriesVisible(int, Boolean)
546     */
547    public Boolean getSeriesVisible(int series) {
548        return this.seriesVisibleList.getBoolean(series);
549    }
550
551    /**
552     * Sets the flag that controls whether a series is visible and sends a
553     * {@link RendererChangeEvent} to all registered listeners.
554     *
555     * @param series  the series index (zero-based).
556     * @param visible  the flag ({@code null} permitted).
557     *
558     * @see #getSeriesVisible(int)
559     */
560    public void setSeriesVisible(int series, Boolean visible) {
561        setSeriesVisible(series, visible, true);
562    }
563
564    /**
565     * Sets the flag that controls whether a series is visible and, if
566     * requested, sends a {@link RendererChangeEvent} to all registered
567     * listeners.
568     *
569     * @param series  the series index.
570     * @param visible  the flag ({@code null} permitted).
571     * @param notify  notify listeners?
572     *
573     * @see #getSeriesVisible(int)
574     */
575    public void setSeriesVisible(int series, Boolean visible, boolean notify) {
576        this.seriesVisibleList.setBoolean(series, visible);
577        if (notify) {
578            // we create an event with a special flag set...the purpose of
579            // this is to communicate to the plot (the default receiver of
580            // the event) that series visibility has changed so the axis
581            // ranges might need updating...
582            RendererChangeEvent e = new RendererChangeEvent(this, true);
583            notifyListeners(e);
584        }
585    }
586
587    /**
588     * Returns the default visibility for all series.
589     *
590     * @return The default visibility.
591     *
592     * @see #setDefaultSeriesVisible(boolean)
593     */
594    public boolean getDefaultSeriesVisible() {
595        return this.defaultSeriesVisible;
596    }
597
598    /**
599     * Sets the default series visibility and sends a 
600     * {@link RendererChangeEvent} to all registered listeners.
601     *
602     * @param visible  the flag.
603     *
604     * @see #getDefaultSeriesVisible()
605     */
606    public void setDefaultSeriesVisible(boolean visible) {
607        // defer argument checking...
608        setDefaultSeriesVisible(visible, true);
609    }
610
611    /**
612     * Sets the default series visibility and, if requested, sends
613     * a {@link RendererChangeEvent} to all registered listeners.
614     *
615     * @param visible  the visibility.
616     * @param notify  notify listeners?
617     *
618     * @see #getDefaultSeriesVisible()
619     */
620    public void setDefaultSeriesVisible(boolean visible, boolean notify) {
621        this.defaultSeriesVisible = visible;
622        if (notify) {
623            // we create an event with a special flag set...the purpose of
624            // this is to communicate to the plot (the default receiver of
625            // the event) that series visibility has changed so the axis
626            // ranges might need updating...
627            RendererChangeEvent e = new RendererChangeEvent(this, true);
628            notifyListeners(e);
629        }
630    }
631
632    // SERIES VISIBLE IN LEGEND (not yet respected by all renderers)
633
634    /**
635     * Returns {@code true} if the series should be shown in the legend,
636     * and {@code false} otherwise.
637     *
638     * @param series  the series index.
639     *
640     * @return A boolean.
641     */
642    public boolean isSeriesVisibleInLegend(int series) {
643        boolean result = this.defaultSeriesVisibleInLegend;
644        Boolean b = this.seriesVisibleInLegendList.getBoolean(series);
645        if (b != null) {
646            result = b;
647        }
648        return result;
649    }
650
651    /**
652     * Returns the flag that controls whether a series is visible in the
653     * legend.  This method returns only the "per series" settings - to
654     * incorporate the default settings as well, you need to use the
655     * {@link #isSeriesVisibleInLegend(int)} method.
656     *
657     * @param series  the series index (zero-based).
658     *
659     * @return The flag (possibly {@code null}).
660     *
661     * @see #setSeriesVisibleInLegend(int, Boolean)
662     */
663    public Boolean getSeriesVisibleInLegend(int series) {
664        return this.seriesVisibleInLegendList.getBoolean(series);
665    }
666
667    /**
668     * Sets the flag that controls whether a series is visible in the legend
669     * and sends a {@link RendererChangeEvent} to all registered listeners.
670     *
671     * @param series  the series index (zero-based).
672     * @param visible  the flag ({@code null} permitted).
673     *
674     * @see #getSeriesVisibleInLegend(int)
675     */
676    public void setSeriesVisibleInLegend(int series, Boolean visible) {
677        setSeriesVisibleInLegend(series, visible, true);
678    }
679
680    /**
681     * Sets the flag that controls whether a series is visible in the legend
682     * and, if requested, sends a {@link RendererChangeEvent} to all registered
683     * listeners.
684     *
685     * @param series  the series index.
686     * @param visible  the flag ({@code null} permitted).
687     * @param notify  notify listeners?
688     *
689     * @see #getSeriesVisibleInLegend(int)
690     */
691    public void setSeriesVisibleInLegend(int series, Boolean visible,
692                                         boolean notify) {
693        this.seriesVisibleInLegendList.setBoolean(series, visible);
694        if (notify) {
695            fireChangeEvent();
696        }
697    }
698
699    /**
700     * Returns the default visibility in the legend for all series.
701     *
702     * @return The default visibility.
703     *
704     * @see #setDefaultSeriesVisibleInLegend(boolean)
705     */
706    public boolean getDefaultSeriesVisibleInLegend() {
707        return this.defaultSeriesVisibleInLegend;
708    }
709
710    /**
711     * Sets the default visibility in the legend and sends a
712     * {@link RendererChangeEvent} to all registered listeners.
713     *
714     * @param visible  the flag.
715     *
716     * @see #getDefaultSeriesVisibleInLegend()
717     */
718    public void setDefaultSeriesVisibleInLegend(boolean visible) {
719        // defer argument checking...
720        setDefaultSeriesVisibleInLegend(visible, true);
721    }
722
723    /**
724     * Sets the default visibility in the legend and, if requested, sends
725     * a {@link RendererChangeEvent} to all registered listeners.
726     *
727     * @param visible  the visibility.
728     * @param notify  notify listeners?
729     *
730     * @see #getDefaultSeriesVisibleInLegend()
731     */
732    public void setDefaultSeriesVisibleInLegend(boolean visible, 
733            boolean notify) {
734        this.defaultSeriesVisibleInLegend = visible;
735        if (notify) {
736            fireChangeEvent();
737        }
738    }
739
740    // PAINT
741
742    /**
743     * Returns the paint used to fill data items as they are drawn.
744     * (this is typically the same for an entire series).
745     * <p>
746     * The default implementation passes control to the
747     * {@code lookupSeriesPaint()} method. You can override this method
748     * if you require different behaviour.
749     *
750     * @param row  the row (or series) index (zero-based).
751     * @param column  the column (or category) index (zero-based).
752     *
753     * @return The paint (never {@code null}).
754     */
755    public Paint getItemPaint(int row, int column) {
756        return lookupSeriesPaint(row);
757    }
758
759    /**
760     * Returns the paint used to fill an item drawn by the renderer.
761     *
762     * @param series  the series index (zero-based).
763     *
764     * @return The paint (never {@code null}).
765     *
766     * @since 1.0.6
767     */
768    public Paint lookupSeriesPaint(int series) {
769
770        Paint seriesPaint = getSeriesPaint(series);
771        if (seriesPaint == null && this.autoPopulateSeriesPaint) {
772            DrawingSupplier supplier = getDrawingSupplier();
773            if (supplier != null) {
774                seriesPaint = supplier.getNextPaint();
775                setSeriesPaint(series, seriesPaint, false);
776            }
777        }
778        if (seriesPaint == null) {
779            seriesPaint = this.defaultPaint;
780        }
781        return seriesPaint;
782
783    }
784
785    /**
786     * Returns the paint used to fill an item drawn by the renderer.
787     *
788     * @param series  the series index (zero-based).
789     *
790     * @return The paint (possibly {@code null}).
791     *
792     * @see #setSeriesPaint(int, Paint)
793     */
794    public Paint getSeriesPaint(int series) {
795        return this.paintList.getPaint(series);
796    }
797
798    /**
799     * Sets the paint used for a series and sends a {@link RendererChangeEvent}
800     * to all registered listeners.
801     *
802     * @param series  the series index (zero-based).
803     * @param paint  the paint ({@code null} permitted).
804     *
805     * @see #getSeriesPaint(int)
806     */
807    public void setSeriesPaint(int series, Paint paint) {
808        setSeriesPaint(series, paint, true);
809    }
810
811    /**
812     * Sets the paint used for a series and, if requested, sends a
813     * {@link RendererChangeEvent} to all registered listeners.
814     *
815     * @param series  the series index.
816     * @param paint  the paint ({@code null} permitted).
817     * @param notify  notify listeners?
818     *
819     * @see #getSeriesPaint(int)
820     */
821    public void setSeriesPaint(int series, Paint paint, boolean notify) {
822        this.paintList.setPaint(series, paint);
823        if (notify) {
824            fireChangeEvent();
825        }
826    }
827
828    /**
829     * Clears the series paint settings for this renderer and, if requested,
830     * sends a {@link RendererChangeEvent} to all registered listeners.
831     *
832     * @param notify  notify listeners?
833     *
834     * @since 1.0.11
835     */
836    public void clearSeriesPaints(boolean notify) {
837        this.paintList.clear();
838        if (notify) {
839            fireChangeEvent();
840        }
841    }
842
843    /**
844     * Returns the default paint.
845     *
846     * @return The default paint (never {@code null}).
847     *
848     * @see #setDefaultPaint(Paint)
849     */
850    public Paint getDefaultPaint() {
851        return this.defaultPaint;
852    }
853
854    /**
855     * Sets the default paint and sends a {@link RendererChangeEvent} to all
856     * registered listeners.
857     *
858     * @param paint  the paint ({@code null} not permitted).
859     *
860     * @see #getDefaultPaint()
861     */
862    public void setDefaultPaint(Paint paint) {
863        // defer argument checking...
864        setDefaultPaint(paint, true);
865    }
866
867    /**
868     * Sets the default paint and, if requested, sends a
869     * {@link RendererChangeEvent} to all registered listeners.
870     *
871     * @param paint  the paint ({@code null} not permitted).
872     * @param notify  notify listeners?
873     *
874     * @see #getDefaultPaint()
875     */
876    public void setDefaultPaint(Paint paint, boolean notify) {
877        this.defaultPaint = paint;
878        if (notify) {
879            fireChangeEvent();
880        }
881    }
882
883    /**
884     * Returns the flag that controls whether or not the series paint list is
885     * automatically populated when {@link #lookupSeriesPaint(int)} is called.
886     *
887     * @return A boolean.
888     *
889     * @since 1.0.6
890     *
891     * @see #setAutoPopulateSeriesPaint(boolean)
892     */
893    public boolean getAutoPopulateSeriesPaint() {
894        return this.autoPopulateSeriesPaint;
895    }
896
897    /**
898     * Sets the flag that controls whether or not the series paint list is
899     * automatically populated when {@link #lookupSeriesPaint(int)} is called.
900     *
901     * @param auto  the new flag value.
902     *
903     * @since 1.0.6
904     *
905     * @see #getAutoPopulateSeriesPaint()
906     */
907    public void setAutoPopulateSeriesPaint(boolean auto) {
908        this.autoPopulateSeriesPaint = auto;
909    }
910
911    //// FILL PAINT //////////////////////////////////////////////////////////
912
913    /**
914     * Returns the paint used to fill data items as they are drawn.  The
915     * default implementation passes control to the
916     * {@link #lookupSeriesFillPaint(int)} method - you can override this
917     * method if you require different behaviour.
918     *
919     * @param row  the row (or series) index (zero-based).
920     * @param column  the column (or category) index (zero-based).
921     *
922     * @return The paint (never {@code null}).
923     */
924    public Paint getItemFillPaint(int row, int column) {
925        return lookupSeriesFillPaint(row);
926    }
927
928    /**
929     * Returns the paint used to fill an item drawn by the renderer.
930     *
931     * @param series  the series (zero-based index).
932     *
933     * @return The paint (never {@code null}).
934     *
935     * @since 1.0.6
936     */
937    public Paint lookupSeriesFillPaint(int series) {
938
939        Paint seriesFillPaint = getSeriesFillPaint(series);
940        if (seriesFillPaint == null && this.autoPopulateSeriesFillPaint) {
941            DrawingSupplier supplier = getDrawingSupplier();
942            if (supplier != null) {
943                seriesFillPaint = supplier.getNextFillPaint();
944                setSeriesFillPaint(series, seriesFillPaint, false);
945            }
946        }
947        if (seriesFillPaint == null) {
948            seriesFillPaint = this.defaultFillPaint;
949        }
950        return seriesFillPaint;
951
952    }
953
954    /**
955     * Returns the paint used to fill an item drawn by the renderer.
956     *
957     * @param series  the series (zero-based index).
958     *
959     * @return The paint (never {@code null}).
960     *
961     * @see #setSeriesFillPaint(int, Paint)
962     */
963    public Paint getSeriesFillPaint(int series) {
964        return this.fillPaintList.getPaint(series);
965    }
966
967    /**
968     * Sets the paint used for a series fill and sends a
969     * {@link RendererChangeEvent} to all registered listeners.
970     *
971     * @param series  the series index (zero-based).
972     * @param paint  the paint ({@code null} permitted).
973     *
974     * @see #getSeriesFillPaint(int)
975     */
976    public void setSeriesFillPaint(int series, Paint paint) {
977        setSeriesFillPaint(series, paint, true);
978    }
979
980    /**
981     * Sets the paint used to fill a series and, if requested,
982     * sends a {@link RendererChangeEvent} to all registered listeners.
983     *
984     * @param series  the series index (zero-based).
985     * @param paint  the paint ({@code null} permitted).
986     * @param notify  notify listeners?
987     *
988     * @see #getSeriesFillPaint(int)
989     */
990    public void setSeriesFillPaint(int series, Paint paint, boolean notify) {
991        this.fillPaintList.setPaint(series, paint);
992        if (notify) {
993            fireChangeEvent();
994        }
995    }
996
997    /**
998     * Returns the default fill paint.
999     *
1000     * @return The paint (never {@code null}).
1001     *
1002     * @see #setDefaultFillPaint(Paint)
1003     */
1004    public Paint getDefaultFillPaint() {
1005        return this.defaultFillPaint;
1006    }
1007
1008    /**
1009     * Sets the default fill paint and sends a {@link RendererChangeEvent} to
1010     * all registered listeners.
1011     *
1012     * @param paint  the paint ({@code null} not permitted).
1013     *
1014     * @see #getDefaultFillPaint()
1015     */
1016    public void setDefaultFillPaint(Paint paint) {
1017        // defer argument checking...
1018        setDefaultFillPaint(paint, true);
1019    }
1020
1021    /**
1022     * Sets the default fill paint and, if requested, sends a
1023     * {@link RendererChangeEvent} to all registered listeners.
1024     *
1025     * @param paint  the paint ({@code null} not permitted).
1026     * @param notify  notify listeners?
1027     *
1028     * @see #getDefaultFillPaint()
1029     */
1030    public void setDefaultFillPaint(Paint paint, boolean notify) {
1031        Args.nullNotPermitted(paint, "paint");
1032        this.defaultFillPaint = paint;
1033        if (notify) {
1034            fireChangeEvent();
1035        }
1036    }
1037
1038    /**
1039     * Returns the flag that controls whether or not the series fill paint list
1040     * is automatically populated when {@link #lookupSeriesFillPaint(int)} is
1041     * called.
1042     *
1043     * @return A boolean.
1044     *
1045     * @since 1.0.6
1046     *
1047     * @see #setAutoPopulateSeriesFillPaint(boolean)
1048     */
1049    public boolean getAutoPopulateSeriesFillPaint() {
1050        return this.autoPopulateSeriesFillPaint;
1051    }
1052
1053    /**
1054     * Sets the flag that controls whether or not the series fill paint list is
1055     * automatically populated when {@link #lookupSeriesFillPaint(int)} is
1056     * called.
1057     *
1058     * @param auto  the new flag value.
1059     *
1060     * @since 1.0.6
1061     *
1062     * @see #getAutoPopulateSeriesFillPaint()
1063     */
1064    public void setAutoPopulateSeriesFillPaint(boolean auto) {
1065        this.autoPopulateSeriesFillPaint = auto;
1066    }
1067
1068    // OUTLINE PAINT //////////////////////////////////////////////////////////
1069
1070    /**
1071     * Returns the paint used to outline data items as they are drawn.
1072     * (this is typically the same for an entire series).
1073     * <p>
1074     * The default implementation passes control to the
1075     * {@link #lookupSeriesOutlinePaint} method.  You can override this method
1076     * if you require different behaviour.
1077     *
1078     * @param row  the row (or series) index (zero-based).
1079     * @param column  the column (or category) index (zero-based).
1080     *
1081     * @return The paint (never {@code null}).
1082     */
1083    public Paint getItemOutlinePaint(int row, int column) {
1084        return lookupSeriesOutlinePaint(row);
1085    }
1086
1087    /**
1088     * Returns the paint used to outline an item drawn by the renderer.
1089     *
1090     * @param series  the series (zero-based index).
1091     *
1092     * @return The paint (never {@code null}).
1093     *
1094     * @since 1.0.6
1095     */
1096    public Paint lookupSeriesOutlinePaint(int series) {
1097
1098        Paint seriesOutlinePaint = getSeriesOutlinePaint(series);
1099        if (seriesOutlinePaint == null && this.autoPopulateSeriesOutlinePaint) {
1100            DrawingSupplier supplier = getDrawingSupplier();
1101            if (supplier != null) {
1102                seriesOutlinePaint = supplier.getNextOutlinePaint();
1103                setSeriesOutlinePaint(series, seriesOutlinePaint, false);
1104            }
1105        }
1106        if (seriesOutlinePaint == null) {
1107            seriesOutlinePaint = this.defaultOutlinePaint;
1108        }
1109        return seriesOutlinePaint;
1110
1111    }
1112
1113    /**
1114     * Returns the paint used to outline an item drawn by the renderer.
1115     *
1116     * @param series  the series (zero-based index).
1117     *
1118     * @return The paint (possibly {@code null}).
1119     *
1120     * @see #setSeriesOutlinePaint(int, Paint)
1121     */
1122    public Paint getSeriesOutlinePaint(int series) {
1123        return this.outlinePaintList.getPaint(series);
1124    }
1125
1126    /**
1127     * Sets the paint used for a series outline and sends a
1128     * {@link RendererChangeEvent} to all registered listeners.
1129     *
1130     * @param series  the series index (zero-based).
1131     * @param paint  the paint ({@code null} permitted).
1132     *
1133     * @see #getSeriesOutlinePaint(int)
1134     */
1135    public void setSeriesOutlinePaint(int series, Paint paint) {
1136        setSeriesOutlinePaint(series, paint, true);
1137    }
1138
1139    /**
1140     * Sets the paint used to draw the outline for a series and, if requested,
1141     * sends a {@link RendererChangeEvent} to all registered listeners.
1142     *
1143     * @param series  the series index (zero-based).
1144     * @param paint  the paint ({@code null} permitted).
1145     * @param notify  notify listeners?
1146     *
1147     * @see #getSeriesOutlinePaint(int)
1148     */
1149    public void setSeriesOutlinePaint(int series, Paint paint, boolean notify) {
1150        this.outlinePaintList.setPaint(series, paint);
1151        if (notify) {
1152            fireChangeEvent();
1153        }
1154    }
1155
1156    /**
1157     * Returns the default outline paint.
1158     *
1159     * @return The paint (never {@code null}).
1160     *
1161     * @see #setDefaultOutlinePaint(Paint)
1162     */
1163    public Paint getDefaultOutlinePaint() {
1164        return this.defaultOutlinePaint;
1165    }
1166
1167    /**
1168     * Sets the default outline paint and sends a {@link RendererChangeEvent} to
1169     * all registered listeners.
1170     *
1171     * @param paint  the paint ({@code null} not permitted).
1172     *
1173     * @see #getDefaultOutlinePaint()
1174     */
1175    public void setDefaultOutlinePaint(Paint paint) {
1176        // defer argument checking...
1177        setDefaultOutlinePaint(paint, true);
1178    }
1179
1180    /**
1181     * Sets the default outline paint and, if requested, sends a
1182     * {@link RendererChangeEvent} to all registered listeners.
1183     *
1184     * @param paint  the paint ({@code null} not permitted).
1185     * @param notify  notify listeners?
1186     *
1187     * @see #getDefaultOutlinePaint()
1188     */
1189    public void setDefaultOutlinePaint(Paint paint, boolean notify) {
1190        Args.nullNotPermitted(paint, "paint");
1191        this.defaultOutlinePaint = paint;
1192        if (notify) {
1193            fireChangeEvent();
1194        }
1195    }
1196
1197    /**
1198     * Returns the flag that controls whether or not the series outline paint
1199     * list is automatically populated when
1200     * {@link #lookupSeriesOutlinePaint(int)} is called.
1201     *
1202     * @return A boolean.
1203     *
1204     * @since 1.0.6
1205     *
1206     * @see #setAutoPopulateSeriesOutlinePaint(boolean)
1207     */
1208    public boolean getAutoPopulateSeriesOutlinePaint() {
1209        return this.autoPopulateSeriesOutlinePaint;
1210    }
1211
1212    /**
1213     * Sets the flag that controls whether or not the series outline paint list
1214     * is automatically populated when {@link #lookupSeriesOutlinePaint(int)}
1215     * is called.
1216     *
1217     * @param auto  the new flag value.
1218     *
1219     * @since 1.0.6
1220     *
1221     * @see #getAutoPopulateSeriesOutlinePaint()
1222     */
1223    public void setAutoPopulateSeriesOutlinePaint(boolean auto) {
1224        this.autoPopulateSeriesOutlinePaint = auto;
1225    }
1226
1227    // STROKE
1228
1229    /**
1230     * Returns the stroke used to draw data items.
1231     * <p>
1232     * The default implementation passes control to the getSeriesStroke method.
1233     * You can override this method if you require different behaviour.
1234     *
1235     * @param row  the row (or series) index (zero-based).
1236     * @param column  the column (or category) index (zero-based).
1237     *
1238     * @return The stroke (never {@code null}).
1239     */
1240    public Stroke getItemStroke(int row, int column) {
1241        return lookupSeriesStroke(row);
1242    }
1243
1244    /**
1245     * Returns the stroke used to draw the items in a series.
1246     *
1247     * @param series  the series (zero-based index).
1248     *
1249     * @return The stroke (never {@code null}).
1250     *
1251     * @since 1.0.6
1252     */
1253    public Stroke lookupSeriesStroke(int series) {
1254
1255        Stroke result = getSeriesStroke(series);
1256        if (result == null && this.autoPopulateSeriesStroke) {
1257            DrawingSupplier supplier = getDrawingSupplier();
1258            if (supplier != null) {
1259                result = supplier.getNextStroke();
1260                setSeriesStroke(series, result, false);
1261            }
1262        }
1263        if (result == null) {
1264            result = this.defaultStroke;
1265        }
1266        return result;
1267
1268    }
1269
1270    /**
1271     * Returns the stroke used to draw the items in a series.
1272     *
1273     * @param series  the series (zero-based index).
1274     *
1275     * @return The stroke (possibly {@code null}).
1276     *
1277     * @see #setSeriesStroke(int, Stroke)
1278     */
1279    public Stroke getSeriesStroke(int series) {
1280        return this.strokeList.getStroke(series);
1281    }
1282
1283    /**
1284     * Sets the stroke used for a series and sends a {@link RendererChangeEvent}
1285     * to all registered listeners.
1286     *
1287     * @param series  the series index (zero-based).
1288     * @param stroke  the stroke ({@code null} permitted).
1289     *
1290     * @see #getSeriesStroke(int)
1291     */
1292    public void setSeriesStroke(int series, Stroke stroke) {
1293        setSeriesStroke(series, stroke, true);
1294    }
1295
1296    /**
1297     * Sets the stroke for a series and, if requested, sends a
1298     * {@link RendererChangeEvent} to all registered listeners.
1299     *
1300     * @param series  the series index (zero-based).
1301     * @param stroke  the stroke ({@code null} permitted).
1302     * @param notify  notify listeners?
1303     *
1304     * @see #getSeriesStroke(int)
1305     */
1306    public void setSeriesStroke(int series, Stroke stroke, boolean notify) {
1307        this.strokeList.setStroke(series, stroke);
1308        if (notify) {
1309            fireChangeEvent();
1310        }
1311    }
1312
1313    /**
1314     * Clears the series stroke settings for this renderer and, if requested,
1315     * sends a {@link RendererChangeEvent} to all registered listeners.
1316     *
1317     * @param notify  notify listeners?
1318     *
1319     * @since 1.0.11
1320     */
1321    public void clearSeriesStrokes(boolean notify) {
1322        this.strokeList.clear();
1323        if (notify) {
1324            fireChangeEvent();
1325        }
1326    }
1327
1328    /**
1329     * Returns the default stroke.
1330     *
1331     * @return The default stroke (never {@code null}).
1332     *
1333     * @see #setDefaultStroke(Stroke)
1334     */
1335    public Stroke getDefaultStroke() {
1336        return this.defaultStroke;
1337    }
1338
1339    /**
1340     * Sets the default stroke and sends a {@link RendererChangeEvent} to all
1341     * registered listeners.
1342     *
1343     * @param stroke  the stroke ({@code null} not permitted).
1344     *
1345     * @see #getDefaultStroke()
1346     */
1347    public void setDefaultStroke(Stroke stroke) {
1348        // defer argument checking...
1349        setDefaultStroke(stroke, true);
1350    }
1351
1352    /**
1353     * Sets the base stroke and, if requested, sends a
1354     * {@link RendererChangeEvent} to all registered listeners.
1355     *
1356     * @param stroke  the stroke ({@code null} not permitted).
1357     * @param notify  notify listeners?
1358     *
1359     * @see #getDefaultStroke()
1360     */
1361    public void setDefaultStroke(Stroke stroke, boolean notify) {
1362        Args.nullNotPermitted(stroke, "stroke");
1363        this.defaultStroke = stroke;
1364        if (notify) {
1365            fireChangeEvent();
1366        }
1367    }
1368
1369    /**
1370     * Returns the flag that controls whether or not the series stroke list is
1371     * automatically populated when {@link #lookupSeriesStroke(int)} is called.
1372     *
1373     * @return A boolean.
1374     *
1375     * @since 1.0.6
1376     *
1377     * @see #setAutoPopulateSeriesStroke(boolean)
1378     */
1379    public boolean getAutoPopulateSeriesStroke() {
1380        return this.autoPopulateSeriesStroke;
1381    }
1382
1383    /**
1384     * Sets the flag that controls whether or not the series stroke list is
1385     * automatically populated when {@link #lookupSeriesStroke(int)} is called.
1386     *
1387     * @param auto  the new flag value.
1388     *
1389     * @since 1.0.6
1390     *
1391     * @see #getAutoPopulateSeriesStroke()
1392     */
1393    public void setAutoPopulateSeriesStroke(boolean auto) {
1394        this.autoPopulateSeriesStroke = auto;
1395    }
1396
1397    // OUTLINE STROKE
1398
1399    /**
1400     * Returns the stroke used to outline data items.  The default
1401     * implementation passes control to the
1402     * {@link #lookupSeriesOutlineStroke(int)} method. You can override this
1403     * method if you require different behaviour.
1404     *
1405     * @param row  the row (or series) index (zero-based).
1406     * @param column  the column (or category) index (zero-based).
1407     *
1408     * @return The stroke (never {@code null}).
1409     */
1410    public Stroke getItemOutlineStroke(int row, int column) {
1411        return lookupSeriesOutlineStroke(row);
1412    }
1413
1414    /**
1415     * Returns the stroke used to outline the items in a series.
1416     *
1417     * @param series  the series (zero-based index).
1418     *
1419     * @return The stroke (never {@code null}).
1420     *
1421     * @since 1.0.6
1422     */
1423    public Stroke lookupSeriesOutlineStroke(int series) {
1424
1425        Stroke result = getSeriesOutlineStroke(series);
1426        if (result == null && this.autoPopulateSeriesOutlineStroke) {
1427            DrawingSupplier supplier = getDrawingSupplier();
1428            if (supplier != null) {
1429                result = supplier.getNextOutlineStroke();
1430                setSeriesOutlineStroke(series, result, false);
1431            }
1432        }
1433        if (result == null) {
1434            result = this.defaultOutlineStroke;
1435        }
1436        return result;
1437
1438    }
1439
1440    /**
1441     * Returns the stroke used to outline the items in a series.
1442     *
1443     * @param series  the series (zero-based index).
1444     *
1445     * @return The stroke (possibly {@code null}).
1446     *
1447     * @see #setSeriesOutlineStroke(int, Stroke)
1448     */
1449    public Stroke getSeriesOutlineStroke(int series) {
1450        return this.outlineStrokeList.getStroke(series);
1451    }
1452
1453    /**
1454     * Sets the outline stroke used for a series and sends a
1455     * {@link RendererChangeEvent} to all registered listeners.
1456     *
1457     * @param series  the series index (zero-based).
1458     * @param stroke  the stroke ({@code null} permitted).
1459     *
1460     * @see #getSeriesOutlineStroke(int)
1461     */
1462    public void setSeriesOutlineStroke(int series, Stroke stroke) {
1463        setSeriesOutlineStroke(series, stroke, true);
1464    }
1465
1466    /**
1467     * Sets the outline stroke for a series and, if requested, sends a
1468     * {@link RendererChangeEvent} to all registered listeners.
1469     *
1470     * @param series  the series index.
1471     * @param stroke  the stroke ({@code null} permitted).
1472     * @param notify  notify listeners?
1473     *
1474     * @see #getSeriesOutlineStroke(int)
1475     */
1476    public void setSeriesOutlineStroke(int series, Stroke stroke,
1477                                       boolean notify) {
1478        this.outlineStrokeList.setStroke(series, stroke);
1479        if (notify) {
1480            fireChangeEvent();
1481        }
1482    }
1483
1484    /**
1485     * Returns the default outline stroke.
1486     *
1487     * @return The stroke (never {@code null}).
1488     *
1489     * @see #setDefaultOutlineStroke(Stroke)
1490     */
1491    public Stroke getDefaultOutlineStroke() {
1492        return this.defaultOutlineStroke;
1493    }
1494
1495    /**
1496     * Sets the default outline stroke and sends a {@link RendererChangeEvent} 
1497     * to all registered listeners.
1498     *
1499     * @param stroke  the stroke ({@code null} not permitted).
1500     *
1501     * @see #getDefaultOutlineStroke()
1502     */
1503    public void setDefaultOutlineStroke(Stroke stroke) {
1504        setDefaultOutlineStroke(stroke, true);
1505    }
1506
1507    /**
1508     * Sets the default outline stroke and, if requested, sends a
1509     * {@link RendererChangeEvent} to all registered listeners.
1510     *
1511     * @param stroke  the stroke ({@code null} not permitted).
1512     * @param notify  a flag that controls whether or not listeners are
1513     *                notified.
1514     *
1515     * @see #getDefaultOutlineStroke()
1516     */
1517    public void setDefaultOutlineStroke(Stroke stroke, boolean notify) {
1518        Args.nullNotPermitted(stroke, "stroke");
1519        this.defaultOutlineStroke = stroke;
1520        if (notify) {
1521            fireChangeEvent();
1522        }
1523    }
1524
1525    /**
1526     * Returns the flag that controls whether or not the series outline stroke
1527     * list is automatically populated when
1528     * {@link #lookupSeriesOutlineStroke(int)} is called.
1529     *
1530     * @return A boolean.
1531     *
1532     * @since 1.0.6
1533     *
1534     * @see #setAutoPopulateSeriesOutlineStroke(boolean)
1535     */
1536    public boolean getAutoPopulateSeriesOutlineStroke() {
1537        return this.autoPopulateSeriesOutlineStroke;
1538    }
1539
1540    /**
1541     * Sets the flag that controls whether or not the series outline stroke list
1542     * is automatically populated when {@link #lookupSeriesOutlineStroke(int)}
1543     * is called.
1544     *
1545     * @param auto  the new flag value.
1546     *
1547     * @since 1.0.6
1548     *
1549     * @see #getAutoPopulateSeriesOutlineStroke()
1550     */
1551    public void setAutoPopulateSeriesOutlineStroke(boolean auto) {
1552        this.autoPopulateSeriesOutlineStroke = auto;
1553    }
1554
1555    // SHAPE
1556
1557    /**
1558     * Returns a shape used to represent a data item.
1559     * <p>
1560     * The default implementation passes control to the 
1561     * {@link #lookupSeriesShape(int)} method. You can override this method if 
1562     * you require different behaviour.
1563     *
1564     * @param row  the row (or series) index (zero-based).
1565     * @param column  the column (or category) index (zero-based).
1566     *
1567     * @return The shape (never {@code null}).
1568     */
1569    public Shape getItemShape(int row, int column) {
1570        return lookupSeriesShape(row);
1571    }
1572
1573    /**
1574     * Returns a shape used to represent the items in a series.
1575     *
1576     * @param series  the series (zero-based index).
1577     *
1578     * @return The shape (never {@code null}).
1579     *
1580     * @since 1.0.6
1581     */
1582    public Shape lookupSeriesShape(int series) {
1583
1584        Shape result = getSeriesShape(series);
1585        if (result == null && this.autoPopulateSeriesShape) {
1586            DrawingSupplier supplier = getDrawingSupplier();
1587            if (supplier != null) {
1588                result = supplier.getNextShape();
1589                setSeriesShape(series, result, false);
1590            }
1591        }
1592        if (result == null) {
1593            result = this.defaultShape;
1594        }
1595        return result;
1596
1597    }
1598
1599    /**
1600     * Returns a shape used to represent the items in a series.
1601     *
1602     * @param series  the series (zero-based index).
1603     *
1604     * @return The shape (possibly {@code null}).
1605     *
1606     * @see #setSeriesShape(int, Shape)
1607     */
1608    public Shape getSeriesShape(int series) {
1609        return this.shapeList.getShape(series);
1610    }
1611
1612    /**
1613     * Sets the shape used for a series and sends a {@link RendererChangeEvent}
1614     * to all registered listeners.
1615     *
1616     * @param series  the series index (zero-based).
1617     * @param shape  the shape ({@code null} permitted).
1618     *
1619     * @see #getSeriesShape(int)
1620     */
1621    public void setSeriesShape(int series, Shape shape) {
1622        setSeriesShape(series, shape, true);
1623    }
1624
1625    /**
1626     * Sets the shape for a series and, if requested, sends a
1627     * {@link RendererChangeEvent} to all registered listeners.
1628     *
1629     * @param series  the series index (zero based).
1630     * @param shape  the shape ({@code null} permitted).
1631     * @param notify  notify listeners?
1632     *
1633     * @see #getSeriesShape(int)
1634     */
1635    public void setSeriesShape(int series, Shape shape, boolean notify) {
1636        this.shapeList.setShape(series, shape);
1637        if (notify) {
1638            fireChangeEvent();
1639        }
1640    }
1641
1642    /**
1643     * Returns the default shape.
1644     *
1645     * @return The shape (never {@code null}).
1646     *
1647     * @see #setDefaultShape(Shape)
1648     */
1649    public Shape getDefaultShape() {
1650        return this.defaultShape;
1651    }
1652
1653    /**
1654     * Sets the default shape and sends a {@link RendererChangeEvent} to all
1655     * registered listeners.
1656     *
1657     * @param shape  the shape ({@code null} not permitted).
1658     *
1659     * @see #getDefaultShape()
1660     */
1661    public void setDefaultShape(Shape shape) {
1662        // defer argument checking...
1663        setDefaultShape(shape, true);
1664    }
1665
1666    /**
1667     * Sets the default shape and, if requested, sends a
1668     * {@link RendererChangeEvent} to all registered listeners.
1669     *
1670     * @param shape  the shape ({@code null} not permitted).
1671     * @param notify  notify listeners?
1672     *
1673     * @see #getDefaultShape()
1674     */
1675    public void setDefaultShape(Shape shape, boolean notify) {
1676        Args.nullNotPermitted(shape, "shape");
1677        this.defaultShape = shape;
1678        if (notify) {
1679            fireChangeEvent();
1680        }
1681    }
1682
1683    /**
1684     * Returns the flag that controls whether or not the series shape list is
1685     * automatically populated when {@link #lookupSeriesShape(int)} is called.
1686     *
1687     * @return A boolean.
1688     *
1689     * @since 1.0.6
1690     *
1691     * @see #setAutoPopulateSeriesShape(boolean)
1692     */
1693    public boolean getAutoPopulateSeriesShape() {
1694        return this.autoPopulateSeriesShape;
1695    }
1696
1697    /**
1698     * Sets the flag that controls whether or not the series shape list is
1699     * automatically populated when {@link #lookupSeriesShape(int)} is called.
1700     *
1701     * @param auto  the new flag value.
1702     *
1703     * @since 1.0.6
1704     *
1705     * @see #getAutoPopulateSeriesShape()
1706     */
1707    public void setAutoPopulateSeriesShape(boolean auto) {
1708        this.autoPopulateSeriesShape = auto;
1709    }
1710
1711    // ITEM LABEL VISIBILITY...
1712
1713    /**
1714     * Returns {@code true} if an item label is visible, and
1715     * {@code false} otherwise.
1716     *
1717     * @param row  the row (or series) index (zero-based).
1718     * @param column  the column (or category) index (zero-based).
1719     *
1720     * @return A boolean.
1721     */
1722    public boolean isItemLabelVisible(int row, int column) {
1723        return isSeriesItemLabelsVisible(row);
1724    }
1725
1726    /**
1727     * Returns {@code true} if the item labels for a series are visible,
1728     * and {@code false} otherwise.
1729     *
1730     * @param series  the series index (zero-based).
1731     *
1732     * @return A boolean.
1733     */
1734    public boolean isSeriesItemLabelsVisible(int series) {
1735        Boolean b = this.itemLabelsVisibleList.getBoolean(series);
1736        if (b == null) {
1737            return this.defaultItemLabelsVisible;
1738        }
1739        return b;
1740    }
1741
1742    /**
1743     * Sets a flag that controls the visibility of the item labels for a series,
1744     * and sends a {@link RendererChangeEvent} to all registered listeners.
1745     *
1746     * @param series  the series index (zero-based).
1747     * @param visible  the flag.
1748     */
1749    public void setSeriesItemLabelsVisible(int series, boolean visible) {
1750        setSeriesItemLabelsVisible(series, Boolean.valueOf(visible));
1751    }
1752
1753    /**
1754     * Sets the visibility of the item labels for a series and sends a
1755     * {@link RendererChangeEvent} to all registered listeners.
1756     *
1757     * @param series  the series index (zero-based).
1758     * @param visible  the flag ({@code null} permitted).
1759     */
1760    public void setSeriesItemLabelsVisible(int series, Boolean visible) {
1761        setSeriesItemLabelsVisible(series, visible, true);
1762    }
1763
1764    /**
1765     * Sets the visibility of item labels for a series and, if requested, sends
1766     * a {@link RendererChangeEvent} to all registered listeners.
1767     *
1768     * @param series  the series index (zero-based).
1769     * @param visible  the visible flag.
1770     * @param notify  a flag that controls whether or not listeners are
1771     *                notified.
1772     */
1773    public void setSeriesItemLabelsVisible(int series, Boolean visible,
1774                                           boolean notify) {
1775        this.itemLabelsVisibleList.setBoolean(series, visible);
1776        if (notify) {
1777            fireChangeEvent();
1778        }
1779    }
1780
1781    /**
1782     * Returns the base setting for item label visibility.  A {@code null}
1783     * result should be interpreted as equivalent to {@code Boolean.FALSE}.
1784     *
1785     * @return A flag (possibly {@code null}).
1786     *
1787     * @see #setDefaultItemLabelsVisible(boolean)
1788     */
1789    public boolean getDefaultItemLabelsVisible() {
1790        return this.defaultItemLabelsVisible;
1791    }
1792
1793    /**
1794     * Sets the base flag that controls whether or not item labels are visible,
1795     * and sends a {@link RendererChangeEvent} to all registered listeners.
1796     *
1797     * @param visible  the flag.
1798     *
1799     * @see #getDefaultItemLabelsVisible()
1800     */
1801    public void setDefaultItemLabelsVisible(boolean visible) {
1802        setDefaultItemLabelsVisible(visible, true);
1803    }
1804
1805    /**
1806     * Sets the base visibility for item labels and, if requested, sends a
1807     * {@link RendererChangeEvent} to all registered listeners.
1808     *
1809     * @param visible  the flag ({@code null} is permitted, and viewed
1810     *     as equivalent to {@code Boolean.FALSE}).
1811     * @param notify  a flag that controls whether or not listeners are
1812     *                notified.
1813     *
1814     * @see #getDefaultItemLabelsVisible() 
1815     */
1816    public void setDefaultItemLabelsVisible(boolean visible, boolean notify) {
1817        this.defaultItemLabelsVisible = visible;
1818        if (notify) {
1819            fireChangeEvent();
1820        }
1821    }
1822
1823    //// ITEM LABEL FONT //////////////////////////////////////////////////////
1824
1825    /**
1826     * Returns the font for an item label.
1827     *
1828     * @param row  the row (or series) index (zero-based).
1829     * @param column  the column (or category) index (zero-based).
1830     *
1831     * @return The font (never {@code null}).
1832     */
1833    public Font getItemLabelFont(int row, int column) {
1834        Font result = getSeriesItemLabelFont(row);
1835        if (result == null) {
1836            result = this.defaultItemLabelFont;
1837        }
1838        return result;
1839    }
1840
1841    /**
1842     * Returns the font for all the item labels in a series.
1843     *
1844     * @param series  the series index (zero-based).
1845     *
1846     * @return The font (possibly {@code null}).
1847     *
1848     * @see #setSeriesItemLabelFont(int, Font)
1849     */
1850    public Font getSeriesItemLabelFont(int series) {
1851        return this.itemLabelFontMap.get(series);
1852    }
1853
1854    /**
1855     * Sets the item label font for a series and sends a
1856     * {@link RendererChangeEvent} to all registered listeners.
1857     *
1858     * @param series  the series index (zero-based).
1859     * @param font  the font ({@code null} permitted).
1860     *
1861     * @see #getSeriesItemLabelFont(int)
1862     */
1863    public void setSeriesItemLabelFont(int series, Font font) {
1864        setSeriesItemLabelFont(series, font, true);
1865    }
1866
1867    /**
1868     * Sets the item label font for a series and, if requested, sends a
1869     * {@link RendererChangeEvent} to all registered listeners.
1870     *
1871     * @param series  the series index (zero based).
1872     * @param font  the font ({@code null} permitted).
1873     * @param notify  a flag that controls whether or not listeners are
1874     *                notified.
1875     *
1876     * @see #getSeriesItemLabelFont(int)
1877     */
1878    public void setSeriesItemLabelFont(int series, Font font, boolean notify) {
1879        this.itemLabelFontMap.put(series, font);
1880        if (notify) {
1881            fireChangeEvent();
1882        }
1883    }
1884
1885    /**
1886     * Returns the default item label font (this is used when no other font
1887     * setting is available).
1888     *
1889     * @return The font (never {@code null}).
1890     *
1891     * @see #setDefaultItemLabelFont(Font)
1892     */
1893    public Font getDefaultItemLabelFont() {
1894        return this.defaultItemLabelFont;
1895    }
1896
1897    /**
1898     * Sets the default item label font and sends a {@link RendererChangeEvent} 
1899     * to all registered listeners.
1900     *
1901     * @param font  the font ({@code null} not permitted).
1902     *
1903     * @see #getDefaultItemLabelFont()
1904     */
1905    public void setDefaultItemLabelFont(Font font) {
1906        Args.nullNotPermitted(font, "font");
1907        setDefaultItemLabelFont(font, true);
1908    }
1909
1910    /**
1911     * Sets the base item label font and, if requested, sends a
1912     * {@link RendererChangeEvent} to all registered listeners.
1913     *
1914     * @param font  the font ({@code null} not permitted).
1915     * @param notify  a flag that controls whether or not listeners are
1916     *                notified.
1917     *
1918     * @see #getDefaultItemLabelFont()
1919     */
1920    public void setDefaultItemLabelFont(Font font, boolean notify) {
1921        this.defaultItemLabelFont = font;
1922        if (notify) {
1923            fireChangeEvent();
1924        }
1925    }
1926
1927    //// ITEM LABEL PAINT  ////////////////////////////////////////////////////
1928
1929    /**
1930     * Returns the paint used to draw an item label.
1931     *
1932     * @param row  the row index (zero based).
1933     * @param column  the column index (zero based).
1934     *
1935     * @return The paint (never {@code null}).
1936     */
1937    public Paint getItemLabelPaint(int row, int column) {
1938        Paint result = getSeriesItemLabelPaint(row);
1939        if (result == null) {
1940            result = this.defaultItemLabelPaint;
1941        }
1942        return result;
1943    }
1944
1945    /**
1946     * Returns the paint used to draw the item labels for a series.
1947     *
1948     * @param series  the series index (zero based).
1949     *
1950     * @return The paint (possibly {@code null}).
1951     *
1952     * @see #setSeriesItemLabelPaint(int, Paint)
1953     */
1954    public Paint getSeriesItemLabelPaint(int series) {
1955        return this.itemLabelPaintList.getPaint(series);
1956    }
1957
1958    /**
1959     * Sets the item label paint for a series and sends a
1960     * {@link RendererChangeEvent} to all registered listeners.
1961     *
1962     * @param series  the series (zero based index).
1963     * @param paint  the paint ({@code null} permitted).
1964     *
1965     * @see #getSeriesItemLabelPaint(int)
1966     */
1967    public void setSeriesItemLabelPaint(int series, Paint paint) {
1968        setSeriesItemLabelPaint(series, paint, true);
1969    }
1970
1971    /**
1972     * Sets the item label paint for a series and, if requested, sends a
1973     * {@link RendererChangeEvent} to all registered listeners.
1974     *
1975     * @param series  the series index (zero based).
1976     * @param paint  the paint ({@code null} permitted).
1977     * @param notify  a flag that controls whether or not listeners are
1978     *                notified.
1979     *
1980     * @see #getSeriesItemLabelPaint(int)
1981     */
1982    public void setSeriesItemLabelPaint(int series, Paint paint,
1983                                        boolean notify) {
1984        this.itemLabelPaintList.setPaint(series, paint);
1985        if (notify) {
1986            fireChangeEvent();
1987        }
1988    }
1989
1990    /**
1991     * Returns the default item label paint.
1992     *
1993     * @return The paint (never {@code null}).
1994     *
1995     * @see #setDefaultItemLabelPaint(Paint)
1996     */
1997    public Paint getDefaultItemLabelPaint() {
1998        return this.defaultItemLabelPaint;
1999    }
2000
2001    /**
2002     * Sets the default item label paint and sends a {@link RendererChangeEvent}
2003     * to all registered listeners.
2004     *
2005     * @param paint  the paint ({@code null} not permitted).
2006     *
2007     * @see #getDefaultItemLabelPaint()
2008     */
2009    public void setDefaultItemLabelPaint(Paint paint) {
2010        // defer argument checking...
2011        setDefaultItemLabelPaint(paint, true);
2012    }
2013
2014    /**
2015     * Sets the default item label paint and, if requested, sends a
2016     * {@link RendererChangeEvent} to all registered listeners..
2017     *
2018     * @param paint  the paint ({@code null} not permitted).
2019     * @param notify  a flag that controls whether or not listeners are
2020     *                notified.
2021     *
2022     * @see #getDefaultItemLabelPaint()
2023     */
2024    public void setDefaultItemLabelPaint(Paint paint, boolean notify) {
2025        Args.nullNotPermitted(paint, "paint");
2026        this.defaultItemLabelPaint = paint;
2027        if (notify) {
2028            fireChangeEvent();
2029        }
2030    }
2031
2032    // POSITIVE ITEM LABEL POSITION...
2033
2034    /**
2035     * Returns the item label position for positive values.
2036     *
2037     * @param row  the row (or series) index (zero-based).
2038     * @param column  the column (or category) index (zero-based).
2039     *
2040     * @return The item label position (never {@code null}).
2041     *
2042     * @see #getNegativeItemLabelPosition(int, int)
2043     */
2044    public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
2045        return getSeriesPositiveItemLabelPosition(row);
2046    }
2047
2048    /**
2049     * Returns the item label position for all positive values in a series.
2050     *
2051     * @param series  the series index (zero-based).
2052     *
2053     * @return The item label position (never {@code null}).
2054     *
2055     * @see #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition)
2056     */
2057    public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series) {
2058        // otherwise look up the position table
2059        ItemLabelPosition position = this.positiveItemLabelPositionMap.get(series);
2060        if (position == null) {
2061            position = this.defaultPositiveItemLabelPosition;
2062        }
2063        return position;
2064    }
2065
2066    /**
2067     * Sets the item label position for all positive values in a series and
2068     * sends a {@link RendererChangeEvent} to all registered listeners.
2069     *
2070     * @param series  the series index (zero-based).
2071     * @param position  the position ({@code null} permitted).
2072     *
2073     * @see #getSeriesPositiveItemLabelPosition(int)
2074     */
2075    public void setSeriesPositiveItemLabelPosition(int series,
2076                                                   ItemLabelPosition position) {
2077        setSeriesPositiveItemLabelPosition(series, position, true);
2078    }
2079
2080    /**
2081     * Sets the item label position for all positive values in a series and (if
2082     * requested) sends a {@link RendererChangeEvent} to all registered
2083     * listeners.
2084     *
2085     * @param series  the series index (zero-based).
2086     * @param position  the position ({@code null} permitted).
2087     * @param notify  notify registered listeners?
2088     *
2089     * @see #getSeriesPositiveItemLabelPosition(int)
2090     */
2091    public void setSeriesPositiveItemLabelPosition(int series,
2092            ItemLabelPosition position, boolean notify) {
2093        this.positiveItemLabelPositionMap.put(series, position);
2094        if (notify) {
2095            fireChangeEvent();
2096        }
2097    }
2098
2099    /**
2100     * Returns the default positive item label position.
2101     *
2102     * @return The position (never {@code null}).
2103     *
2104     * @see #setDefaultPositiveItemLabelPosition(ItemLabelPosition)
2105     */
2106    public ItemLabelPosition getDefaultPositiveItemLabelPosition() {
2107        return this.defaultPositiveItemLabelPosition;
2108    }
2109
2110    /**
2111     * Sets the default positive item label position.
2112     *
2113     * @param position  the position ({@code null} not permitted).
2114     *
2115     * @see #getDefaultPositiveItemLabelPosition()
2116     */
2117    public void setDefaultPositiveItemLabelPosition(
2118            ItemLabelPosition position) {
2119        // defer argument checking...
2120        setDefaultPositiveItemLabelPosition(position, true);
2121    }
2122
2123    /**
2124     * Sets the default positive item label position and, if requested, sends a
2125     * {@link RendererChangeEvent} to all registered listeners.
2126     *
2127     * @param position  the position ({@code null} not permitted).
2128     * @param notify  notify registered listeners?
2129     *
2130     * @see #getDefaultPositiveItemLabelPosition()
2131     */
2132    public void setDefaultPositiveItemLabelPosition(ItemLabelPosition position,
2133            boolean notify) {
2134        Args.nullNotPermitted(position, "position");
2135        this.defaultPositiveItemLabelPosition = position;
2136        if (notify) {
2137            fireChangeEvent();
2138        }
2139    }
2140
2141    // NEGATIVE ITEM LABEL POSITION...
2142
2143    /**
2144     * Returns the item label position for negative values.  This method can be
2145     * overridden to provide customisation of the item label position for
2146     * individual data items.
2147     *
2148     * @param row  the row (or series) index (zero-based).
2149     * @param column  the column (or category) index (zero-based).
2150     *
2151     * @return The item label position (never {@code null}).
2152     *
2153     * @see #getPositiveItemLabelPosition(int, int)
2154     */
2155    public ItemLabelPosition getNegativeItemLabelPosition(int row, int column) {
2156        return getSeriesNegativeItemLabelPosition(row);
2157    }
2158
2159    /**
2160     * Returns the item label position for all negative values in a series.
2161     *
2162     * @param series  the series index (zero-based).
2163     *
2164     * @return The item label position (never {@code null}).
2165     *
2166     * @see #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition)
2167     */
2168    public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) {
2169        // otherwise look up the position list
2170        ItemLabelPosition position 
2171                = this.negativeItemLabelPositionMap.get(series);
2172        if (position == null) {
2173            position = this.defaultNegativeItemLabelPosition;
2174        }
2175        return position;
2176    }
2177
2178    /**
2179     * Sets the item label position for negative values in a series and sends a
2180     * {@link RendererChangeEvent} to all registered listeners.
2181     *
2182     * @param series  the series index (zero-based).
2183     * @param position  the position ({@code null} permitted).
2184     *
2185     * @see #getSeriesNegativeItemLabelPosition(int)
2186     */
2187    public void setSeriesNegativeItemLabelPosition(int series,
2188                                                   ItemLabelPosition position) {
2189        setSeriesNegativeItemLabelPosition(series, position, true);
2190    }
2191
2192    /**
2193     * Sets the item label position for negative values in a series and (if
2194     * requested) sends a {@link RendererChangeEvent} to all registered
2195     * listeners.
2196     *
2197     * @param series  the series index (zero-based).
2198     * @param position  the position ({@code null} permitted).
2199     * @param notify  notify registered listeners?
2200     *
2201     * @see #getSeriesNegativeItemLabelPosition(int)
2202     */
2203    public void setSeriesNegativeItemLabelPosition(int series,
2204            ItemLabelPosition position, boolean notify) {
2205        this.negativeItemLabelPositionMap.put(series, position);
2206        if (notify) {
2207            fireChangeEvent();
2208        }
2209    }
2210
2211    /**
2212     * Returns the base item label position for negative values.
2213     *
2214     * @return The position (never {@code null}).
2215     *
2216     * @see #setDefaultNegativeItemLabelPosition(ItemLabelPosition)
2217     */
2218    public ItemLabelPosition getDefaultNegativeItemLabelPosition() {
2219        return this.defaultNegativeItemLabelPosition;
2220    }
2221
2222    /**
2223     * Sets the default item label position for negative values and sends a
2224     * {@link RendererChangeEvent} to all registered listeners.
2225     *
2226     * @param position  the position ({@code null} not permitted).
2227     *
2228     * @see #getDefaultNegativeItemLabelPosition()
2229     */
2230    public void setDefaultNegativeItemLabelPosition(
2231            ItemLabelPosition position) {
2232        setDefaultNegativeItemLabelPosition(position, true);
2233    }
2234
2235    /**
2236     * Sets the default negative item label position and, if requested, sends a
2237     * {@link RendererChangeEvent} to all registered listeners.
2238     *
2239     * @param position  the position ({@code null} not permitted).
2240     * @param notify  notify registered listeners?
2241     *
2242     * @see #getDefaultNegativeItemLabelPosition()
2243     */
2244    public void setDefaultNegativeItemLabelPosition(ItemLabelPosition position,
2245            boolean notify) {
2246        Args.nullNotPermitted(position, "position");
2247        this.defaultNegativeItemLabelPosition = position;
2248        if (notify) {
2249            fireChangeEvent();
2250        }
2251    }
2252
2253    /**
2254     * Returns the item label anchor offset.
2255     *
2256     * @return The offset.
2257     *
2258     * @see #setItemLabelAnchorOffset(double)
2259     */
2260    public double getItemLabelAnchorOffset() {
2261        return this.itemLabelAnchorOffset;
2262    }
2263
2264    /**
2265     * Sets the item label anchor offset.
2266     *
2267     * @param offset  the offset.
2268     *
2269     * @see #getItemLabelAnchorOffset()
2270     */
2271    public void setItemLabelAnchorOffset(double offset) {
2272        this.itemLabelAnchorOffset = offset;
2273        fireChangeEvent();
2274    }
2275
2276    /**
2277     * Returns a boolean that indicates whether or not the specified item
2278     * should have a chart entity created for it.
2279     *
2280     * @param series  the series index.
2281     * @param item  the item index.
2282     *
2283     * @return A boolean.
2284     */
2285    public boolean getItemCreateEntity(int series, int item) {
2286        Boolean b = getSeriesCreateEntities(series);
2287        if (b != null) {
2288            return b;
2289        }
2290        // otherwise...
2291        return this.defaultCreateEntities;
2292    }
2293
2294    /**
2295     * Returns the flag that controls whether entities are created for a
2296     * series.
2297     *
2298     * @param series  the series index (zero-based).
2299     *
2300     * @return The flag (possibly {@code null}).
2301     *
2302     * @see #setSeriesCreateEntities(int, Boolean)
2303     */
2304    public Boolean getSeriesCreateEntities(int series) {
2305        return this.createEntitiesList.getBoolean(series);
2306    }
2307
2308    /**
2309     * Sets the flag that controls whether entities are created for a series,
2310     * and sends a {@link RendererChangeEvent} to all registered listeners.
2311     *
2312     * @param series  the series index (zero-based).
2313     * @param create  the flag ({@code null} permitted).
2314     *
2315     * @see #getSeriesCreateEntities(int)
2316     */
2317    public void setSeriesCreateEntities(int series, Boolean create) {
2318        setSeriesCreateEntities(series, create, true);
2319    }
2320
2321    /**
2322     * Sets the flag that controls whether entities are created for a series
2323     * and, if requested, sends a {@link RendererChangeEvent} to all registered
2324     * listeners.
2325     *
2326     * @param series  the series index.
2327     * @param create  the flag ({@code null} permitted).
2328     * @param notify  notify listeners?
2329     *
2330     * @see #getSeriesCreateEntities(int)
2331     */
2332    public void setSeriesCreateEntities(int series, Boolean create,
2333                                        boolean notify) {
2334        this.createEntitiesList.setBoolean(series, create);
2335        if (notify) {
2336            fireChangeEvent();
2337        }
2338    }
2339
2340    /**
2341     * Returns the default flag for creating entities.
2342     *
2343     * @return The default flag for creating entities.
2344     *
2345     * @see #setDefaultCreateEntities(boolean)
2346     */
2347    public boolean getDefaultCreateEntities() {
2348        return this.defaultCreateEntities;
2349    }
2350
2351    /**
2352     * Sets the default flag that controls whether entities are created
2353     * for a series, and sends a {@link RendererChangeEvent}
2354     * to all registered listeners.
2355     *
2356     * @param create  the flag.
2357     *
2358     * @see #getDefaultCreateEntities()
2359     */
2360    public void setDefaultCreateEntities(boolean create) {
2361        // defer argument checking...
2362        setDefaultCreateEntities(create, true);
2363    }
2364
2365    /**
2366     * Sets the default flag that controls whether entities are created and,
2367     * if requested, sends a {@link RendererChangeEvent} to all registered
2368     * listeners.
2369     *
2370     * @param create  the visibility.
2371     * @param notify  notify listeners?
2372     *
2373     * @see #getDefaultCreateEntities()
2374     */
2375    public void setDefaultCreateEntities(boolean create, boolean notify) {
2376        this.defaultCreateEntities = create;
2377        if (notify) {
2378            fireChangeEvent();
2379        }
2380    }
2381
2382    /**
2383     * Returns the radius of the circle used for the default entity area
2384     * when no area is specified.
2385     *
2386     * @return A radius.
2387     *
2388     * @see #setDefaultEntityRadius(int)
2389     */
2390    public int getDefaultEntityRadius() {
2391        return this.defaultEntityRadius;
2392    }
2393
2394    /**
2395     * Sets the radius of the circle used for the default entity area
2396     * when no area is specified.
2397     *
2398     * @param radius  the radius.
2399     *
2400     * @see #getDefaultEntityRadius()
2401     */
2402    public void setDefaultEntityRadius(int radius) {
2403        this.defaultEntityRadius = radius;
2404    }
2405
2406    /**
2407     * Performs a lookup for the legend shape.
2408     *
2409     * @param series  the series index.
2410     *
2411     * @return The shape (possibly {@code null}).
2412     *
2413     * @since 1.0.11
2414     */
2415    public Shape lookupLegendShape(int series) {
2416        Shape result = getLegendShape(series);
2417        if (result == null) {
2418            result = this.defaultLegendShape;
2419        }
2420        if (result == null) {
2421            result = lookupSeriesShape(series);
2422        }
2423        return result;
2424    }
2425
2426    /**
2427     * Returns the legend shape defined for the specified series (possibly
2428     * {@code null}).
2429     *
2430     * @param series  the series index.
2431     *
2432     * @return The shape (possibly {@code null}).
2433     *
2434     * @see #lookupLegendShape(int)
2435     *
2436     * @since 1.0.11
2437     */
2438    public Shape getLegendShape(int series) {
2439        return this.legendShapeList.getShape(series);
2440    }
2441
2442    /**
2443     * Sets the shape used for the legend item for the specified series, and
2444     * sends a {@link RendererChangeEvent} to all registered listeners.
2445     *
2446     * @param series  the series index.
2447     * @param shape  the shape ({@code null} permitted).
2448     *
2449     * @since 1.0.11
2450     */
2451    public void setLegendShape(int series, Shape shape) {
2452        this.legendShapeList.setShape(series, shape);
2453        fireChangeEvent();
2454    }
2455
2456    /**
2457     * Returns the default legend shape, which may be {@code null}.
2458     *
2459     * @return The default legend shape.
2460     *
2461     * @since 1.0.11
2462     */
2463    public Shape getDefaultLegendShape() {
2464        return this.defaultLegendShape;
2465    }
2466
2467    /**
2468     * Sets the default legend shape and sends a
2469     * {@link RendererChangeEvent} to all registered listeners.
2470     *
2471     * @param shape  the shape ({@code null} permitted).
2472     *
2473     * @since 1.0.11
2474     */
2475    public void setDefaultLegendShape(Shape shape) {
2476        this.defaultLegendShape = shape;
2477        fireChangeEvent();
2478    }
2479
2480    /**
2481     * Returns the flag that controls whether or not the legend shape is
2482     * treated as a line when creating legend items.
2483     * 
2484     * @return A boolean.
2485     * 
2486     * @since 1.0.14
2487     */
2488    protected boolean getTreatLegendShapeAsLine() {
2489        return this.treatLegendShapeAsLine;
2490    }
2491
2492    /**
2493     * Sets the flag that controls whether or not the legend shape is
2494     * treated as a line when creating legend items.
2495     *
2496     * @param treatAsLine  the new flag value.
2497     *
2498     * @since 1.0.14
2499     */
2500    protected void setTreatLegendShapeAsLine(boolean treatAsLine) {
2501        if (this.treatLegendShapeAsLine != treatAsLine) {
2502            this.treatLegendShapeAsLine = treatAsLine;
2503            fireChangeEvent();
2504        }
2505    }
2506
2507    /**
2508     * Performs a lookup for the legend text font.
2509     *
2510     * @param series  the series index.
2511     *
2512     * @return The font (possibly {@code null}).
2513     *
2514     * @since 1.0.11
2515     */
2516    public Font lookupLegendTextFont(int series) {
2517        Font result = getLegendTextFont(series);
2518        if (result == null) {
2519            result = this.defaultLegendTextFont;
2520        }
2521        return result;
2522    }
2523
2524    /**
2525     * Returns the legend text font defined for the specified series (possibly
2526     * {@code null}).
2527     *
2528     * @param series  the series index.
2529     *
2530     * @return The font (possibly {@code null}).
2531     *
2532     * @see #lookupLegendTextFont(int)
2533     *
2534     * @since 1.0.11
2535     */
2536    public Font getLegendTextFont(int series) {
2537        return this.legendTextFontMap.get(series);
2538    }
2539
2540    /**
2541     * Sets the font used for the legend text for the specified series, and
2542     * sends a {@link RendererChangeEvent} to all registered listeners.
2543     *
2544     * @param series  the series index.
2545     * @param font  the font ({@code null} permitted).
2546     *
2547     * @since 1.0.11
2548     */
2549    public void setLegendTextFont(int series, Font font) {
2550        this.legendTextFontMap.put(series, font);
2551        fireChangeEvent();
2552    }
2553
2554    /**
2555     * Returns the default legend text font, which may be {@code null}.
2556     *
2557     * @return The default legend text font.
2558     *
2559     * @since 1.0.11
2560     */
2561    public Font getDefaultLegendTextFont() {
2562        return this.defaultLegendTextFont;
2563    }
2564
2565    /**
2566     * Sets the default legend text font and sends a
2567     * {@link RendererChangeEvent} to all registered listeners.
2568     *
2569     * @param font  the font ({@code null} permitted).
2570     *
2571     * @since 1.0.11
2572     */
2573    public void setDefaultLegendTextFont(Font font) {
2574        Args.nullNotPermitted(font, "font");
2575        this.defaultLegendTextFont = font;
2576        fireChangeEvent();
2577    }
2578
2579    /**
2580     * Performs a lookup for the legend text paint.
2581     *
2582     * @param series  the series index.
2583     *
2584     * @return The paint (possibly {@code null}).
2585     *
2586     * @since 1.0.11
2587     */
2588    public Paint lookupLegendTextPaint(int series) {
2589        Paint result = getLegendTextPaint(series);
2590        if (result == null) {
2591            result = this.defaultLegendTextPaint;
2592        }
2593        return result;
2594    }
2595
2596    /**
2597     * Returns the legend text paint defined for the specified series (possibly
2598     * {@code null}).
2599     *
2600     * @param series  the series index.
2601     *
2602     * @return The paint (possibly {@code null}).
2603     *
2604     * @see #lookupLegendTextPaint(int)
2605     *
2606     * @since 1.0.11
2607     */
2608    public Paint getLegendTextPaint(int series) {
2609        return this.legendTextPaint.getPaint(series);
2610    }
2611
2612    /**
2613     * Sets the paint used for the legend text for the specified series, and
2614     * sends a {@link RendererChangeEvent} to all registered listeners.
2615     *
2616     * @param series  the series index.
2617     * @param paint  the paint ({@code null} permitted).
2618     *
2619     * @since 1.0.11
2620     */
2621    public void setLegendTextPaint(int series, Paint paint) {
2622        this.legendTextPaint.setPaint(series, paint);
2623        fireChangeEvent();
2624    }
2625
2626    /**
2627     * Returns the default legend text paint, which may be {@code null}.
2628     *
2629     * @return The default legend text paint.
2630     *
2631     * @since 1.0.11
2632     */
2633    public Paint getDefaultLegendTextPaint() {
2634        return this.defaultLegendTextPaint;
2635    }
2636
2637    /**
2638     * Sets the default legend text paint and sends a
2639     * {@link RendererChangeEvent} to all registered listeners.
2640     *
2641     * @param paint  the paint ({@code null} permitted).
2642     *
2643     * @since 1.0.11
2644     */
2645    public void setDefaultLegendTextPaint(Paint paint) {
2646        this.defaultLegendTextPaint = paint;
2647        fireChangeEvent();
2648    }
2649
2650    /**
2651     * Returns the flag that controls whether or not the data bounds reported
2652     * by this renderer will exclude non-visible series.
2653     *
2654     * @return A boolean.
2655     *
2656     * @since 1.0.13
2657     */
2658    public boolean getDataBoundsIncludesVisibleSeriesOnly() {
2659        return this.dataBoundsIncludesVisibleSeriesOnly;
2660    }
2661
2662    /**
2663     * Sets the flag that controls whether or not the data bounds reported
2664     * by this renderer will exclude non-visible series and sends a
2665     * {@link RendererChangeEvent} to all registered listeners.
2666     *
2667     * @param visibleOnly  include only visible series.
2668     *
2669     * @since 1.0.13
2670     */
2671    public void setDataBoundsIncludesVisibleSeriesOnly(boolean visibleOnly) {
2672        this.dataBoundsIncludesVisibleSeriesOnly = visibleOnly;
2673        notifyListeners(new RendererChangeEvent(this, true));
2674    }
2675
2676    /** The adjacent offset. */
2677    private static final double ADJ = Math.cos(Math.PI / 6.0);
2678
2679    /** The opposite offset. */
2680    private static final double OPP = Math.sin(Math.PI / 6.0);
2681
2682    /**
2683     * Calculates the item label anchor point.
2684     *
2685     * @param anchor  the anchor.
2686     * @param x  the x coordinate.
2687     * @param y  the y coordinate.
2688     * @param orientation  the plot orientation.
2689     *
2690     * @return The anchor point (never {@code null}).
2691     */
2692    protected Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor,
2693            double x, double y, PlotOrientation orientation) {
2694        Point2D result = null;
2695        if (anchor == ItemLabelAnchor.CENTER) {
2696            result = new Point2D.Double(x, y);
2697        }
2698        else if (anchor == ItemLabelAnchor.INSIDE1) {
2699            result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset,
2700                    y - ADJ * this.itemLabelAnchorOffset);
2701        }
2702        else if (anchor == ItemLabelAnchor.INSIDE2) {
2703            result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset,
2704                    y - OPP * this.itemLabelAnchorOffset);
2705        }
2706        else if (anchor == ItemLabelAnchor.INSIDE3) {
2707            result = new Point2D.Double(x + this.itemLabelAnchorOffset, y);
2708        }
2709        else if (anchor == ItemLabelAnchor.INSIDE4) {
2710            result = new Point2D.Double(x + ADJ * this.itemLabelAnchorOffset,
2711                    y + OPP * this.itemLabelAnchorOffset);
2712        }
2713        else if (anchor == ItemLabelAnchor.INSIDE5) {
2714            result = new Point2D.Double(x + OPP * this.itemLabelAnchorOffset,
2715                    y + ADJ * this.itemLabelAnchorOffset);
2716        }
2717        else if (anchor == ItemLabelAnchor.INSIDE6) {
2718            result = new Point2D.Double(x, y + this.itemLabelAnchorOffset);
2719        }
2720        else if (anchor == ItemLabelAnchor.INSIDE7) {
2721            result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset,
2722                    y + ADJ * this.itemLabelAnchorOffset);
2723        }
2724        else if (anchor == ItemLabelAnchor.INSIDE8) {
2725            result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset,
2726                    y + OPP * this.itemLabelAnchorOffset);
2727        }
2728        else if (anchor == ItemLabelAnchor.INSIDE9) {
2729            result = new Point2D.Double(x - this.itemLabelAnchorOffset, y);
2730        }
2731        else if (anchor == ItemLabelAnchor.INSIDE10) {
2732            result = new Point2D.Double(x - ADJ * this.itemLabelAnchorOffset,
2733                    y - OPP * this.itemLabelAnchorOffset);
2734        }
2735        else if (anchor == ItemLabelAnchor.INSIDE11) {
2736            result = new Point2D.Double(x - OPP * this.itemLabelAnchorOffset,
2737                    y - ADJ * this.itemLabelAnchorOffset);
2738        }
2739        else if (anchor == ItemLabelAnchor.INSIDE12) {
2740            result = new Point2D.Double(x, y - this.itemLabelAnchorOffset);
2741        }
2742        else if (anchor == ItemLabelAnchor.OUTSIDE1) {
2743            result = new Point2D.Double(
2744                    x + 2.0 * OPP * this.itemLabelAnchorOffset,
2745                    y - 2.0 * ADJ * this.itemLabelAnchorOffset);
2746        }
2747        else if (anchor == ItemLabelAnchor.OUTSIDE2) {
2748            result = new Point2D.Double(
2749                    x + 2.0 * ADJ * this.itemLabelAnchorOffset,
2750                    y - 2.0 * OPP * this.itemLabelAnchorOffset);
2751        }
2752        else if (anchor == ItemLabelAnchor.OUTSIDE3) {
2753            result = new Point2D.Double(x + 2.0 * this.itemLabelAnchorOffset,
2754                    y);
2755        }
2756        else if (anchor == ItemLabelAnchor.OUTSIDE4) {
2757            result = new Point2D.Double(
2758                    x + 2.0 * ADJ * this.itemLabelAnchorOffset,
2759                    y + 2.0 * OPP * this.itemLabelAnchorOffset);
2760        }
2761        else if (anchor == ItemLabelAnchor.OUTSIDE5) {
2762            result = new Point2D.Double(
2763                    x + 2.0 * OPP * this.itemLabelAnchorOffset,
2764                    y + 2.0 * ADJ * this.itemLabelAnchorOffset);
2765        }
2766        else if (anchor == ItemLabelAnchor.OUTSIDE6) {
2767            result = new Point2D.Double(x,
2768                    y + 2.0 * this.itemLabelAnchorOffset);
2769        }
2770        else if (anchor == ItemLabelAnchor.OUTSIDE7) {
2771            result = new Point2D.Double(
2772                    x - 2.0 * OPP * this.itemLabelAnchorOffset,
2773                    y + 2.0 * ADJ * this.itemLabelAnchorOffset);
2774        }
2775        else if (anchor == ItemLabelAnchor.OUTSIDE8) {
2776            result = new Point2D.Double(
2777                    x - 2.0 * ADJ * this.itemLabelAnchorOffset,
2778                    y + 2.0 * OPP * this.itemLabelAnchorOffset);
2779        }
2780        else if (anchor == ItemLabelAnchor.OUTSIDE9) {
2781            result = new Point2D.Double(x - 2.0 * this.itemLabelAnchorOffset,
2782                    y);
2783        }
2784        else if (anchor == ItemLabelAnchor.OUTSIDE10) {
2785            result = new Point2D.Double(
2786                    x - 2.0 * ADJ * this.itemLabelAnchorOffset,
2787                    y - 2.0 * OPP * this.itemLabelAnchorOffset);
2788        }
2789        else if (anchor == ItemLabelAnchor.OUTSIDE11) {
2790            result = new Point2D.Double(
2791                x - 2.0 * OPP * this.itemLabelAnchorOffset,
2792                y - 2.0 * ADJ * this.itemLabelAnchorOffset);
2793        }
2794        else if (anchor == ItemLabelAnchor.OUTSIDE12) {
2795            result = new Point2D.Double(x,
2796                    y - 2.0 * this.itemLabelAnchorOffset);
2797        }
2798        return result;
2799    }
2800
2801    /**
2802     * Registers an object to receive notification of changes to the renderer.
2803     *
2804     * @param listener  the listener ({@code null} not permitted).
2805     *
2806     * @see #removeChangeListener(RendererChangeListener)
2807     */
2808    public void addChangeListener(RendererChangeListener listener) {
2809        Args.nullNotPermitted(listener, "listener");
2810        this.listenerList.add(RendererChangeListener.class, listener);
2811    }
2812
2813    /**
2814     * Deregisters an object so that it no longer receives
2815     * notification of changes to the renderer.
2816     *
2817     * @param listener  the object ({@code null} not permitted).
2818     *
2819     * @see #addChangeListener(RendererChangeListener)
2820     */
2821    public void removeChangeListener(RendererChangeListener listener) {
2822        Args.nullNotPermitted(listener, "listener");
2823        this.listenerList.remove(RendererChangeListener.class, listener);
2824    }
2825
2826    /**
2827     * Returns {@code true} if the specified object is registered with
2828     * the dataset as a listener.  Most applications won't need to call this
2829     * method, it exists mainly for use by unit testing code.
2830     *
2831     * @param listener  the listener.
2832     *
2833     * @return A boolean.
2834     */
2835    public boolean hasListener(EventListener listener) {
2836        List<Object> list = Arrays.asList(this.listenerList.getListenerList());
2837        return list.contains(listener);
2838    }
2839
2840    /**
2841     * Sends a {@link RendererChangeEvent} to all registered listeners.
2842     *
2843     * @since 1.0.5
2844     */
2845    protected void fireChangeEvent() {
2846        notifyListeners(new RendererChangeEvent(this));
2847    }
2848
2849    /**
2850     * Notifies all registered listeners that the renderer has been modified.
2851     *
2852     * @param event  information about the change event.
2853     */
2854    public void notifyListeners(RendererChangeEvent event) {
2855        Object[] ls = this.listenerList.getListenerList();
2856        for (int i = ls.length - 2; i >= 0; i -= 2) {
2857            if (ls[i] == RendererChangeListener.class) {
2858                ((RendererChangeListener) ls[i + 1]).rendererChanged(event);
2859            }
2860        }
2861    }
2862
2863    /**
2864     * Tests this renderer for equality with another object.
2865     *
2866     * @param obj  the object ({@code null} permitted).
2867     *
2868     * @return {@code true} or {@code false}.
2869     */
2870    @Override
2871    public boolean equals(Object obj) {
2872        if (obj == this) {
2873            return true;
2874        }
2875        if (!(obj instanceof AbstractRenderer)) {
2876            return false;
2877        }
2878        AbstractRenderer that = (AbstractRenderer) obj;
2879        if (this.dataBoundsIncludesVisibleSeriesOnly
2880                != that.dataBoundsIncludesVisibleSeriesOnly) {
2881            return false;
2882        }
2883        if (this.treatLegendShapeAsLine != that.treatLegendShapeAsLine) {
2884            return false;
2885        }
2886        if (this.defaultEntityRadius != that.defaultEntityRadius) {
2887            return false;
2888        }
2889        if (!this.seriesVisibleList.equals(that.seriesVisibleList)) {
2890            return false;
2891        }
2892        if (this.defaultSeriesVisible != that.defaultSeriesVisible) {
2893            return false;
2894        }
2895        if (!this.seriesVisibleInLegendList.equals(
2896                that.seriesVisibleInLegendList)) {
2897            return false;
2898        }
2899        if (this.defaultSeriesVisibleInLegend
2900                != that.defaultSeriesVisibleInLegend) {
2901            return false;
2902        }
2903        if (!ObjectUtils.equal(this.paintList, that.paintList)) {
2904            return false;
2905        }
2906        if (!PaintUtils.equal(this.defaultPaint, that.defaultPaint)) {
2907            return false;
2908        }
2909        if (!ObjectUtils.equal(this.fillPaintList, that.fillPaintList)) {
2910            return false;
2911        }
2912        if (!PaintUtils.equal(this.defaultFillPaint,
2913                that.defaultFillPaint)) {
2914            return false;
2915        }
2916        if (!ObjectUtils.equal(this.outlinePaintList,
2917                that.outlinePaintList)) {
2918            return false;
2919        }
2920        if (!PaintUtils.equal(this.defaultOutlinePaint,
2921                that.defaultOutlinePaint)) {
2922            return false;
2923        }
2924        if (!ObjectUtils.equal(this.strokeList, that.strokeList)) {
2925            return false;
2926        }
2927        if (!ObjectUtils.equal(this.defaultStroke, that.defaultStroke)) {
2928            return false;
2929        }
2930        if (!ObjectUtils.equal(this.outlineStrokeList,
2931                that.outlineStrokeList)) {
2932            return false;
2933        }
2934        if (!ObjectUtils.equal(this.defaultOutlineStroke,
2935                that.defaultOutlineStroke)) {
2936            return false;
2937        }
2938        if (!ObjectUtils.equal(this.shapeList, that.shapeList)) {
2939            return false;
2940        }
2941        if (!ShapeUtils.equal(this.defaultShape, that.defaultShape)) {
2942            return false;
2943        }
2944        if (!ObjectUtils.equal(this.itemLabelsVisibleList,
2945                that.itemLabelsVisibleList)) {
2946            return false;
2947        }
2948        if (!ObjectUtils.equal(this.defaultItemLabelsVisible,
2949                that.defaultItemLabelsVisible)) {
2950            return false;
2951        }
2952        if (!ObjectUtils.equal(this.itemLabelFontMap,
2953                that.itemLabelFontMap)) {
2954            return false;
2955        }
2956        if (!ObjectUtils.equal(this.defaultItemLabelFont,
2957                that.defaultItemLabelFont)) {
2958            return false;
2959        }
2960
2961        if (!ObjectUtils.equal(this.itemLabelPaintList,
2962                that.itemLabelPaintList)) {
2963            return false;
2964        }
2965        if (!PaintUtils.equal(this.defaultItemLabelPaint,
2966                that.defaultItemLabelPaint)) {
2967            return false;
2968        }
2969
2970        if (!ObjectUtils.equal(this.positiveItemLabelPositionMap,
2971                that.positiveItemLabelPositionMap)) {
2972            return false;
2973        }
2974        if (!ObjectUtils.equal(this.defaultPositiveItemLabelPosition,
2975                that.defaultPositiveItemLabelPosition)) {
2976            return false;
2977        }
2978
2979        if (!ObjectUtils.equal(this.negativeItemLabelPositionMap,
2980                that.negativeItemLabelPositionMap)) {
2981            return false;
2982        }
2983        if (!ObjectUtils.equal(this.defaultNegativeItemLabelPosition,
2984                that.defaultNegativeItemLabelPosition)) {
2985            return false;
2986        }
2987        if (this.itemLabelAnchorOffset != that.itemLabelAnchorOffset) {
2988            return false;
2989        }
2990        if (!ObjectUtils.equal(this.createEntitiesList,
2991                that.createEntitiesList)) {
2992            return false;
2993        }
2994        if (this.defaultCreateEntities != that.defaultCreateEntities) {
2995            return false;
2996        }
2997        if (!ObjectUtils.equal(this.legendShapeList,
2998                that.legendShapeList)) {
2999            return false;
3000        }
3001        if (!ShapeUtils.equal(this.defaultLegendShape,
3002                that.defaultLegendShape)) {
3003            return false;
3004        }
3005        if (!ObjectUtils.equal(this.legendTextFontMap, 
3006                that.legendTextFontMap)) {
3007            return false;
3008        }
3009        if (!ObjectUtils.equal(this.defaultLegendTextFont,
3010                that.defaultLegendTextFont)) {
3011            return false;
3012        }
3013        if (!ObjectUtils.equal(this.legendTextPaint,
3014                that.legendTextPaint)) {
3015            return false;
3016        }
3017        if (!PaintUtils.equal(this.defaultLegendTextPaint,
3018                that.defaultLegendTextPaint)) {
3019            return false;
3020        }
3021        return true;
3022    }
3023
3024    /**
3025     * Returns a hashcode for the renderer.
3026     *
3027     * @return The hashcode.
3028     */
3029    @Override
3030    public int hashCode() {
3031        int result = 193;
3032        result = HashUtils.hashCode(result, this.seriesVisibleList);
3033        result = HashUtils.hashCode(result, this.defaultSeriesVisible);
3034        result = HashUtils.hashCode(result, this.seriesVisibleInLegendList);
3035        result = HashUtils.hashCode(result, this.defaultSeriesVisibleInLegend);
3036        result = HashUtils.hashCode(result, this.paintList);
3037        result = HashUtils.hashCode(result, this.defaultPaint);
3038        result = HashUtils.hashCode(result, this.fillPaintList);
3039        result = HashUtils.hashCode(result, this.defaultFillPaint);
3040        result = HashUtils.hashCode(result, this.outlinePaintList);
3041        result = HashUtils.hashCode(result, this.defaultOutlinePaint);
3042        result = HashUtils.hashCode(result, this.strokeList);
3043        result = HashUtils.hashCode(result, this.defaultStroke);
3044        result = HashUtils.hashCode(result, this.outlineStrokeList);
3045        result = HashUtils.hashCode(result, this.defaultOutlineStroke);
3046        // shapeList
3047        // baseShape
3048        result = HashUtils.hashCode(result, this.itemLabelsVisibleList);
3049        result = HashUtils.hashCode(result, this.defaultItemLabelsVisible);
3050        // itemLabelFontList
3051        // baseItemLabelFont
3052        // itemLabelPaintList
3053        // baseItemLabelPaint
3054        // positiveItemLabelPositionList
3055        // basePositiveItemLabelPosition
3056        // negativeItemLabelPositionList
3057        // baseNegativeItemLabelPosition
3058        // itemLabelAnchorOffset
3059        // createEntityList
3060        // baseCreateEntities
3061        return result;
3062    }
3063
3064    /**
3065     * Returns an independent copy of the renderer.
3066     *
3067     * @return A clone.
3068     *
3069     * @throws CloneNotSupportedException if some component of the renderer
3070     *         does not support cloning.
3071     */
3072    @Override
3073    protected Object clone() throws CloneNotSupportedException {
3074        AbstractRenderer clone = (AbstractRenderer) super.clone();
3075
3076        if (this.seriesVisibleList != null) {
3077            clone.seriesVisibleList
3078                    = (BooleanList) this.seriesVisibleList.clone();
3079        }
3080
3081        if (this.seriesVisibleInLegendList != null) {
3082            clone.seriesVisibleInLegendList
3083                    = (BooleanList) this.seriesVisibleInLegendList.clone();
3084        }
3085
3086        // 'paint' : immutable, no need to clone reference
3087        if (this.paintList != null) {
3088            clone.paintList = (PaintList) this.paintList.clone();
3089        }
3090        // 'basePaint' : immutable, no need to clone reference
3091
3092        if (this.fillPaintList != null) {
3093            clone.fillPaintList = (PaintList) this.fillPaintList.clone();
3094        }
3095        // 'outlinePaint' : immutable, no need to clone reference
3096        if (this.outlinePaintList != null) {
3097            clone.outlinePaintList = (PaintList) this.outlinePaintList.clone();
3098        }
3099        // 'baseOutlinePaint' : immutable, no need to clone reference
3100
3101        // 'stroke' : immutable, no need to clone reference
3102        if (this.strokeList != null) {
3103            clone.strokeList = (StrokeList) this.strokeList.clone();
3104        }
3105        // 'baseStroke' : immutable, no need to clone reference
3106
3107        // 'outlineStroke' : immutable, no need to clone reference
3108        if (this.outlineStrokeList != null) {
3109            clone.outlineStrokeList
3110                = (StrokeList) this.outlineStrokeList.clone();
3111        }
3112        // 'baseOutlineStroke' : immutable, no need to clone reference
3113
3114        if (this.shapeList != null) {
3115            clone.shapeList = (ShapeList) this.shapeList.clone();
3116        }
3117        if (this.defaultShape != null) {
3118            clone.defaultShape = ShapeUtils.clone(this.defaultShape);
3119        }
3120
3121        // 'itemLabelsVisible' : immutable, no need to clone reference
3122        if (this.itemLabelsVisibleList != null) {
3123            clone.itemLabelsVisibleList
3124                = (BooleanList) this.itemLabelsVisibleList.clone();
3125        }
3126        // 'basePaint' : immutable, no need to clone reference
3127
3128        // 'itemLabelFont' : immutable, no need to clone reference
3129        if (this.itemLabelFontMap != null) {
3130            clone.itemLabelFontMap 
3131                    = new HashMap<Integer, Font>(this.itemLabelFontMap);
3132        }
3133        // 'baseItemLabelFont' : immutable, no need to clone reference
3134
3135        // 'itemLabelPaint' : immutable, no need to clone reference
3136        if (this.itemLabelPaintList != null) {
3137            clone.itemLabelPaintList
3138                = (PaintList) this.itemLabelPaintList.clone();
3139        }
3140        // 'baseItemLabelPaint' : immutable, no need to clone reference
3141
3142        if (this.positiveItemLabelPositionMap != null) {
3143            clone.positiveItemLabelPositionMap 
3144                    = new HashMap<Integer, ItemLabelPosition>(
3145                    this.positiveItemLabelPositionMap);
3146        }
3147
3148        if (this.negativeItemLabelPositionMap != null) {
3149            clone.negativeItemLabelPositionMap 
3150                    = new HashMap<Integer, ItemLabelPosition>(
3151                    this.negativeItemLabelPositionMap);
3152        }
3153
3154        if (this.createEntitiesList != null) {
3155            clone.createEntitiesList
3156                    = (BooleanList) this.createEntitiesList.clone();
3157        }
3158
3159        if (this.legendShapeList != null) {
3160            clone.legendShapeList = (ShapeList) this.legendShapeList.clone();
3161        }
3162        if (this.legendTextFontMap != null) {
3163            // Font objects are immutable so just shallow copy the map
3164            clone.legendTextFontMap = new HashMap<Integer, Font>(
3165                    this.legendTextFontMap);
3166        }
3167        if (this.legendTextPaint != null) {
3168            clone.legendTextPaint = (PaintList) this.legendTextPaint.clone();
3169        }
3170        clone.listenerList = new EventListenerList();
3171        clone.event = null;
3172        return clone;
3173    }
3174
3175    /**
3176     * Provides serialization support.
3177     *
3178     * @param stream  the output stream.
3179     *
3180     * @throws IOException  if there is an I/O error.
3181     */
3182    private void writeObject(ObjectOutputStream stream) throws IOException {
3183        stream.defaultWriteObject();
3184        SerialUtils.writePaint(this.defaultPaint, stream);
3185        SerialUtils.writePaint(this.defaultFillPaint, stream);
3186        SerialUtils.writePaint(this.defaultOutlinePaint, stream);
3187        SerialUtils.writeStroke(this.defaultStroke, stream);
3188        SerialUtils.writeStroke(this.defaultOutlineStroke, stream);
3189        SerialUtils.writeShape(this.defaultShape, stream);
3190        SerialUtils.writePaint(this.defaultItemLabelPaint, stream);
3191        SerialUtils.writeShape(this.defaultLegendShape, stream);
3192        SerialUtils.writePaint(this.defaultLegendTextPaint, stream);
3193    }
3194
3195    /**
3196     * Provides serialization support.
3197     *
3198     * @param stream  the input stream.
3199     *
3200     * @throws IOException  if there is an I/O error.
3201     * @throws ClassNotFoundException  if there is a classpath problem.
3202     */
3203    private void readObject(ObjectInputStream stream)
3204        throws IOException, ClassNotFoundException {
3205        stream.defaultReadObject();
3206        this.defaultPaint = SerialUtils.readPaint(stream);
3207        this.defaultFillPaint = SerialUtils.readPaint(stream);
3208        this.defaultOutlinePaint = SerialUtils.readPaint(stream);
3209        this.defaultStroke = SerialUtils.readStroke(stream);
3210        this.defaultOutlineStroke = SerialUtils.readStroke(stream);
3211        this.defaultShape = SerialUtils.readShape(stream);
3212        this.defaultItemLabelPaint = SerialUtils.readPaint(stream);
3213        this.defaultLegendShape = SerialUtils.readShape(stream);
3214        this.defaultLegendTextPaint = SerialUtils.readPaint(stream);
3215
3216        // listeners are not restored automatically, but storage must be
3217        // provided...
3218        this.listenerList = new EventListenerList();
3219    }
3220
3221}