0001: /* ===========================================================
0002: * JFreeChart : a free chart library for the Java(tm) platform
0003: * ===========================================================
0004: *
0005: * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
0006: *
0007: * Project Info: http://www.jfree.org/jfreechart/index.html
0008: *
0009: * This library is free software; you can redistribute it and/or modify it
0010: * under the terms of the GNU Lesser General Public License as published by
0011: * the Free Software Foundation; either version 2.1 of the License, or
0012: * (at your option) any later version.
0013: *
0014: * This library is distributed in the hope that it will be useful, but
0015: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
0016: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
0017: * License for more details.
0018: *
0019: * You should have received a copy of the GNU Lesser General Public
0020: * License along with this library; if not, write to the Free Software
0021: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
0022: * USA.
0023: *
0024: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
0025: * in the United States and other countries.]
0026: *
0027: * ---------------------
0028: * AbstractRenderer.java
0029: * ---------------------
0030: * (C) Copyright 2002-2007, by Object Refinery Limited.
0031: *
0032: * Original Author: David Gilbert (for Object Refinery Limited);
0033: * Contributor(s): Nicolas Brodu;
0034: *
0035: * $Id: AbstractRenderer.java,v 1.22.2.15 2007/06/13 10:57:40 mungady Exp $
0036: *
0037: * Changes:
0038: * --------
0039: * 22-Aug-2002 : Version 1, draws code out of AbstractXYItemRenderer to share
0040: * with AbstractCategoryItemRenderer (DG);
0041: * 01-Oct-2002 : Fixed errors reported by Checkstyle (DG);
0042: * 06-Nov-2002 : Moved to the com.jrefinery.chart.renderer package (DG);
0043: * 21-Nov-2002 : Added a paint table for the renderer to use (DG);
0044: * 17-Jan-2003 : Moved plot classes into a separate package (DG);
0045: * 25-Mar-2003 : Implemented Serializable (DG);
0046: * 29-Apr-2003 : Added valueLabelFont and valueLabelPaint attributes, based on
0047: * code from Arnaud Lelievre (DG);
0048: * 29-Jul-2003 : Amended code that doesn't compile with JDK 1.2.2 (DG);
0049: * 13-Aug-2003 : Implemented Cloneable (DG);
0050: * 15-Sep-2003 : Fixed serialization (NB);
0051: * 17-Sep-2003 : Changed ChartRenderingInfo --> PlotRenderingInfo (DG);
0052: * 07-Oct-2003 : Moved PlotRenderingInfo into RendererState to allow for
0053: * multiple threads using a single renderer (DG);
0054: * 20-Oct-2003 : Added missing setOutlinePaint() method (DG);
0055: * 23-Oct-2003 : Split item label attributes into 'positive' and 'negative'
0056: * values (DG);
0057: * 26-Nov-2003 : Added methods to get the positive and negative item label
0058: * positions (DG);
0059: * 01-Mar-2004 : Modified readObject() method to prevent null pointer exceptions
0060: * after deserialization (DG);
0061: * 19-Jul-2004 : Fixed bug in getItemLabelFont(int, int) method (DG);
0062: * 04-Oct-2004 : Updated equals() method, eliminated use of NumberUtils,
0063: * renamed BooleanUtils --> BooleanUtilities, ShapeUtils -->
0064: * ShapeUtilities (DG);
0065: * 15-Mar-2005 : Fixed serialization of baseFillPaint (DG);
0066: * 16-May-2005 : Base outline stroke should never be null (DG);
0067: * 01-Jun-2005 : Added hasListener() method for unit testing (DG);
0068: * 08-Jun-2005 : Fixed equals() method to handle GradientPaint (DG);
0069: * ------------- JFREECHART 1.0.x ---------------------------------------------
0070: * 02-Feb-2007 : Minor API doc update (DG);
0071: * 19-Feb-2007 : Fixes for clone() method (DG);
0072: * 28-Feb-2007 : Use cached event to signal changes (DG);
0073: * 19-Apr-2007 : Deprecated seriesVisible and seriesVisibleInLegend flags (DG);
0074: * 20-Apr-2007 : Deprecated paint, fillPaint, outlinePaint, stroke,
0075: * outlineStroke, shape, itemLabelsVisible, itemLabelFont,
0076: * itemLabelPaint, positiveItemLabelPosition,
0077: * negativeItemLabelPosition and createEntities override
0078: * fields (DG);
0079: * 13-Jun-2007 : Added new autoPopulate flags for core series attributes (DG);
0080: *
0081: */
0082:
0083: package org.jfree.chart.renderer;
0084:
0085: import java.awt.BasicStroke;
0086: import java.awt.Color;
0087: import java.awt.Font;
0088: import java.awt.Paint;
0089: import java.awt.Shape;
0090: import java.awt.Stroke;
0091: import java.awt.geom.Point2D;
0092: import java.awt.geom.Rectangle2D;
0093: import java.io.IOException;
0094: import java.io.ObjectInputStream;
0095: import java.io.ObjectOutputStream;
0096: import java.io.Serializable;
0097: import java.util.Arrays;
0098: import java.util.EventListener;
0099: import java.util.List;
0100:
0101: import javax.swing.event.EventListenerList;
0102:
0103: import org.jfree.chart.event.RendererChangeEvent;
0104: import org.jfree.chart.event.RendererChangeListener;
0105: import org.jfree.chart.labels.ItemLabelAnchor;
0106: import org.jfree.chart.labels.ItemLabelPosition;
0107: import org.jfree.chart.plot.DrawingSupplier;
0108: import org.jfree.chart.plot.PlotOrientation;
0109: import org.jfree.io.SerialUtilities;
0110: import org.jfree.ui.TextAnchor;
0111: import org.jfree.util.BooleanList;
0112: import org.jfree.util.BooleanUtilities;
0113: import org.jfree.util.ObjectList;
0114: import org.jfree.util.ObjectUtilities;
0115: import org.jfree.util.PaintList;
0116: import org.jfree.util.PaintUtilities;
0117: import org.jfree.util.ShapeList;
0118: import org.jfree.util.ShapeUtilities;
0119: import org.jfree.util.StrokeList;
0120:
0121: /**
0122: * Base class providing common services for renderers. Most methods that update
0123: * attributes of the renderer will fire a {@link RendererChangeEvent}, which
0124: * normally means the plot that owns the renderer will receive notification that
0125: * the renderer has been changed (the plot will, in turn, notify the chart).
0126: */
0127: public abstract class AbstractRenderer implements Cloneable,
0128: Serializable {
0129:
0130: /** For serialization. */
0131: private static final long serialVersionUID = -828267569428206075L;
0132:
0133: /** Zero represented as a <code>Double</code>. */
0134: public static final Double ZERO = new Double(0.0);
0135:
0136: /** The default paint. */
0137: public static final Paint DEFAULT_PAINT = Color.blue;
0138:
0139: /** The default outline paint. */
0140: public static final Paint DEFAULT_OUTLINE_PAINT = Color.gray;
0141:
0142: /** The default stroke. */
0143: public static final Stroke DEFAULT_STROKE = new BasicStroke(1.0f);
0144:
0145: /** The default outline stroke. */
0146: public static final Stroke DEFAULT_OUTLINE_STROKE = new BasicStroke(
0147: 1.0f);
0148:
0149: /** The default shape. */
0150: public static final Shape DEFAULT_SHAPE = new Rectangle2D.Double(
0151: -3.0, -3.0, 6.0, 6.0);
0152:
0153: /** The default value label font. */
0154: public static final Font DEFAULT_VALUE_LABEL_FONT = new Font(
0155: "SansSerif", Font.PLAIN, 10);
0156:
0157: /** The default value label paint. */
0158: public static final Paint DEFAULT_VALUE_LABEL_PAINT = Color.black;
0159:
0160: /**
0161: * A flag that controls the visibility of ALL series.
0162: *
0163: * @deprecated This field is redundant, you can rely on seriesVisibleList
0164: * and baseSeriesVisible. Deprecated from version 1.0.6 onwards.
0165: */
0166: private Boolean seriesVisible;
0167:
0168: /** A list of flags that controls whether or not each series is visible. */
0169: private BooleanList seriesVisibleList;
0170:
0171: /** The default visibility for each series. */
0172: private boolean baseSeriesVisible;
0173:
0174: /**
0175: * A flag that controls the visibility of ALL series in the legend.
0176: *
0177: * @deprecated This field is redundant, you can rely on
0178: * seriesVisibleInLegendList and baseSeriesVisibleInLegend.
0179: * Deprecated from version 1.0.6 onwards.
0180: */
0181: private Boolean seriesVisibleInLegend;
0182:
0183: /**
0184: * A list of flags that controls whether or not each series is visible in
0185: * the legend.
0186: */
0187: private BooleanList seriesVisibleInLegendList;
0188:
0189: /** The default visibility for each series in the legend. */
0190: private boolean baseSeriesVisibleInLegend;
0191:
0192: /**
0193: * The paint for ALL series (optional).
0194: *
0195: * @deprecated This field is redundant, you can rely on paintList and
0196: * basePaint. Deprecated from version 1.0.6 onwards.
0197: */
0198: private transient Paint paint;
0199:
0200: /** The paint list. */
0201: private PaintList paintList;
0202:
0203: /**
0204: * A flag that controls whether or not the paintList is auto-populated
0205: * in the {@link #lookupSeriesPaint(int)} method.
0206: *
0207: * @since 1.0.6
0208: */
0209: private boolean autoPopulateSeriesPaint;
0210:
0211: /** The base paint. */
0212: private transient Paint basePaint;
0213:
0214: /**
0215: * The fill paint for ALL series (optional).
0216: *
0217: * @deprecated This field is redundant, you can rely on fillPaintList and
0218: * baseFillPaint. Deprecated from version 1.0.6 onwards.
0219: */
0220: private transient Paint fillPaint;
0221:
0222: /** The fill paint list. */
0223: private PaintList fillPaintList;
0224:
0225: /**
0226: * A flag that controls whether or not the fillPaintList is auto-populated
0227: * in the {@link #lookupSeriesFillPaint(int)} method.
0228: *
0229: * @since 1.0.6
0230: */
0231: private boolean autoPopulateSeriesFillPaint;
0232:
0233: /** The base fill paint. */
0234: private transient Paint baseFillPaint;
0235:
0236: /**
0237: * The outline paint for ALL series (optional).
0238: *
0239: * @deprecated This field is redundant, you can rely on outlinePaintList and
0240: * baseOutlinePaint. Deprecated from version 1.0.6 onwards.
0241: */
0242: private transient Paint outlinePaint;
0243:
0244: /** The outline paint list. */
0245: private PaintList outlinePaintList;
0246:
0247: /**
0248: * A flag that controls whether or not the outlinePaintList is auto-populated
0249: * in the {@link #lookupSeriesOutlinePaint(int)} method.
0250: *
0251: * @since 1.0.6
0252: */
0253: private boolean autoPopulateSeriesOutlinePaint;
0254:
0255: /** The base outline paint. */
0256: private transient Paint baseOutlinePaint;
0257:
0258: /**
0259: * The stroke for ALL series (optional).
0260: *
0261: * @deprecated This field is redundant, you can rely on strokeList and
0262: * baseStroke. Deprecated from version 1.0.6 onwards.
0263: */
0264: private transient Stroke stroke;
0265:
0266: /** The stroke list. */
0267: private StrokeList strokeList;
0268:
0269: /**
0270: * A flag that controls whether or not the strokeList is auto-populated
0271: * in the {@link #lookupSeriesStroke(int)} method.
0272: *
0273: * @since 1.0.6
0274: */
0275: private boolean autoPopulateSeriesStroke;
0276:
0277: /** The base stroke. */
0278: private transient Stroke baseStroke;
0279:
0280: /**
0281: * The outline stroke for ALL series (optional).
0282: *
0283: * @deprecated This field is redundant, you can rely on strokeList and
0284: * baseStroke. Deprecated from version 1.0.6 onwards.
0285: */
0286: private transient Stroke outlineStroke;
0287:
0288: /** The outline stroke list. */
0289: private StrokeList outlineStrokeList;
0290:
0291: /** The base outline stroke. */
0292: private transient Stroke baseOutlineStroke;
0293:
0294: /**
0295: * A flag that controls whether or not the outlineStrokeList is
0296: * auto-populated in the {@link #lookupSeriesOutlineStroke(int)} method.
0297: *
0298: * @since 1.0.6
0299: */
0300: private boolean autoPopulateSeriesOutlineStroke;
0301:
0302: /**
0303: * The shape for ALL series (optional).
0304: *
0305: * @deprecated This field is redundant, you can rely on shapeList and
0306: * baseShape. Deprecated from version 1.0.6 onwards.
0307: */
0308: private transient Shape shape;
0309:
0310: /** A shape list. */
0311: private ShapeList shapeList;
0312:
0313: /**
0314: * A flag that controls whether or not the shapeList is auto-populated
0315: * in the {@link #lookupSeriesShape(int)} method.
0316: *
0317: * @since 1.0.6
0318: */
0319: private boolean autoPopulateSeriesShape;
0320:
0321: /** The base shape. */
0322: private transient Shape baseShape;
0323:
0324: /**
0325: * Visibility of the item labels for ALL series (optional).
0326: *
0327: * @deprecated This field is redundant, you can rely on
0328: * itemLabelsVisibleList and baseItemLabelsVisible. Deprecated from
0329: * version 1.0.6 onwards.
0330: */
0331: private Boolean itemLabelsVisible;
0332:
0333: /** Visibility of the item labels PER series. */
0334: private BooleanList itemLabelsVisibleList;
0335:
0336: /** The base item labels visible. */
0337: private Boolean baseItemLabelsVisible;
0338:
0339: /**
0340: * The item label font for ALL series (optional).
0341: *
0342: * @deprecated This field is redundant, you can rely on itemLabelFontList
0343: * and baseItemLabelFont. Deprecated from version 1.0.6 onwards.
0344: */
0345: private Font itemLabelFont;
0346:
0347: /** The item label font list (one font per series). */
0348: private ObjectList itemLabelFontList;
0349:
0350: /** The base item label font. */
0351: private Font baseItemLabelFont;
0352:
0353: /**
0354: * The item label paint for ALL series.
0355: *
0356: * @deprecated This field is redundant, you can rely on itemLabelPaintList
0357: * and baseItemLabelPaint. Deprecated from version 1.0.6 onwards.
0358: */
0359: private transient Paint itemLabelPaint;
0360:
0361: /** The item label paint list (one paint per series). */
0362: private PaintList itemLabelPaintList;
0363:
0364: /** The base item label paint. */
0365: private transient Paint baseItemLabelPaint;
0366:
0367: /**
0368: * The positive item label position for ALL series (optional).
0369: *
0370: * @deprecated This field is redundant, you can rely on the
0371: * positiveItemLabelPositionList and basePositiveItemLabelPosition
0372: * fields. Deprecated from version 1.0.6 onwards.
0373: */
0374: private ItemLabelPosition positiveItemLabelPosition;
0375:
0376: /** The positive item label position (per series). */
0377: private ObjectList positiveItemLabelPositionList;
0378:
0379: /** The fallback positive item label position. */
0380: private ItemLabelPosition basePositiveItemLabelPosition;
0381:
0382: /**
0383: * The negative item label position for ALL series (optional).
0384: *
0385: * @deprecated This field is redundant, you can rely on the
0386: * negativeItemLabelPositionList and baseNegativeItemLabelPosition
0387: * fields. Deprecated from version 1.0.6 onwards.
0388: */
0389: private ItemLabelPosition negativeItemLabelPosition;
0390:
0391: /** The negative item label position (per series). */
0392: private ObjectList negativeItemLabelPositionList;
0393:
0394: /** The fallback negative item label position. */
0395: private ItemLabelPosition baseNegativeItemLabelPosition;
0396:
0397: /** The item label anchor offset. */
0398: private double itemLabelAnchorOffset = 2.0;
0399:
0400: /**
0401: * A flag that controls whether or not entities are generated for
0402: * ALL series (optional).
0403: *
0404: * @deprecated This field is redundant, you can rely on the
0405: * createEntitiesList and baseCreateEntities fields. Deprecated from
0406: * version 1.0.6 onwards.
0407: */
0408: private Boolean createEntities;
0409:
0410: /**
0411: * Flags that control whether or not entities are generated for each
0412: * series. This will be overridden by 'createEntities'.
0413: */
0414: private BooleanList createEntitiesList;
0415:
0416: /**
0417: * The default flag that controls whether or not entities are generated.
0418: * This flag is used when both the above flags return null.
0419: */
0420: private boolean baseCreateEntities;
0421:
0422: /** Storage for registered change listeners. */
0423: private transient EventListenerList listenerList;
0424:
0425: /** An event for re-use. */
0426: private transient RendererChangeEvent event;
0427:
0428: /**
0429: * Default constructor.
0430: */
0431: public AbstractRenderer() {
0432:
0433: this .seriesVisible = null;
0434: this .seriesVisibleList = new BooleanList();
0435: this .baseSeriesVisible = true;
0436:
0437: this .seriesVisibleInLegend = null;
0438: this .seriesVisibleInLegendList = new BooleanList();
0439: this .baseSeriesVisibleInLegend = true;
0440:
0441: this .paint = null;
0442: this .paintList = new PaintList();
0443: this .basePaint = DEFAULT_PAINT;
0444: this .autoPopulateSeriesPaint = true;
0445:
0446: this .fillPaint = null;
0447: this .fillPaintList = new PaintList();
0448: this .baseFillPaint = Color.white;
0449: this .autoPopulateSeriesFillPaint = false;
0450:
0451: this .outlinePaint = null;
0452: this .outlinePaintList = new PaintList();
0453: this .baseOutlinePaint = DEFAULT_OUTLINE_PAINT;
0454: this .autoPopulateSeriesOutlinePaint = false;
0455:
0456: this .stroke = null;
0457: this .strokeList = new StrokeList();
0458: this .baseStroke = DEFAULT_STROKE;
0459: this .autoPopulateSeriesStroke = false;
0460:
0461: this .outlineStroke = null;
0462: this .outlineStrokeList = new StrokeList();
0463: this .baseOutlineStroke = DEFAULT_OUTLINE_STROKE;
0464: this .autoPopulateSeriesOutlineStroke = false;
0465:
0466: this .shape = null;
0467: this .shapeList = new ShapeList();
0468: this .baseShape = DEFAULT_SHAPE;
0469: this .autoPopulateSeriesShape = true;
0470:
0471: this .itemLabelsVisible = null;
0472: this .itemLabelsVisibleList = new BooleanList();
0473: this .baseItemLabelsVisible = Boolean.FALSE;
0474:
0475: this .itemLabelFont = null;
0476: this .itemLabelFontList = new ObjectList();
0477: this .baseItemLabelFont = new Font("SansSerif", Font.PLAIN, 10);
0478:
0479: this .itemLabelPaint = null;
0480: this .itemLabelPaintList = new PaintList();
0481: this .baseItemLabelPaint = Color.black;
0482:
0483: this .positiveItemLabelPosition = null;
0484: this .positiveItemLabelPositionList = new ObjectList();
0485: this .basePositiveItemLabelPosition = new ItemLabelPosition(
0486: ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
0487:
0488: this .negativeItemLabelPosition = null;
0489: this .negativeItemLabelPositionList = new ObjectList();
0490: this .baseNegativeItemLabelPosition = new ItemLabelPosition(
0491: ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
0492:
0493: this .createEntities = null;
0494: this .createEntitiesList = new BooleanList();
0495: this .baseCreateEntities = true;
0496:
0497: this .listenerList = new EventListenerList();
0498:
0499: }
0500:
0501: /**
0502: * Returns the drawing supplier from the plot.
0503: *
0504: * @return The drawing supplier.
0505: */
0506: public abstract DrawingSupplier getDrawingSupplier();
0507:
0508: // SERIES VISIBLE (not yet respected by all renderers)
0509:
0510: /**
0511: * Returns a boolean that indicates whether or not the specified item
0512: * should be drawn (this is typically used to hide an entire series).
0513: *
0514: * @param series the series index.
0515: * @param item the item index.
0516: *
0517: * @return A boolean.
0518: */
0519: public boolean getItemVisible(int series, int item) {
0520: return isSeriesVisible(series);
0521: }
0522:
0523: /**
0524: * Returns a boolean that indicates whether or not the specified series
0525: * should be drawn.
0526: *
0527: * @param series the series index.
0528: *
0529: * @return A boolean.
0530: */
0531: public boolean isSeriesVisible(int series) {
0532: boolean result = this .baseSeriesVisible;
0533: if (this .seriesVisible != null) {
0534: result = this .seriesVisible.booleanValue();
0535: } else {
0536: Boolean b = this .seriesVisibleList.getBoolean(series);
0537: if (b != null) {
0538: result = b.booleanValue();
0539: }
0540: }
0541: return result;
0542: }
0543:
0544: /**
0545: * Returns the flag that controls the visibility of ALL series. This flag
0546: * overrides the per series and default settings - you must set it to
0547: * <code>null</code> if you want the other settings to apply.
0548: *
0549: * @return The flag (possibly <code>null</code>).
0550: *
0551: * @see #setSeriesVisible(Boolean)
0552: *
0553: * @deprecated This method should no longer be used (as of version 1.0.6).
0554: * It is sufficient to rely on {@link #getSeriesVisible(int)} and
0555: * {@link #getBaseSeriesVisible()}.
0556: */
0557: public Boolean getSeriesVisible() {
0558: return this .seriesVisible;
0559: }
0560:
0561: /**
0562: * Sets the flag that controls the visibility of ALL series and sends a
0563: * {@link RendererChangeEvent} to all registered listeners. This flag
0564: * overrides the per series and default settings - you must set it to
0565: * <code>null</code> if you want the other settings to apply.
0566: *
0567: * @param visible the flag (<code>null</code> permitted).
0568: *
0569: * @see #getSeriesVisible()
0570: *
0571: * @deprecated This method should no longer be used (as of version 1.0.6).
0572: * It is sufficient to rely on {@link #setSeriesVisible(int, Boolean)}
0573: * and {@link #setBaseSeriesVisible(boolean)}.
0574: */
0575: public void setSeriesVisible(Boolean visible) {
0576: setSeriesVisible(visible, true);
0577: }
0578:
0579: /**
0580: * Sets the flag that controls the visibility of ALL series and sends a
0581: * {@link RendererChangeEvent} to all registered listeners. This flag
0582: * overrides the per series and default settings - you must set it to
0583: * <code>null</code> if you want the other settings to apply.
0584: *
0585: * @param visible the flag (<code>null</code> permitted).
0586: * @param notify notify listeners?
0587: *
0588: * @see #getSeriesVisible()
0589: *
0590: * @deprecated This method should no longer be used (as of version 1.0.6).
0591: * It is sufficient to rely on {@link #setSeriesVisible(int, Boolean)}
0592: * and {@link #setBaseSeriesVisible(boolean)}.
0593: */
0594: public void setSeriesVisible(Boolean visible, boolean notify) {
0595: this .seriesVisible = visible;
0596: if (notify) {
0597: fireChangeEvent();
0598: }
0599: }
0600:
0601: /**
0602: * Returns the flag that controls whether a series is visible.
0603: *
0604: * @param series the series index (zero-based).
0605: *
0606: * @return The flag (possibly <code>null</code>).
0607: *
0608: * @see #setSeriesVisible(int, Boolean)
0609: */
0610: public Boolean getSeriesVisible(int series) {
0611: return this .seriesVisibleList.getBoolean(series);
0612: }
0613:
0614: /**
0615: * Sets the flag that controls whether a series is visible and sends a
0616: * {@link RendererChangeEvent} to all registered listeners.
0617: *
0618: * @param series the series index (zero-based).
0619: * @param visible the flag (<code>null</code> permitted).
0620: *
0621: * @see #getSeriesVisible(int)
0622: */
0623: public void setSeriesVisible(int series, Boolean visible) {
0624: setSeriesVisible(series, visible, true);
0625: }
0626:
0627: /**
0628: * Sets the flag that controls whether a series is visible and, if
0629: * requested, sends a {@link RendererChangeEvent} to all registered
0630: * listeners.
0631: *
0632: * @param series the series index.
0633: * @param visible the flag (<code>null</code> permitted).
0634: * @param notify notify listeners?
0635: *
0636: * @see #getSeriesVisible(int)
0637: */
0638: public void setSeriesVisible(int series, Boolean visible,
0639: boolean notify) {
0640: this .seriesVisibleList.setBoolean(series, visible);
0641: if (notify) {
0642: fireChangeEvent();
0643: }
0644: }
0645:
0646: /**
0647: * Returns the base visibility for all series.
0648: *
0649: * @return The base visibility.
0650: *
0651: * @see #setBaseSeriesVisible(boolean)
0652: */
0653: public boolean getBaseSeriesVisible() {
0654: return this .baseSeriesVisible;
0655: }
0656:
0657: /**
0658: * Sets the base visibility and sends a {@link RendererChangeEvent}
0659: * to all registered listeners.
0660: *
0661: * @param visible the flag.
0662: *
0663: * @see #getBaseSeriesVisible()
0664: */
0665: public void setBaseSeriesVisible(boolean visible) {
0666: // defer argument checking...
0667: setBaseSeriesVisible(visible, true);
0668: }
0669:
0670: /**
0671: * Sets the base visibility and, if requested, sends
0672: * a {@link RendererChangeEvent} to all registered listeners.
0673: *
0674: * @param visible the visibility.
0675: * @param notify notify listeners?
0676: *
0677: * @see #getBaseSeriesVisible()
0678: */
0679: public void setBaseSeriesVisible(boolean visible, boolean notify) {
0680: this .baseSeriesVisible = visible;
0681: if (notify) {
0682: fireChangeEvent();
0683: }
0684: }
0685:
0686: // SERIES VISIBLE IN LEGEND (not yet respected by all renderers)
0687:
0688: /**
0689: * Returns <code>true</code> if the series should be shown in the legend,
0690: * and <code>false</code> otherwise.
0691: *
0692: * @param series the series index.
0693: *
0694: * @return A boolean.
0695: */
0696: public boolean isSeriesVisibleInLegend(int series) {
0697: boolean result = this .baseSeriesVisibleInLegend;
0698: if (this .seriesVisibleInLegend != null) {
0699: result = this .seriesVisibleInLegend.booleanValue();
0700: } else {
0701: Boolean b = this .seriesVisibleInLegendList
0702: .getBoolean(series);
0703: if (b != null) {
0704: result = b.booleanValue();
0705: }
0706: }
0707: return result;
0708: }
0709:
0710: /**
0711: * Returns the flag that controls the visibility of ALL series in the
0712: * legend. This flag overrides the per series and default settings - you
0713: * must set it to <code>null</code> if you want the other settings to
0714: * apply.
0715: *
0716: * @return The flag (possibly <code>null</code>).
0717: *
0718: * @see #setSeriesVisibleInLegend(Boolean)
0719: *
0720: * @deprecated This method should no longer be used (as of version 1.0.6).
0721: * It is sufficient to rely on {@link #getSeriesVisibleInLegend(int)}
0722: * and {@link #getBaseSeriesVisibleInLegend()}.
0723: */
0724: public Boolean getSeriesVisibleInLegend() {
0725: return this .seriesVisibleInLegend;
0726: }
0727:
0728: /**
0729: * Sets the flag that controls the visibility of ALL series in the legend
0730: * and sends a {@link RendererChangeEvent} to all registered listeners.
0731: * This flag overrides the per series and default settings - you must set
0732: * it to <code>null</code> if you want the other settings to apply.
0733: *
0734: * @param visible the flag (<code>null</code> permitted).
0735: *
0736: * @see #getSeriesVisibleInLegend()
0737: *
0738: * @deprecated This method should no longer be used (as of version 1.0.6).
0739: * It is sufficient to rely on {@link #setSeriesVisibleInLegend(int,
0740: * Boolean)} and {@link #setBaseSeriesVisibleInLegend(boolean)}.
0741: */
0742: public void setSeriesVisibleInLegend(Boolean visible) {
0743: setSeriesVisibleInLegend(visible, true);
0744: }
0745:
0746: /**
0747: * Sets the flag that controls the visibility of ALL series in the legend
0748: * and sends a {@link RendererChangeEvent} to all registered listeners.
0749: * This flag overrides the per series and default settings - you must set
0750: * it to <code>null</code> if you want the other settings to apply.
0751: *
0752: * @param visible the flag (<code>null</code> permitted).
0753: * @param notify notify listeners?
0754: *
0755: * @see #getSeriesVisibleInLegend()
0756: *
0757: * @deprecated This method should no longer be used (as of version 1.0.6).
0758: * It is sufficient to rely on {@link #setSeriesVisibleInLegend(int,
0759: * Boolean, boolean)} and {@link #setBaseSeriesVisibleInLegend(boolean,
0760: * boolean)}.
0761: */
0762: public void setSeriesVisibleInLegend(Boolean visible, boolean notify) {
0763: this .seriesVisibleInLegend = visible;
0764: if (notify) {
0765: fireChangeEvent();
0766: }
0767: }
0768:
0769: /**
0770: * Returns the flag that controls whether a series is visible in the
0771: * legend. This method returns only the "per series" settings - to
0772: * incorporate the override and base settings as well, you need to use the
0773: * {@link #isSeriesVisibleInLegend(int)} method.
0774: *
0775: * @param series the series index (zero-based).
0776: *
0777: * @return The flag (possibly <code>null</code>).
0778: *
0779: * @see #setSeriesVisibleInLegend(int, Boolean)
0780: */
0781: public Boolean getSeriesVisibleInLegend(int series) {
0782: return this .seriesVisibleInLegendList.getBoolean(series);
0783: }
0784:
0785: /**
0786: * Sets the flag that controls whether a series is visible in the legend
0787: * and sends a {@link RendererChangeEvent} to all registered listeners.
0788: *
0789: * @param series the series index (zero-based).
0790: * @param visible the flag (<code>null</code> permitted).
0791: *
0792: * @see #getSeriesVisibleInLegend(int)
0793: */
0794: public void setSeriesVisibleInLegend(int series, Boolean visible) {
0795: setSeriesVisibleInLegend(series, visible, true);
0796: }
0797:
0798: /**
0799: * Sets the flag that controls whether a series is visible in the legend
0800: * and, if requested, sends a {@link RendererChangeEvent} to all registered
0801: * listeners.
0802: *
0803: * @param series the series index.
0804: * @param visible the flag (<code>null</code> permitted).
0805: * @param notify notify listeners?
0806: *
0807: * @see #getSeriesVisibleInLegend(int)
0808: */
0809: public void setSeriesVisibleInLegend(int series, Boolean visible,
0810: boolean notify) {
0811: this .seriesVisibleInLegendList.setBoolean(series, visible);
0812: if (notify) {
0813: fireChangeEvent();
0814: }
0815: }
0816:
0817: /**
0818: * Returns the base visibility in the legend for all series.
0819: *
0820: * @return The base visibility.
0821: *
0822: * @see #setBaseSeriesVisibleInLegend(boolean)
0823: */
0824: public boolean getBaseSeriesVisibleInLegend() {
0825: return this .baseSeriesVisibleInLegend;
0826: }
0827:
0828: /**
0829: * Sets the base visibility in the legend and sends a
0830: * {@link RendererChangeEvent} to all registered listeners.
0831: *
0832: * @param visible the flag.
0833: *
0834: * @see #getSeriesVisibleInLegend()
0835: */
0836: public void setBaseSeriesVisibleInLegend(boolean visible) {
0837: // defer argument checking...
0838: setBaseSeriesVisibleInLegend(visible, true);
0839: }
0840:
0841: /**
0842: * Sets the base visibility in the legend and, if requested, sends
0843: * a {@link RendererChangeEvent} to all registered listeners.
0844: *
0845: * @param visible the visibility.
0846: * @param notify notify listeners?
0847: *
0848: * @see #getSeriesVisibleInLegend()
0849: */
0850: public void setBaseSeriesVisibleInLegend(boolean visible,
0851: boolean notify) {
0852: this .baseSeriesVisibleInLegend = visible;
0853: if (notify) {
0854: fireChangeEvent();
0855: }
0856: }
0857:
0858: // PAINT
0859:
0860: /**
0861: * Returns the paint used to fill data items as they are drawn.
0862: * <p>
0863: * The default implementation passes control to the
0864: * <code>getSeriesPaint</code> method. You can override this method if you
0865: * require different behaviour.
0866: *
0867: * @param row the row (or series) index (zero-based).
0868: * @param column the column (or category) index (zero-based).
0869: *
0870: * @return The paint (never <code>null</code>).
0871: */
0872: public Paint getItemPaint(int row, int column) {
0873: return lookupSeriesPaint(row);
0874: }
0875:
0876: /**
0877: * Returns the paint used to fill an item drawn by the renderer.
0878: *
0879: * @param series the series index (zero-based).
0880: *
0881: * @return The paint (never <code>null</code>).
0882: *
0883: * @since 1.0.6
0884: */
0885: public Paint lookupSeriesPaint(int series) {
0886:
0887: // return the override, if there is one...
0888: if (this .paint != null) {
0889: return this .paint;
0890: }
0891:
0892: // otherwise look up the paint list
0893: Paint seriesPaint = this .paintList.getPaint(series);
0894: if (seriesPaint == null && this .autoPopulateSeriesPaint) {
0895: DrawingSupplier supplier = getDrawingSupplier();
0896: if (supplier != null) {
0897: seriesPaint = supplier.getNextPaint();
0898: this .paintList.setPaint(series, seriesPaint);
0899: }
0900: }
0901: if (seriesPaint == null) {
0902: seriesPaint = this .basePaint;
0903: }
0904: return seriesPaint;
0905:
0906: }
0907:
0908: /**
0909: * Sets the paint to be used for ALL series, and sends a
0910: * {@link RendererChangeEvent} to all registered listeners. If this is
0911: * <code>null</code>, the renderer will use the paint for the series.
0912: *
0913: * @param paint the paint (<code>null</code> permitted).
0914: *
0915: * @deprecated This method should no longer be used (as of version 1.0.6).
0916: * It is sufficient to rely on {@link #setSeriesPaint(int, Paint)} and
0917: * {@link #setBasePaint(Paint)}.
0918: */
0919: public void setPaint(Paint paint) {
0920: setPaint(paint, true);
0921: }
0922:
0923: /**
0924: * Sets the paint to be used for all series and, if requested, sends a
0925: * {@link RendererChangeEvent} to all registered listeners.
0926: *
0927: * @param paint the paint (<code>null</code> permitted).
0928: * @param notify notify listeners?
0929: *
0930: * @deprecated This method should no longer be used (as of version 1.0.6).
0931: * It is sufficient to rely on {@link #setSeriesPaint(int, Paint,
0932: * boolean)} and {@link #setBasePaint(Paint, boolean)}.
0933: */
0934: public void setPaint(Paint paint, boolean notify) {
0935: this .paint = paint;
0936: if (notify) {
0937: fireChangeEvent();
0938: }
0939: }
0940:
0941: /**
0942: * Returns the paint used to fill an item drawn by the renderer.
0943: *
0944: * @param series the series index (zero-based).
0945: *
0946: * @return The paint (possibly <code>null</code>).
0947: *
0948: * @see #setSeriesPaint(int, Paint)
0949: */
0950: public Paint getSeriesPaint(int series) {
0951: return this .paintList.getPaint(series);
0952: }
0953:
0954: /**
0955: * Sets the paint used for a series and sends a {@link RendererChangeEvent}
0956: * to all registered listeners.
0957: *
0958: * @param series the series index (zero-based).
0959: * @param paint the paint (<code>null</code> permitted).
0960: *
0961: * @see #getSeriesPaint(int)
0962: */
0963: public void setSeriesPaint(int series, Paint paint) {
0964: setSeriesPaint(series, paint, true);
0965: }
0966:
0967: /**
0968: * Sets the paint used for a series and, if requested, sends a
0969: * {@link RendererChangeEvent} to all registered listeners.
0970: *
0971: * @param series the series index.
0972: * @param paint the paint (<code>null</code> permitted).
0973: * @param notify notify listeners?
0974: *
0975: * @see #getSeriesPaint(int)
0976: */
0977: public void setSeriesPaint(int series, Paint paint, boolean notify) {
0978: this .paintList.setPaint(series, paint);
0979: if (notify) {
0980: fireChangeEvent();
0981: }
0982: }
0983:
0984: /**
0985: * Returns the base paint.
0986: *
0987: * @return The base paint (never <code>null</code>).
0988: *
0989: * @see #setBasePaint(Paint)
0990: */
0991: public Paint getBasePaint() {
0992: return this .basePaint;
0993: }
0994:
0995: /**
0996: * Sets the base paint and sends a {@link RendererChangeEvent} to all
0997: * registered listeners.
0998: *
0999: * @param paint the paint (<code>null</code> not permitted).
1000: *
1001: * @see #getBasePaint()
1002: */
1003: public void setBasePaint(Paint paint) {
1004: // defer argument checking...
1005: setBasePaint(paint, true);
1006: }
1007:
1008: /**
1009: * Sets the base paint and, if requested, sends a
1010: * {@link RendererChangeEvent} to all registered listeners.
1011: *
1012: * @param paint the paint (<code>null</code> not permitted).
1013: * @param notify notify listeners?
1014: *
1015: * @see #getBasePaint()
1016: */
1017: public void setBasePaint(Paint paint, boolean notify) {
1018: this .basePaint = paint;
1019: if (notify) {
1020: fireChangeEvent();
1021: }
1022: }
1023:
1024: /**
1025: * Returns the flag that controls whether or not the series paint list is
1026: * automatically populated when {@link #lookupSeriesPaint(int)} is called.
1027: *
1028: * @return A boolean.
1029: *
1030: * @since 1.0.6
1031: *
1032: * @see #setAutoPopulateSeriesPaint(boolean)
1033: */
1034: public boolean getAutoPopulateSeriesPaint() {
1035: return this .autoPopulateSeriesPaint;
1036: }
1037:
1038: /**
1039: * Sets the flag that controls whether or not the series paint list is
1040: * automatically populated when {@link #lookupSeriesPaint(int)} is called.
1041: *
1042: * @param auto the new flag value.
1043: *
1044: * @since 1.0.6
1045: *
1046: * @see #getAutoPopulateSeriesPaint()
1047: */
1048: public void setAutoPopulateSeriesPaint(boolean auto) {
1049: this .autoPopulateSeriesPaint = auto;
1050: }
1051:
1052: //// FILL PAINT //////////////////////////////////////////////////////////
1053:
1054: /**
1055: * Returns the paint used to fill data items as they are drawn. The
1056: * default implementation passes control to the
1057: * {@link #lookupSeriesFillPaint(int)} method - you can override this
1058: * method if you require different behaviour.
1059: *
1060: * @param row the row (or series) index (zero-based).
1061: * @param column the column (or category) index (zero-based).
1062: *
1063: * @return The paint (never <code>null</code>).
1064: */
1065: public Paint getItemFillPaint(int row, int column) {
1066: return lookupSeriesFillPaint(row);
1067: }
1068:
1069: /**
1070: * Returns the paint used to fill an item drawn by the renderer.
1071: *
1072: * @param series the series (zero-based index).
1073: *
1074: * @return The paint (never <code>null</code>).
1075: *
1076: * @since 1.0.6
1077: */
1078: public Paint lookupSeriesFillPaint(int series) {
1079:
1080: // return the override, if there is one...
1081: if (this .fillPaint != null) {
1082: return this .fillPaint;
1083: }
1084:
1085: // otherwise look up the paint table
1086: Paint seriesFillPaint = this .fillPaintList.getPaint(series);
1087: if (seriesFillPaint == null && this .autoPopulateSeriesFillPaint) {
1088: DrawingSupplier supplier = getDrawingSupplier();
1089: if (supplier != null) {
1090: seriesFillPaint = supplier.getNextFillPaint();
1091: this .fillPaintList.setPaint(series, seriesFillPaint);
1092: }
1093: }
1094: if (seriesFillPaint == null) {
1095: seriesFillPaint = this .baseFillPaint;
1096: }
1097: return seriesFillPaint;
1098:
1099: }
1100:
1101: /**
1102: * Returns the paint used to fill an item drawn by the renderer.
1103: *
1104: * @param series the series (zero-based index).
1105: *
1106: * @return The paint (never <code>null</code>).
1107: */
1108: public Paint getSeriesFillPaint(int series) {
1109: return this .fillPaintList.getPaint(series);
1110: }
1111:
1112: /**
1113: * Sets the paint used for a series fill and sends a
1114: * {@link RendererChangeEvent} to all registered listeners.
1115: *
1116: * @param series the series index (zero-based).
1117: * @param paint the paint (<code>null</code> permitted).
1118: */
1119: public void setSeriesFillPaint(int series, Paint paint) {
1120: setSeriesFillPaint(series, paint, true);
1121: }
1122:
1123: /**
1124: * Sets the paint used to fill a series and, if requested,
1125: * sends a {@link RendererChangeEvent} to all registered listeners.
1126: *
1127: * @param series the series index (zero-based).
1128: * @param paint the paint (<code>null</code> permitted).
1129: * @param notify notify listeners?
1130: */
1131: public void setSeriesFillPaint(int series, Paint paint,
1132: boolean notify) {
1133: this .fillPaintList.setPaint(series, paint);
1134: if (notify) {
1135: fireChangeEvent();
1136: }
1137: }
1138:
1139: /**
1140: * Sets the fill paint for ALL series (optional).
1141: *
1142: * @param paint the paint (<code>null</code> permitted).
1143: *
1144: * @deprecated This method should no longer be used (as of version 1.0.6).
1145: * It is sufficient to rely on {@link #setSeriesFillPaint(int, Paint)}
1146: * and {@link #setBaseFillPaint(Paint)}.
1147: */
1148: public void setFillPaint(Paint paint) {
1149: setFillPaint(paint, true);
1150: }
1151:
1152: /**
1153: * Sets the fill paint for ALL series and, if requested, sends a
1154: * {@link RendererChangeEvent} to all registered listeners.
1155: *
1156: * @param paint the paint (<code>null</code> permitted).
1157: * @param notify notify listeners?
1158: *
1159: * @deprecated This method should no longer be used (as of version 1.0.6).
1160: * It is sufficient to rely on {@link #setSeriesFillPaint(int, Paint,
1161: * boolean)} and {@link #setBaseFillPaint(Paint, boolean)}.
1162: */
1163: public void setFillPaint(Paint paint, boolean notify) {
1164: this .fillPaint = paint;
1165: if (notify) {
1166: fireChangeEvent();
1167: }
1168: }
1169:
1170: /**
1171: * Returns the base fill paint.
1172: *
1173: * @return The paint (never <code>null</code>).
1174: *
1175: * @see #setBaseFillPaint(Paint)
1176: */
1177: public Paint getBaseFillPaint() {
1178: return this .baseFillPaint;
1179: }
1180:
1181: /**
1182: * Sets the base fill paint and sends a {@link RendererChangeEvent} to
1183: * all registered listeners.
1184: *
1185: * @param paint the paint (<code>null</code> not permitted).
1186: *
1187: * @see #getBaseFillPaint()
1188: */
1189: public void setBaseFillPaint(Paint paint) {
1190: // defer argument checking...
1191: setBaseFillPaint(paint, true);
1192: }
1193:
1194: /**
1195: * Sets the base fill paint and, if requested, sends a
1196: * {@link RendererChangeEvent} to all registered listeners.
1197: *
1198: * @param paint the paint (<code>null</code> not permitted).
1199: * @param notify notify listeners?
1200: *
1201: * @see #getBaseFillPaint()
1202: */
1203: public void setBaseFillPaint(Paint paint, boolean notify) {
1204: if (paint == null) {
1205: throw new IllegalArgumentException("Null 'paint' argument.");
1206: }
1207: this .baseFillPaint = paint;
1208: if (notify) {
1209: fireChangeEvent();
1210: }
1211: }
1212:
1213: /**
1214: * Returns the flag that controls whether or not the series fill paint list
1215: * is automatically populated when {@link #lookupSeriesFillPaint(int)} is
1216: * called.
1217: *
1218: * @return A boolean.
1219: *
1220: * @since 1.0.6
1221: *
1222: * @see #setAutoPopulateSeriesFillPaint(boolean)
1223: */
1224: public boolean getAutoPopulateSeriesFillPaint() {
1225: return this .autoPopulateSeriesFillPaint;
1226: }
1227:
1228: /**
1229: * Sets the flag that controls whether or not the series fill paint list is
1230: * automatically populated when {@link #lookupSeriesFillPaint(int)} is called.
1231: *
1232: * @param auto the new flag value.
1233: *
1234: * @since 1.0.6
1235: *
1236: * @see #getAutoPopulateSeriesFillPaint()
1237: */
1238: public void setAutoPopulateSeriesFillPaint(boolean auto) {
1239: this .autoPopulateSeriesFillPaint = auto;
1240: }
1241:
1242: // OUTLINE PAINT //////////////////////////////////////////////////////////
1243:
1244: /**
1245: * Returns the paint used to outline data items as they are drawn.
1246: * <p>
1247: * The default implementation passes control to the
1248: * {@link #lookupSeriesOutlinePaint} method. You can override this method
1249: * if you require different behaviour.
1250: *
1251: * @param row the row (or series) index (zero-based).
1252: * @param column the column (or category) index (zero-based).
1253: *
1254: * @return The paint (never <code>null</code>).
1255: */
1256: public Paint getItemOutlinePaint(int row, int column) {
1257: return lookupSeriesOutlinePaint(row);
1258: }
1259:
1260: /**
1261: * Returns the paint used to outline an item drawn by the renderer.
1262: *
1263: * @param series the series (zero-based index).
1264: *
1265: * @return The paint (never <code>null</code>).
1266: *
1267: * @since 1.0.6
1268: */
1269: public Paint lookupSeriesOutlinePaint(int series) {
1270:
1271: // return the override, if there is one...
1272: if (this .outlinePaint != null) {
1273: return this .outlinePaint;
1274: }
1275:
1276: // otherwise look up the paint table
1277: Paint seriesOutlinePaint = this .outlinePaintList
1278: .getPaint(series);
1279: if (seriesOutlinePaint == null
1280: && this .autoPopulateSeriesOutlinePaint) {
1281: DrawingSupplier supplier = getDrawingSupplier();
1282: if (supplier != null) {
1283: seriesOutlinePaint = supplier.getNextOutlinePaint();
1284: this .outlinePaintList.setPaint(series,
1285: seriesOutlinePaint);
1286: }
1287: }
1288: if (seriesOutlinePaint == null) {
1289: seriesOutlinePaint = this .baseOutlinePaint;
1290: }
1291: return seriesOutlinePaint;
1292:
1293: }
1294:
1295: /**
1296: * Returns the paint used to outline an item drawn by the renderer.
1297: *
1298: * @param series the series (zero-based index).
1299: *
1300: * @return The paint (possibly <code>null</code>).
1301: */
1302: public Paint getSeriesOutlinePaint(int series) {
1303: return this .outlinePaintList.getPaint(series);
1304: }
1305:
1306: /**
1307: * Sets the paint used for a series outline and sends a
1308: * {@link RendererChangeEvent} to all registered listeners.
1309: *
1310: * @param series the series index (zero-based).
1311: * @param paint the paint (<code>null</code> permitted).
1312: */
1313: public void setSeriesOutlinePaint(int series, Paint paint) {
1314: setSeriesOutlinePaint(series, paint, true);
1315: }
1316:
1317: /**
1318: * Sets the paint used to draw the outline for a series and, if requested,
1319: * sends a {@link RendererChangeEvent} to all registered listeners.
1320: *
1321: * @param series the series index (zero-based).
1322: * @param paint the paint (<code>null</code> permitted).
1323: * @param notify notify listeners?
1324: */
1325: public void setSeriesOutlinePaint(int series, Paint paint,
1326: boolean notify) {
1327: this .outlinePaintList.setPaint(series, paint);
1328: if (notify) {
1329: fireChangeEvent();
1330: }
1331: }
1332:
1333: /**
1334: * Sets the outline paint for ALL series (optional).
1335: *
1336: * @param paint the paint (<code>null</code> permitted).
1337: *
1338: * @deprecated This method should no longer be used (as of version 1.0.6).
1339: * It is sufficient to rely on {@link #setSeriesOutlinePaint(int,
1340: * Paint)} and {@link #setBaseOutlinePaint(Paint)}.
1341: */
1342: public void setOutlinePaint(Paint paint) {
1343: setOutlinePaint(paint, true);
1344: }
1345:
1346: /**
1347: * Sets the outline paint for ALL series and, if requested, sends a
1348: * {@link RendererChangeEvent} to all registered listeners.
1349: *
1350: * @param paint the paint (<code>null</code> permitted).
1351: * @param notify notify listeners?
1352: *
1353: * @deprecated This method should no longer be used (as of version 1.0.6).
1354: * It is sufficient to rely on {@link #setSeriesOutlinePaint(int, Paint,
1355: * boolean)} and {@link #setBaseOutlinePaint(Paint, boolean)}.
1356: */
1357: public void setOutlinePaint(Paint paint, boolean notify) {
1358: this .outlinePaint = paint;
1359: if (notify) {
1360: fireChangeEvent();
1361: }
1362: }
1363:
1364: /**
1365: * Returns the base outline paint.
1366: *
1367: * @return The paint (never <code>null</code>).
1368: */
1369: public Paint getBaseOutlinePaint() {
1370: return this .baseOutlinePaint;
1371: }
1372:
1373: /**
1374: * Sets the base outline paint and sends a {@link RendererChangeEvent} to
1375: * all registered listeners.
1376: *
1377: * @param paint the paint (<code>null</code> not permitted).
1378: */
1379: public void setBaseOutlinePaint(Paint paint) {
1380: // defer argument checking...
1381: setBaseOutlinePaint(paint, true);
1382: }
1383:
1384: /**
1385: * Sets the base outline paint and, if requested, sends a
1386: * {@link RendererChangeEvent} to all registered listeners.
1387: *
1388: * @param paint the paint (<code>null</code> not permitted).
1389: * @param notify notify listeners?
1390: */
1391: public void setBaseOutlinePaint(Paint paint, boolean notify) {
1392: if (paint == null) {
1393: throw new IllegalArgumentException("Null 'paint' argument.");
1394: }
1395: this .baseOutlinePaint = paint;
1396: if (notify) {
1397: fireChangeEvent();
1398: }
1399: }
1400:
1401: /**
1402: * Returns the flag that controls whether or not the series outline paint
1403: * list is automatically populated when
1404: * {@link #lookupSeriesOutlinePaint(int)} is called.
1405: *
1406: * @return A boolean.
1407: *
1408: * @since 1.0.6
1409: *
1410: * @see #setAutoPopulateSeriesOutlinePaint(boolean)
1411: */
1412: public boolean getAutoPopulateSeriesOutlinePaint() {
1413: return this .autoPopulateSeriesOutlinePaint;
1414: }
1415:
1416: /**
1417: * Sets the flag that controls whether or not the series outline paint list
1418: * is automatically populated when {@link #lookupSeriesOutlinePaint(int)}
1419: * is called.
1420: *
1421: * @param auto the new flag value.
1422: *
1423: * @since 1.0.6
1424: *
1425: * @see #getAutoPopulateSeriesOutlinePaint()
1426: */
1427: public void setAutoPopulateSeriesOutlinePaint(boolean auto) {
1428: this .autoPopulateSeriesOutlinePaint = auto;
1429: }
1430:
1431: // STROKE
1432:
1433: /**
1434: * Returns the stroke used to draw data items.
1435: * <p>
1436: * The default implementation passes control to the getSeriesStroke method.
1437: * You can override this method if you require different behaviour.
1438: *
1439: * @param row the row (or series) index (zero-based).
1440: * @param column the column (or category) index (zero-based).
1441: *
1442: * @return The stroke (never <code>null</code>).
1443: */
1444: public Stroke getItemStroke(int row, int column) {
1445: return lookupSeriesStroke(row);
1446: }
1447:
1448: /**
1449: * Returns the stroke used to draw the items in a series.
1450: *
1451: * @param series the series (zero-based index).
1452: *
1453: * @return The stroke (never <code>null</code>).
1454: *
1455: * @since 1.0.6
1456: */
1457: public Stroke lookupSeriesStroke(int series) {
1458:
1459: // return the override, if there is one...
1460: if (this .stroke != null) {
1461: return this .stroke;
1462: }
1463:
1464: // otherwise look up the paint table
1465: Stroke result = this .strokeList.getStroke(series);
1466: if (result == null && this .autoPopulateSeriesStroke) {
1467: DrawingSupplier supplier = getDrawingSupplier();
1468: if (supplier != null) {
1469: result = supplier.getNextStroke();
1470: this .strokeList.setStroke(series, result);
1471: }
1472: }
1473: if (result == null) {
1474: result = this .baseStroke;
1475: }
1476: return result;
1477:
1478: }
1479:
1480: /**
1481: * Sets the stroke for ALL series and sends a {@link RendererChangeEvent}
1482: * to all registered listeners.
1483: *
1484: * @param stroke the stroke (<code>null</code> permitted).
1485: *
1486: * @deprecated This method should no longer be used (as of version 1.0.6).
1487: * It is sufficient to rely on {@link #setSeriesStroke(int, Stroke)}
1488: * and {@link #setBaseStroke(Stroke)}.
1489: */
1490: public void setStroke(Stroke stroke) {
1491: setStroke(stroke, true);
1492: }
1493:
1494: /**
1495: * Sets the stroke for ALL series and, if requested, sends a
1496: * {@link RendererChangeEvent} to all registered listeners.
1497: *
1498: * @param stroke the stroke (<code>null</code> permitted).
1499: * @param notify notify listeners?
1500: *
1501: * @deprecated This method should no longer be used (as of version 1.0.6).
1502: * It is sufficient to rely on {@link #setSeriesStroke(int, Stroke,
1503: * boolean)} and {@link #setBaseStroke(Stroke, boolean)}.
1504: */
1505: public void setStroke(Stroke stroke, boolean notify) {
1506: this .stroke = stroke;
1507: if (notify) {
1508: fireChangeEvent();
1509: }
1510: }
1511:
1512: /**
1513: * Returns the stroke used to draw the items in a series.
1514: *
1515: * @param series the series (zero-based index).
1516: *
1517: * @return The stroke (possibly <code>null</code>).
1518: */
1519: public Stroke getSeriesStroke(int series) {
1520: return this .strokeList.getStroke(series);
1521: }
1522:
1523: /**
1524: * Sets the stroke used for a series and sends a {@link RendererChangeEvent}
1525: * to all registered listeners.
1526: *
1527: * @param series the series index (zero-based).
1528: * @param stroke the stroke (<code>null</code> permitted).
1529: */
1530: public void setSeriesStroke(int series, Stroke stroke) {
1531: setSeriesStroke(series, stroke, true);
1532: }
1533:
1534: /**
1535: * Sets the stroke for a series and, if requested, sends a
1536: * {@link RendererChangeEvent} to all registered listeners.
1537: *
1538: * @param series the series index (zero-based).
1539: * @param stroke the stroke (<code>null</code> permitted).
1540: * @param notify notify listeners?
1541: */
1542: public void setSeriesStroke(int series, Stroke stroke,
1543: boolean notify) {
1544: this .strokeList.setStroke(series, stroke);
1545: if (notify) {
1546: fireChangeEvent();
1547: }
1548: }
1549:
1550: /**
1551: * Returns the base stroke.
1552: *
1553: * @return The base stroke (never <code>null</code>).
1554: */
1555: public Stroke getBaseStroke() {
1556: return this .baseStroke;
1557: }
1558:
1559: /**
1560: * Sets the base stroke.
1561: *
1562: * @param stroke the stroke (<code>null</code> not permitted).
1563: */
1564: public void setBaseStroke(Stroke stroke) {
1565: // defer argument checking...
1566: setBaseStroke(stroke, true);
1567: }
1568:
1569: /**
1570: * Sets the base stroke and, if requested, sends a
1571: * {@link RendererChangeEvent} to all registered listeners.
1572: *
1573: * @param stroke the stroke (<code>null</code> not permitted).
1574: * @param notify notify listeners?
1575: */
1576: public void setBaseStroke(Stroke stroke, boolean notify) {
1577: if (stroke == null) {
1578: throw new IllegalArgumentException(
1579: "Null 'stroke' argument.");
1580: }
1581: this .baseStroke = stroke;
1582: if (notify) {
1583: fireChangeEvent();
1584: }
1585: }
1586:
1587: /**
1588: * Returns the flag that controls whether or not the series stroke list is
1589: * automatically populated when {@link #lookupSeriesStroke(int)} is called.
1590: *
1591: * @return A boolean.
1592: *
1593: * @since 1.0.6
1594: *
1595: * @see #setAutoPopulateSeriesStroke(boolean)
1596: */
1597: public boolean getAutoPopulateSeriesStroke() {
1598: return this .autoPopulateSeriesStroke;
1599: }
1600:
1601: /**
1602: * Sets the flag that controls whether or not the series stroke list is
1603: * automatically populated when {@link #lookupSeriesStroke(int)} is called.
1604: *
1605: * @param auto the new flag value.
1606: *
1607: * @since 1.0.6
1608: *
1609: * @see #getAutoPopulateSeriesStroke()
1610: */
1611: public void setAutoPopulateSeriesStroke(boolean auto) {
1612: this .autoPopulateSeriesStroke = auto;
1613: }
1614:
1615: // OUTLINE STROKE
1616:
1617: /**
1618: * Returns the stroke used to outline data items. The default
1619: * implementation passes control to the
1620: * {@link #lookupSeriesOutlineStroke(int)} method. You can override this
1621: * method if you require different behaviour.
1622: *
1623: * @param row the row (or series) index (zero-based).
1624: * @param column the column (or category) index (zero-based).
1625: *
1626: * @return The stroke (never <code>null</code>).
1627: */
1628: public Stroke getItemOutlineStroke(int row, int column) {
1629: return lookupSeriesOutlineStroke(row);
1630: }
1631:
1632: /**
1633: * Returns the stroke used to outline the items in a series.
1634: *
1635: * @param series the series (zero-based index).
1636: *
1637: * @return The stroke (never <code>null</code>).
1638: *
1639: * @since 1.0.6
1640: */
1641: public Stroke lookupSeriesOutlineStroke(int series) {
1642:
1643: // return the override, if there is one...
1644: if (this .outlineStroke != null) {
1645: return this .outlineStroke;
1646: }
1647:
1648: // otherwise look up the stroke table
1649: Stroke result = this .outlineStrokeList.getStroke(series);
1650: if (result == null && this .autoPopulateSeriesOutlineStroke) {
1651: DrawingSupplier supplier = getDrawingSupplier();
1652: if (supplier != null) {
1653: result = supplier.getNextOutlineStroke();
1654: this .outlineStrokeList.setStroke(series, result);
1655: }
1656: }
1657: if (result == null) {
1658: result = this .baseOutlineStroke;
1659: }
1660: return result;
1661:
1662: }
1663:
1664: /**
1665: * Sets the outline stroke for ALL series and sends a
1666: * {@link RendererChangeEvent} to all registered listeners.
1667: *
1668: * @param stroke the stroke (<code>null</code> permitted).
1669: *
1670: * @deprecated This method should no longer be used (as of version 1.0.6).
1671: * It is sufficient to rely on {@link #setSeriesOutlineStroke(int,
1672: * Stroke)} and {@link #setBaseOutlineStroke(Stroke)}.
1673: */
1674: public void setOutlineStroke(Stroke stroke) {
1675: setOutlineStroke(stroke, true);
1676: }
1677:
1678: /**
1679: * Sets the outline stroke for ALL series and, if requested, sends a
1680: * {@link RendererChangeEvent} to all registered listeners.
1681: *
1682: * @param stroke the stroke (<code>null</code> permitted).
1683: * @param notify notify listeners?
1684: *
1685: * @deprecated This method should no longer be used (as of version 1.0.6).
1686: * It is sufficient to rely on {@link #setSeriesOutlineStroke(int,
1687: * Stroke, boolean)} and {@link #setBaseOutlineStroke(Stroke, boolean)}.
1688: */
1689: public void setOutlineStroke(Stroke stroke, boolean notify) {
1690: this .outlineStroke = stroke;
1691: if (notify) {
1692: fireChangeEvent();
1693: }
1694: }
1695:
1696: /**
1697: * Returns the stroke used to outline the items in a series.
1698: *
1699: * @param series the series (zero-based index).
1700: *
1701: * @return The stroke (possibly <code>null</code>).
1702: */
1703: public Stroke getSeriesOutlineStroke(int series) {
1704: return this .outlineStrokeList.getStroke(series);
1705: }
1706:
1707: /**
1708: * Sets the outline stroke used for a series and sends a
1709: * {@link RendererChangeEvent} to all registered listeners.
1710: *
1711: * @param series the series index (zero-based).
1712: * @param stroke the stroke (<code>null</code> permitted).
1713: */
1714: public void setSeriesOutlineStroke(int series, Stroke stroke) {
1715: setSeriesOutlineStroke(series, stroke, true);
1716: }
1717:
1718: /**
1719: * Sets the outline stroke for a series and, if requested, sends a
1720: * {@link RendererChangeEvent} to all registered listeners.
1721: *
1722: * @param series the series index.
1723: * @param stroke the stroke (<code>null</code> permitted).
1724: * @param notify notify listeners?
1725: */
1726: public void setSeriesOutlineStroke(int series, Stroke stroke,
1727: boolean notify) {
1728: this .outlineStrokeList.setStroke(series, stroke);
1729: if (notify) {
1730: fireChangeEvent();
1731: }
1732: }
1733:
1734: /**
1735: * Returns the base outline stroke.
1736: *
1737: * @return The stroke (never <code>null</code>).
1738: */
1739: public Stroke getBaseOutlineStroke() {
1740: return this .baseOutlineStroke;
1741: }
1742:
1743: /**
1744: * Sets the base outline stroke and sends a {@link RendererChangeEvent} to
1745: * all registered listeners.
1746: *
1747: * @param stroke the stroke (<code>null</code> not permitted).
1748: */
1749: public void setBaseOutlineStroke(Stroke stroke) {
1750: setBaseOutlineStroke(stroke, true);
1751: }
1752:
1753: /**
1754: * Sets the base outline stroke and, if requested, sends a
1755: * {@link RendererChangeEvent} to all registered listeners.
1756: *
1757: * @param stroke the stroke (<code>null</code> not permitted).
1758: * @param notify a flag that controls whether or not listeners are
1759: * notified.
1760: */
1761: public void setBaseOutlineStroke(Stroke stroke, boolean notify) {
1762: if (stroke == null) {
1763: throw new IllegalArgumentException(
1764: "Null 'stroke' argument.");
1765: }
1766: this .baseOutlineStroke = stroke;
1767: if (notify) {
1768: fireChangeEvent();
1769: }
1770: }
1771:
1772: /**
1773: * Returns the flag that controls whether or not the series outline stroke
1774: * list is automatically populated when
1775: * {@link #lookupSeriesOutlineStroke(int)} is called.
1776: *
1777: * @return A boolean.
1778: *
1779: * @since 1.0.6
1780: *
1781: * @see #setAutoPopulateSeriesOutlineStroke(boolean)
1782: */
1783: public boolean getAutoPopulateSeriesOutlineStroke() {
1784: return this .autoPopulateSeriesOutlineStroke;
1785: }
1786:
1787: /**
1788: * Sets the flag that controls whether or not the series outline stroke list
1789: * is automatically populated when {@link #lookupSeriesOutlineStroke(int)}
1790: * is called.
1791: *
1792: * @param auto the new flag value.
1793: *
1794: * @since 1.0.6
1795: *
1796: * @see #getAutoPopulateSeriesOutlineStroke()
1797: */
1798: public void setAutoPopulateSeriesOutlineStroke(boolean auto) {
1799: this .autoPopulateSeriesOutlineStroke = auto;
1800: }
1801:
1802: // SHAPE
1803:
1804: /**
1805: * Returns a shape used to represent a data item.
1806: * <p>
1807: * The default implementation passes control to the getSeriesShape method.
1808: * You can override this method if you require different behaviour.
1809: *
1810: * @param row the row (or series) index (zero-based).
1811: * @param column the column (or category) index (zero-based).
1812: *
1813: * @return The shape (never <code>null</code>).
1814: */
1815: public Shape getItemShape(int row, int column) {
1816: return lookupSeriesShape(row);
1817: }
1818:
1819: /**
1820: * Returns a shape used to represent the items in a series.
1821: *
1822: * @param series the series (zero-based index).
1823: *
1824: * @return The shape (never <code>null</code>).
1825: *
1826: * @since 1.0.6
1827: */
1828: public Shape lookupSeriesShape(int series) {
1829:
1830: // return the override, if there is one...
1831: if (this .shape != null) {
1832: return this .shape;
1833: }
1834:
1835: // otherwise look up the shape list
1836: Shape result = this .shapeList.getShape(series);
1837: if (result == null && this .autoPopulateSeriesShape) {
1838: DrawingSupplier supplier = getDrawingSupplier();
1839: if (supplier != null) {
1840: result = supplier.getNextShape();
1841: this .shapeList.setShape(series, result);
1842: }
1843: }
1844: if (result == null) {
1845: result = this .baseShape;
1846: }
1847: return result;
1848:
1849: }
1850:
1851: /**
1852: * Sets the shape for ALL series (optional) and sends a
1853: * {@link RendererChangeEvent} to all registered listeners.
1854: *
1855: * @param shape the shape (<code>null</code> permitted).
1856: *
1857: * @deprecated This method should no longer be used (as of version 1.0.6).
1858: * It is sufficient to rely on {@link #setSeriesShape(int, Shape)}
1859: * and {@link #setBaseShape(Shape)}.
1860: */
1861: public void setShape(Shape shape) {
1862: setShape(shape, true);
1863: }
1864:
1865: /**
1866: * Sets the shape for ALL series and, if requested, sends a
1867: * {@link RendererChangeEvent} to all registered listeners.
1868: *
1869: * @param shape the shape (<code>null</code> permitted).
1870: * @param notify notify listeners?
1871: *
1872: * @deprecated This method should no longer be used (as of version 1.0.6).
1873: * It is sufficient to rely on {@link #setSeriesShape(int, Shape,
1874: * boolean)} and {@link #setBaseShape(Shape, boolean)}.
1875: */
1876: public void setShape(Shape shape, boolean notify) {
1877: this .shape = shape;
1878: if (notify) {
1879: fireChangeEvent();
1880: }
1881: }
1882:
1883: /**
1884: * Returns a shape used to represent the items in a series.
1885: *
1886: * @param series the series (zero-based index).
1887: *
1888: * @return The shape (possibly <code>null</code>).
1889: */
1890: public Shape getSeriesShape(int series) {
1891: return this .shapeList.getShape(series);
1892: }
1893:
1894: /**
1895: * Sets the shape used for a series and sends a {@link RendererChangeEvent}
1896: * to all registered listeners.
1897: *
1898: * @param series the series index (zero-based).
1899: * @param shape the shape (<code>null</code> permitted).
1900: */
1901: public void setSeriesShape(int series, Shape shape) {
1902: setSeriesShape(series, shape, true);
1903: }
1904:
1905: /**
1906: * Sets the shape for a series and, if requested, sends a
1907: * {@link RendererChangeEvent} to all registered listeners.
1908: *
1909: * @param series the series index (zero based).
1910: * @param shape the shape (<code>null</code> permitted).
1911: * @param notify notify listeners?
1912: */
1913: public void setSeriesShape(int series, Shape shape, boolean notify) {
1914: this .shapeList.setShape(series, shape);
1915: if (notify) {
1916: fireChangeEvent();
1917: }
1918: }
1919:
1920: /**
1921: * Returns the base shape.
1922: *
1923: * @return The shape (never <code>null</code>).
1924: */
1925: public Shape getBaseShape() {
1926: return this .baseShape;
1927: }
1928:
1929: /**
1930: * Sets the base shape and sends a {@link RendererChangeEvent} to all
1931: * registered listeners.
1932: *
1933: * @param shape the shape (<code>null</code> not permitted).
1934: */
1935: public void setBaseShape(Shape shape) {
1936: // defer argument checking...
1937: setBaseShape(shape, true);
1938: }
1939:
1940: /**
1941: * Sets the base shape and, if requested, sends a
1942: * {@link RendererChangeEvent} to all registered listeners.
1943: *
1944: * @param shape the shape (<code>null</code> not permitted).
1945: * @param notify notify listeners?
1946: */
1947: public void setBaseShape(Shape shape, boolean notify) {
1948: if (shape == null) {
1949: throw new IllegalArgumentException("Null 'shape' argument.");
1950: }
1951: this .baseShape = shape;
1952: if (notify) {
1953: fireChangeEvent();
1954: }
1955: }
1956:
1957: /**
1958: * Returns the flag that controls whether or not the series shape list is
1959: * automatically populated when {@link #lookupSeriesShape(int)} is called.
1960: *
1961: * @return A boolean.
1962: *
1963: * @since 1.0.6
1964: *
1965: * @see #setAutoPopulateSeriesShape(boolean)
1966: */
1967: public boolean getAutoPopulateSeriesShape() {
1968: return this .autoPopulateSeriesShape;
1969: }
1970:
1971: /**
1972: * Sets the flag that controls whether or not the series shape list is
1973: * automatically populated when {@link #lookupSeriesShape(int)} is called.
1974: *
1975: * @param auto the new flag value.
1976: *
1977: * @since 1.0.6
1978: *
1979: * @see #getAutoPopulateSeriesShape()
1980: */
1981: public void setAutoPopulateSeriesShape(boolean auto) {
1982: this .autoPopulateSeriesShape = auto;
1983: }
1984:
1985: // ITEM LABEL VISIBILITY...
1986:
1987: /**
1988: * Returns <code>true</code> if an item label is visible, and
1989: * <code>false</code> otherwise.
1990: *
1991: * @param row the row index (zero-based).
1992: * @param column the column index (zero-based).
1993: *
1994: * @return A boolean.
1995: */
1996: public boolean isItemLabelVisible(int row, int column) {
1997: return isSeriesItemLabelsVisible(row);
1998: }
1999:
2000: /**
2001: * Returns <code>true</code> if the item labels for a series are visible,
2002: * and <code>false</code> otherwise.
2003: *
2004: * @param series the series index (zero-based).
2005: *
2006: * @return A boolean.
2007: */
2008: public boolean isSeriesItemLabelsVisible(int series) {
2009:
2010: // return the override, if there is one...
2011: if (this .itemLabelsVisible != null) {
2012: return this .itemLabelsVisible.booleanValue();
2013: }
2014:
2015: // otherwise look up the boolean table
2016: Boolean b = this .itemLabelsVisibleList.getBoolean(series);
2017: if (b == null) {
2018: b = this .baseItemLabelsVisible;
2019: }
2020: if (b == null) {
2021: b = Boolean.FALSE;
2022: }
2023: return b.booleanValue();
2024:
2025: }
2026:
2027: /**
2028: * Sets the visibility of the item labels for ALL series.
2029: *
2030: * @param visible the flag.
2031: *
2032: * @deprecated This method should no longer be used (as of version 1.0.6).
2033: * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int,
2034: * Boolean)} and {@link #setBaseItemLabelsVisible(boolean)}.
2035: */
2036: public void setItemLabelsVisible(boolean visible) {
2037: setItemLabelsVisible(BooleanUtilities.valueOf(visible));
2038: // The following alternative is only supported in JDK 1.4 - we support
2039: // JDK 1.3.1 onwards
2040: // setItemLabelsVisible(Boolean.valueOf(visible));
2041: }
2042:
2043: /**
2044: * Sets the visibility of the item labels for ALL series (optional).
2045: *
2046: * @param visible the flag (<code>null</code> permitted).
2047: *
2048: * @deprecated This method should no longer be used (as of version 1.0.6).
2049: * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int,
2050: * Boolean)} and {@link #setBaseItemLabelsVisible(boolean)}.
2051: */
2052: public void setItemLabelsVisible(Boolean visible) {
2053: setItemLabelsVisible(visible, true);
2054: }
2055:
2056: /**
2057: * Sets the visibility of item labels for ALL series and, if requested,
2058: * sends a {@link RendererChangeEvent} to all registered listeners.
2059: *
2060: * @param visible a flag that controls whether or not the item labels are
2061: * visible (<code>null</code> permitted).
2062: * @param notify a flag that controls whether or not listeners are
2063: * notified.
2064: *
2065: * @deprecated This method should no longer be used (as of version 1.0.6).
2066: * It is sufficient to rely on {@link #setSeriesItemLabelsVisible(int,
2067: * Boolean, boolean)} and {@link #setBaseItemLabelsVisible(Boolean,
2068: * boolean)}.
2069: */
2070: public void setItemLabelsVisible(Boolean visible, boolean notify) {
2071: this .itemLabelsVisible = visible;
2072: if (notify) {
2073: fireChangeEvent();
2074: }
2075: }
2076:
2077: /**
2078: * Sets a flag that controls the visibility of the item labels for a series.
2079: *
2080: * @param series the series index (zero-based).
2081: * @param visible the flag.
2082: */
2083: public void setSeriesItemLabelsVisible(int series, boolean visible) {
2084: setSeriesItemLabelsVisible(series, BooleanUtilities
2085: .valueOf(visible));
2086: }
2087:
2088: /**
2089: * Sets the visibility of the item labels for a series.
2090: *
2091: * @param series the series index (zero-based).
2092: * @param visible the flag (<code>null</code> permitted).
2093: */
2094: public void setSeriesItemLabelsVisible(int series, Boolean visible) {
2095: setSeriesItemLabelsVisible(series, visible, true);
2096: }
2097:
2098: /**
2099: * Sets the visibility of item labels for a series and, if requested, sends
2100: * a {@link RendererChangeEvent} to all registered listeners.
2101: *
2102: * @param series the series index (zero-based).
2103: * @param visible the visible flag.
2104: * @param notify a flag that controls whether or not listeners are
2105: * notified.
2106: */
2107: public void setSeriesItemLabelsVisible(int series, Boolean visible,
2108: boolean notify) {
2109: this .itemLabelsVisibleList.setBoolean(series, visible);
2110: if (notify) {
2111: fireChangeEvent();
2112: }
2113: }
2114:
2115: /**
2116: * Returns the base setting for item label visibility. A <code>null</code>
2117: * result should be interpreted as equivalent to <code>Boolean.FALSE</code>.
2118: *
2119: * @return A flag (possibly <code>null</code>).
2120: */
2121: public Boolean getBaseItemLabelsVisible() {
2122: // this should have been defined as a boolean primitive, because
2123: // allowing null values is a nuisance...but it is part of the final
2124: // API now, so we'll have to support it.
2125: return this .baseItemLabelsVisible;
2126: }
2127:
2128: /**
2129: * Sets the base flag that controls whether or not item labels are visible.
2130: *
2131: * @param visible the flag.
2132: */
2133: public void setBaseItemLabelsVisible(boolean visible) {
2134: setBaseItemLabelsVisible(BooleanUtilities.valueOf(visible));
2135: }
2136:
2137: /**
2138: * Sets the base setting for item label visibility.
2139: *
2140: * @param visible the flag (<code>null</code> is permitted, and viewed
2141: * as equivalent to <code>Boolean.FALSE</code>).
2142: */
2143: public void setBaseItemLabelsVisible(Boolean visible) {
2144: setBaseItemLabelsVisible(visible, true);
2145: }
2146:
2147: /**
2148: * Sets the base visibility for item labels and, if requested, sends a
2149: * {@link RendererChangeEvent} to all registered listeners.
2150: *
2151: * @param visible the flag (<code>null</code> is permitted, and viewed
2152: * as equivalent to <code>Boolean.FALSE</code>).
2153: * @param notify a flag that controls whether or not listeners are
2154: * notified.
2155: */
2156: public void setBaseItemLabelsVisible(Boolean visible, boolean notify) {
2157: this .baseItemLabelsVisible = visible;
2158: if (notify) {
2159: fireChangeEvent();
2160: }
2161: }
2162:
2163: //// ITEM LABEL FONT //////////////////////////////////////////////////////
2164:
2165: /**
2166: * Returns the font for an item label.
2167: *
2168: * @param row the row index (zero-based).
2169: * @param column the column index (zero-based).
2170: *
2171: * @return The font (never <code>null</code>).
2172: */
2173: public Font getItemLabelFont(int row, int column) {
2174: Font result = this .itemLabelFont;
2175: if (result == null) {
2176: result = getSeriesItemLabelFont(row);
2177: if (result == null) {
2178: result = this .baseItemLabelFont;
2179: }
2180: }
2181: return result;
2182: }
2183:
2184: /**
2185: * Returns the font used for all item labels. This may be
2186: * <code>null</code>, in which case the per series font settings will apply.
2187: *
2188: * @return The font (possibly <code>null</code>).
2189: *
2190: * @deprecated This method should no longer be used (as of version 1.0.6).
2191: * It is sufficient to rely on {@link #getSeriesItemLabelFont(int)} and
2192: * {@link #getBaseItemLabelFont()}.
2193: */
2194: public Font getItemLabelFont() {
2195: return this .itemLabelFont;
2196: }
2197:
2198: /**
2199: * Sets the item label font for ALL series and sends a
2200: * {@link RendererChangeEvent} to all registered listeners. You can set
2201: * this to <code>null</code> if you prefer to set the font on a per series
2202: * basis.
2203: *
2204: * @param font the font (<code>null</code> permitted).
2205: *
2206: * @deprecated This method should no longer be used (as of version 1.0.6).
2207: * It is sufficient to rely on {@link #setSeriesItemLabelFont(int,
2208: * Font)} and {@link #setBaseItemLabelFont(Font)}.
2209: */
2210: public void setItemLabelFont(Font font) {
2211: setItemLabelFont(font, true);
2212: }
2213:
2214: /**
2215: * Sets the item label font for ALL series and, if requested, sends a
2216: * {@link RendererChangeEvent} to all registered listeners.
2217: *
2218: * @param font the font (<code>null</code> permitted).
2219: * @param notify a flag that controls whether or not listeners are
2220: * notified.
2221: *
2222: * @deprecated This method should no longer be used (as of version 1.0.6).
2223: * It is sufficient to rely on {@link #setSeriesItemLabelFont(int,
2224: * Font, boolean)} and {@link #setBaseItemLabelFont(Font, boolean)}.
2225: */
2226: public void setItemLabelFont(Font font, boolean notify) {
2227: this .itemLabelFont = font;
2228: if (notify) {
2229: fireChangeEvent();
2230: }
2231: }
2232:
2233: /**
2234: * Returns the font for all the item labels in a series.
2235: *
2236: * @param series the series index (zero-based).
2237: *
2238: * @return The font (possibly <code>null</code>).
2239: */
2240: public Font getSeriesItemLabelFont(int series) {
2241: return (Font) this .itemLabelFontList.get(series);
2242: }
2243:
2244: /**
2245: * Sets the item label font for a series and sends a
2246: * {@link RendererChangeEvent} to all registered listeners.
2247: *
2248: * @param series the series index (zero-based).
2249: * @param font the font (<code>null</code> permitted).
2250: */
2251: public void setSeriesItemLabelFont(int series, Font font) {
2252: setSeriesItemLabelFont(series, font, true);
2253: }
2254:
2255: /**
2256: * Sets the item label font for a series and, if requested, sends a
2257: * {@link RendererChangeEvent} to all registered listeners.
2258: *
2259: * @param series the series index (zero based).
2260: * @param font the font (<code>null</code> permitted).
2261: * @param notify a flag that controls whether or not listeners are
2262: * notified.
2263: */
2264: public void setSeriesItemLabelFont(int series, Font font,
2265: boolean notify) {
2266: this .itemLabelFontList.set(series, font);
2267: if (notify) {
2268: fireChangeEvent();
2269: }
2270: }
2271:
2272: /**
2273: * Returns the base item label font (this is used when no other font
2274: * setting is available).
2275: *
2276: * @return The font (<code>never</code> null).
2277: */
2278: public Font getBaseItemLabelFont() {
2279: return this .baseItemLabelFont;
2280: }
2281:
2282: /**
2283: * Sets the base item label font and sends a {@link RendererChangeEvent} to
2284: * all registered listeners.
2285: *
2286: * @param font the font (<code>null</code> not permitted).
2287: */
2288: public void setBaseItemLabelFont(Font font) {
2289: if (font == null) {
2290: throw new IllegalArgumentException("Null 'font' argument.");
2291: }
2292: setBaseItemLabelFont(font, true);
2293: }
2294:
2295: /**
2296: * Sets the base item label font and, if requested, sends a
2297: * {@link RendererChangeEvent} to all registered listeners.
2298: *
2299: * @param font the font (<code>null</code> not permitted).
2300: * @param notify a flag that controls whether or not listeners are
2301: * notified.
2302: */
2303: public void setBaseItemLabelFont(Font font, boolean notify) {
2304: this .baseItemLabelFont = font;
2305: if (notify) {
2306: fireChangeEvent();
2307: }
2308: }
2309:
2310: //// ITEM LABEL PAINT ////////////////////////////////////////////////////
2311:
2312: /**
2313: * Returns the paint used to draw an item label.
2314: *
2315: * @param row the row index (zero based).
2316: * @param column the column index (zero based).
2317: *
2318: * @return The paint (never <code>null</code>).
2319: */
2320: public Paint getItemLabelPaint(int row, int column) {
2321: Paint result = this .itemLabelPaint;
2322: if (result == null) {
2323: result = getSeriesItemLabelPaint(row);
2324: if (result == null) {
2325: result = this .baseItemLabelPaint;
2326: }
2327: }
2328: return result;
2329: }
2330:
2331: /**
2332: * Returns the paint used for all item labels. This may be
2333: * <code>null</code>, in which case the per series paint settings will
2334: * apply.
2335: *
2336: * @return The paint (possibly <code>null</code>).
2337: *
2338: * @deprecated This method should no longer be used (as of version 1.0.6).
2339: * It is sufficient to rely on {@link #getSeriesItemLabelPaint(int)}
2340: * and {@link #getBaseItemLabelPaint()}.
2341: */
2342: public Paint getItemLabelPaint() {
2343: return this .itemLabelPaint;
2344: }
2345:
2346: /**
2347: * Sets the item label paint for ALL series and sends a
2348: * {@link RendererChangeEvent} to all registered listeners.
2349: *
2350: * @param paint the paint (<code>null</code> permitted).
2351: *
2352: * @deprecated This method should no longer be used (as of version 1.0.6).
2353: * It is sufficient to rely on {@link #setSeriesItemLabelPaint(int,
2354: * Paint)} and {@link #setBaseItemLabelPaint(Paint)}.
2355: */
2356: public void setItemLabelPaint(Paint paint) {
2357: setItemLabelPaint(paint, true);
2358: }
2359:
2360: /**
2361: * Sets the item label paint for ALL series and, if requested, sends a
2362: * {@link RendererChangeEvent} to all registered listeners.
2363: *
2364: * @param paint the paint.
2365: * @param notify a flag that controls whether or not listeners are
2366: * notified.
2367: *
2368: * @deprecated This method should no longer be used (as of version 1.0.6).
2369: * It is sufficient to rely on {@link #setSeriesItemLabelPaint(int,
2370: * Paint, boolean)} and {@link #setBaseItemLabelPaint(Paint, boolean)}.
2371: */
2372: public void setItemLabelPaint(Paint paint, boolean notify) {
2373: this .itemLabelPaint = paint;
2374: if (notify) {
2375: fireChangeEvent();
2376: }
2377: }
2378:
2379: /**
2380: * Returns the paint used to draw the item labels for a series.
2381: *
2382: * @param series the series index (zero based).
2383: *
2384: * @return The paint (possibly <code>null<code>).
2385: */
2386: public Paint getSeriesItemLabelPaint(int series) {
2387: return this .itemLabelPaintList.getPaint(series);
2388: }
2389:
2390: /**
2391: * Sets the item label paint for a series and sends a
2392: * {@link RendererChangeEvent} to all registered listeners.
2393: *
2394: * @param series the series (zero based index).
2395: * @param paint the paint (<code>null</code> permitted).
2396: */
2397: public void setSeriesItemLabelPaint(int series, Paint paint) {
2398: setSeriesItemLabelPaint(series, paint, true);
2399: }
2400:
2401: /**
2402: * Sets the item label paint for a series and, if requested, sends a
2403: * {@link RendererChangeEvent} to all registered listeners.
2404: *
2405: * @param series the series index (zero based).
2406: * @param paint the paint (<code>null</code> permitted).
2407: * @param notify a flag that controls whether or not listeners are
2408: * notified.
2409: */
2410: public void setSeriesItemLabelPaint(int series, Paint paint,
2411: boolean notify) {
2412: this .itemLabelPaintList.setPaint(series, paint);
2413: if (notify) {
2414: fireChangeEvent();
2415: }
2416: }
2417:
2418: /**
2419: * Returns the base item label paint.
2420: *
2421: * @return The paint (never <code>null<code>).
2422: */
2423: public Paint getBaseItemLabelPaint() {
2424: return this .baseItemLabelPaint;
2425: }
2426:
2427: /**
2428: * Sets the base item label paint and sends a {@link RendererChangeEvent}
2429: * to all registered listeners.
2430: *
2431: * @param paint the paint (<code>null</code> not permitted).
2432: */
2433: public void setBaseItemLabelPaint(Paint paint) {
2434: // defer argument checking...
2435: setBaseItemLabelPaint(paint, true);
2436: }
2437:
2438: /**
2439: * Sets the base item label paint and, if requested, sends a
2440: * {@link RendererChangeEvent} to all registered listeners..
2441: *
2442: * @param paint the paint (<code>null</code> not permitted).
2443: * @param notify a flag that controls whether or not listeners are
2444: * notified.
2445: */
2446: public void setBaseItemLabelPaint(Paint paint, boolean notify) {
2447: if (paint == null) {
2448: throw new IllegalArgumentException("Null 'paint' argument.");
2449: }
2450: this .baseItemLabelPaint = paint;
2451: if (notify) {
2452: fireChangeEvent();
2453: }
2454: }
2455:
2456: // POSITIVE ITEM LABEL POSITION...
2457:
2458: /**
2459: * Returns the item label position for positive values.
2460: *
2461: * @param row the row index (zero-based).
2462: * @param column the column index (zero-based).
2463: *
2464: * @return The item label position (never <code>null</code>).
2465: *
2466: * @see #getNegativeItemLabelPosition(int, int)
2467: */
2468: public ItemLabelPosition getPositiveItemLabelPosition(int row,
2469: int column) {
2470: return getSeriesPositiveItemLabelPosition(row);
2471: }
2472:
2473: /**
2474: * Returns the item label position for positive values in ALL series.
2475: *
2476: * @return The item label position (possibly <code>null</code>).
2477: *
2478: * @see #setPositiveItemLabelPosition(ItemLabelPosition)
2479: *
2480: * @deprecated This method should no longer be used (as of version 1.0.6).
2481: * It is sufficient to rely on
2482: * {@link #getSeriesPositiveItemLabelPosition(int)}
2483: * and {@link #getBasePositiveItemLabelPosition()}.
2484: */
2485: public ItemLabelPosition getPositiveItemLabelPosition() {
2486: return this .positiveItemLabelPosition;
2487: }
2488:
2489: /**
2490: * Sets the item label position for positive values in ALL series, and
2491: * sends a {@link RendererChangeEvent} to all registered listeners. You
2492: * need to set this to <code>null</code> to expose the settings for
2493: * individual series.
2494: *
2495: * @param position the position (<code>null</code> permitted).
2496: *
2497: * @see #getPositiveItemLabelPosition()
2498: *
2499: * @deprecated This method should no longer be used (as of version 1.0.6).
2500: * It is sufficient to rely on
2501: * {@link #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition)}
2502: * and {@link #setBasePositiveItemLabelPosition(ItemLabelPosition)}.
2503: */
2504: public void setPositiveItemLabelPosition(ItemLabelPosition position) {
2505: setPositiveItemLabelPosition(position, true);
2506: }
2507:
2508: /**
2509: * Sets the positive item label position for ALL series and (if requested)
2510: * sends a {@link RendererChangeEvent} to all registered listeners.
2511: *
2512: * @param position the position (<code>null</code> permitted).
2513: * @param notify notify registered listeners?
2514: *
2515: * @see #getPositiveItemLabelPosition()
2516: *
2517: * @deprecated This method should no longer be used (as of version 1.0.6).
2518: * It is sufficient to rely on
2519: * {@link #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition,
2520: * boolean)} and {@link #setBasePositiveItemLabelPosition(
2521: * ItemLabelPosition, boolean)}.
2522: */
2523: public void setPositiveItemLabelPosition(
2524: ItemLabelPosition position, boolean notify) {
2525: this .positiveItemLabelPosition = position;
2526: if (notify) {
2527: fireChangeEvent();
2528: }
2529: }
2530:
2531: /**
2532: * Returns the item label position for all positive values in a series.
2533: *
2534: * @param series the series index (zero-based).
2535: *
2536: * @return The item label position (never <code>null</code>).
2537: *
2538: * @see #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition)
2539: */
2540: public ItemLabelPosition getSeriesPositiveItemLabelPosition(
2541: int series) {
2542:
2543: // return the override, if there is one...
2544: if (this .positiveItemLabelPosition != null) {
2545: return this .positiveItemLabelPosition;
2546: }
2547:
2548: // otherwise look up the position table
2549: ItemLabelPosition position = (ItemLabelPosition) this .positiveItemLabelPositionList
2550: .get(series);
2551: if (position == null) {
2552: position = this .basePositiveItemLabelPosition;
2553: }
2554: return position;
2555:
2556: }
2557:
2558: /**
2559: * Sets the item label position for all positive values in a series and
2560: * sends a {@link RendererChangeEvent} to all registered listeners.
2561: *
2562: * @param series the series index (zero-based).
2563: * @param position the position (<code>null</code> permitted).
2564: *
2565: * @see #getSeriesPositiveItemLabelPosition(int)
2566: */
2567: public void setSeriesPositiveItemLabelPosition(int series,
2568: ItemLabelPosition position) {
2569: setSeriesPositiveItemLabelPosition(series, position, true);
2570: }
2571:
2572: /**
2573: * Sets the item label position for all positive values in a series and (if
2574: * requested) sends a {@link RendererChangeEvent} to all registered
2575: * listeners.
2576: *
2577: * @param series the series index (zero-based).
2578: * @param position the position (<code>null</code> permitted).
2579: * @param notify notify registered listeners?
2580: *
2581: * @see #getSeriesPositiveItemLabelPosition(int)
2582: */
2583: public void setSeriesPositiveItemLabelPosition(int series,
2584: ItemLabelPosition position, boolean notify) {
2585: this .positiveItemLabelPositionList.set(series, position);
2586: if (notify) {
2587: fireChangeEvent();
2588: }
2589: }
2590:
2591: /**
2592: * Returns the base positive item label position.
2593: *
2594: * @return The position (never <code>null</code>).
2595: *
2596: * @see #setBasePositiveItemLabelPosition(ItemLabelPosition)
2597: */
2598: public ItemLabelPosition getBasePositiveItemLabelPosition() {
2599: return this .basePositiveItemLabelPosition;
2600: }
2601:
2602: /**
2603: * Sets the base positive item label position.
2604: *
2605: * @param position the position (<code>null</code> not permitted).
2606: *
2607: * @see #getBasePositiveItemLabelPosition()
2608: */
2609: public void setBasePositiveItemLabelPosition(
2610: ItemLabelPosition position) {
2611: // defer argument checking...
2612: setBasePositiveItemLabelPosition(position, true);
2613: }
2614:
2615: /**
2616: * Sets the base positive item label position and, if requested, sends a
2617: * {@link RendererChangeEvent} to all registered listeners.
2618: *
2619: * @param position the position (<code>null</code> not permitted).
2620: * @param notify notify registered listeners?
2621: *
2622: * @see #getBasePositiveItemLabelPosition()
2623: */
2624: public void setBasePositiveItemLabelPosition(
2625: ItemLabelPosition position, boolean notify) {
2626: if (position == null) {
2627: throw new IllegalArgumentException(
2628: "Null 'position' argument.");
2629: }
2630: this .basePositiveItemLabelPosition = position;
2631: if (notify) {
2632: fireChangeEvent();
2633: }
2634: }
2635:
2636: // NEGATIVE ITEM LABEL POSITION...
2637:
2638: /**
2639: * Returns the item label position for negative values. This method can be
2640: * overridden to provide customisation of the item label position for
2641: * individual data items.
2642: *
2643: * @param row the row index (zero-based).
2644: * @param column the column (zero-based).
2645: *
2646: * @return The item label position (never <code>null</code>).
2647: *
2648: * @see #getPositiveItemLabelPosition(int, int)
2649: */
2650: public ItemLabelPosition getNegativeItemLabelPosition(int row,
2651: int column) {
2652: return getSeriesNegativeItemLabelPosition(row);
2653: }
2654:
2655: /**
2656: * Returns the item label position for negative values in ALL series.
2657: *
2658: * @return The item label position (possibly <code>null</code>).
2659: *
2660: * @see #setNegativeItemLabelPosition(ItemLabelPosition)
2661: *
2662: * @deprecated This method should no longer be used (as of version 1.0.6).
2663: * It is sufficient to rely on
2664: * {@link #getSeriesNegativeItemLabelPosition(int)}
2665: * and {@link #getBaseNegativeItemLabelPosition()}.
2666: */
2667: public ItemLabelPosition getNegativeItemLabelPosition() {
2668: return this .negativeItemLabelPosition;
2669: }
2670:
2671: /**
2672: * Sets the item label position for negative values in ALL series, and
2673: * sends a {@link RendererChangeEvent} to all registered listeners. You
2674: * need to set this to <code>null</code> to expose the settings for
2675: * individual series.
2676: *
2677: * @param position the position (<code>null</code> permitted).
2678: *
2679: * @see #getNegativeItemLabelPosition()
2680: *
2681: * @deprecated This method should no longer be used (as of version 1.0.6).
2682: * It is sufficient to rely on
2683: * {@link #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition)}
2684: * and {@link #setBaseNegativeItemLabelPosition(ItemLabelPosition)}.
2685: */
2686: public void setNegativeItemLabelPosition(ItemLabelPosition position) {
2687: setNegativeItemLabelPosition(position, true);
2688: }
2689:
2690: /**
2691: * Sets the item label position for negative values in ALL series and (if
2692: * requested) sends a {@link RendererChangeEvent} to all registered
2693: * listeners.
2694: *
2695: * @param position the position (<code>null</code> permitted).
2696: * @param notify notify registered listeners?
2697: *
2698: * @see #getNegativeItemLabelPosition()
2699: *
2700: * @deprecated This method should no longer be used (as of version 1.0.6).
2701: * It is sufficient to rely on
2702: * {@link #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition,
2703: * boolean)} and {@link #setBaseNegativeItemLabelPosition(
2704: * ItemLabelPosition, boolean)}.
2705: */
2706: public void setNegativeItemLabelPosition(
2707: ItemLabelPosition position, boolean notify) {
2708: this .negativeItemLabelPosition = position;
2709: if (notify) {
2710: fireChangeEvent();
2711: }
2712: }
2713:
2714: /**
2715: * Returns the item label position for all negative values in a series.
2716: *
2717: * @param series the series index (zero-based).
2718: *
2719: * @return The item label position (never <code>null</code>).
2720: *
2721: * @see #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition)
2722: */
2723: public ItemLabelPosition getSeriesNegativeItemLabelPosition(
2724: int series) {
2725:
2726: // return the override, if there is one...
2727: if (this .negativeItemLabelPosition != null) {
2728: return this .negativeItemLabelPosition;
2729: }
2730:
2731: // otherwise look up the position list
2732: ItemLabelPosition position = (ItemLabelPosition) this .negativeItemLabelPositionList
2733: .get(series);
2734: if (position == null) {
2735: position = this .baseNegativeItemLabelPosition;
2736: }
2737: return position;
2738:
2739: }
2740:
2741: /**
2742: * Sets the item label position for negative values in a series and sends a
2743: * {@link RendererChangeEvent} to all registered listeners.
2744: *
2745: * @param series the series index (zero-based).
2746: * @param position the position (<code>null</code> permitted).
2747: *
2748: * @see #getSeriesNegativeItemLabelPosition(int)
2749: */
2750: public void setSeriesNegativeItemLabelPosition(int series,
2751: ItemLabelPosition position) {
2752: setSeriesNegativeItemLabelPosition(series, position, true);
2753: }
2754:
2755: /**
2756: * Sets the item label position for negative values in a series and (if
2757: * requested) sends a {@link RendererChangeEvent} to all registered
2758: * listeners.
2759: *
2760: * @param series the series index (zero-based).
2761: * @param position the position (<code>null</code> permitted).
2762: * @param notify notify registered listeners?
2763: *
2764: * @see #getSeriesNegativeItemLabelPosition(int)
2765: */
2766: public void setSeriesNegativeItemLabelPosition(int series,
2767: ItemLabelPosition position, boolean notify) {
2768: this .negativeItemLabelPositionList.set(series, position);
2769: if (notify) {
2770: fireChangeEvent();
2771: }
2772: }
2773:
2774: /**
2775: * Returns the base item label position for negative values.
2776: *
2777: * @return The position (never <code>null</code>).
2778: *
2779: * @see #setBaseNegativeItemLabelPosition(ItemLabelPosition)
2780: */
2781: public ItemLabelPosition getBaseNegativeItemLabelPosition() {
2782: return this .baseNegativeItemLabelPosition;
2783: }
2784:
2785: /**
2786: * Sets the base item label position for negative values and sends a
2787: * {@link RendererChangeEvent} to all registered listeners.
2788: *
2789: * @param position the position (<code>null</code> not permitted).
2790: *
2791: * @see #getBaseNegativeItemLabelPosition()
2792: */
2793: public void setBaseNegativeItemLabelPosition(
2794: ItemLabelPosition position) {
2795: setBaseNegativeItemLabelPosition(position, true);
2796: }
2797:
2798: /**
2799: * Sets the base negative item label position and, if requested, sends a
2800: * {@link RendererChangeEvent} to all registered listeners.
2801: *
2802: * @param position the position (<code>null</code> not permitted).
2803: * @param notify notify registered listeners?
2804: *
2805: * @see #getBaseNegativeItemLabelPosition()
2806: */
2807: public void setBaseNegativeItemLabelPosition(
2808: ItemLabelPosition position, boolean notify) {
2809: if (position == null) {
2810: throw new IllegalArgumentException(
2811: "Null 'position' argument.");
2812: }
2813: this .baseNegativeItemLabelPosition = position;
2814: if (notify) {
2815: fireChangeEvent();
2816: }
2817: }
2818:
2819: /**
2820: * Returns the item label anchor offset.
2821: *
2822: * @return The offset.
2823: *
2824: * @see #setItemLabelAnchorOffset(double)
2825: */
2826: public double getItemLabelAnchorOffset() {
2827: return this .itemLabelAnchorOffset;
2828: }
2829:
2830: /**
2831: * Sets the item label anchor offset.
2832: *
2833: * @param offset the offset.
2834: *
2835: * @see #getItemLabelAnchorOffset()
2836: */
2837: public void setItemLabelAnchorOffset(double offset) {
2838: this .itemLabelAnchorOffset = offset;
2839: fireChangeEvent();
2840: }
2841:
2842: /**
2843: * Returns a boolean that indicates whether or not the specified item
2844: * should have a chart entity created for it.
2845: *
2846: * @param series the series index.
2847: * @param item the item index.
2848: *
2849: * @return A boolean.
2850: */
2851: public boolean getItemCreateEntity(int series, int item) {
2852: if (this .createEntities != null) {
2853: return this .createEntities.booleanValue();
2854: } else {
2855: Boolean b = getSeriesCreateEntities(series);
2856: if (b != null) {
2857: return b.booleanValue();
2858: } else {
2859: return this .baseCreateEntities;
2860: }
2861: }
2862: }
2863:
2864: /**
2865: * Returns the flag that controls whether or not chart entities are created
2866: * for the items in ALL series. This flag overrides the per series and
2867: * default settings - you must set it to <code>null</code> if you want the
2868: * other settings to apply.
2869: *
2870: * @return The flag (possibly <code>null</code>).
2871: *
2872: * @deprecated This method should no longer be used (as of version 1.0.6).
2873: * It is sufficient to rely on {@link #getSeriesCreateEntities(int)}
2874: * and {@link #getBaseCreateEntities()}.
2875: */
2876: public Boolean getCreateEntities() {
2877: return this .createEntities;
2878: }
2879:
2880: /**
2881: * Sets the flag that controls whether or not chart entities are created
2882: * for the items in ALL series, and sends a {@link RendererChangeEvent} to
2883: * all registered listeners. This flag overrides the per series and
2884: * default settings - you must set it to <code>null</code> if you want the
2885: * other settings to apply.
2886: *
2887: * @param create the flag (<code>null</code> permitted).
2888: *
2889: * @deprecated This method should no longer be used (as of version 1.0.6).
2890: * It is sufficient to rely on {@link #setSeriesCreateEntities(int,
2891: * Boolean)} and {@link #setBaseCreateEntities(boolean)}.
2892: */
2893: public void setCreateEntities(Boolean create) {
2894: setCreateEntities(create, true);
2895: }
2896:
2897: /**
2898: * Sets the flag that controls whether or not chart entities are created
2899: * for the items in ALL series, and sends a {@link RendererChangeEvent} to
2900: * all registered listeners. This flag overrides the per series and
2901: * default settings - you must set it to <code>null</code> if you want the
2902: * other settings to apply.
2903: *
2904: * @param create the flag (<code>null</code> permitted).
2905: * @param notify notify listeners?
2906: *
2907: * @deprecated This method should no longer be used (as of version 1.0.6).
2908: * It is sufficient to rely on {@link #setSeriesItemLabelFont(int,
2909: * Font, boolean)} and {@link #setBaseItemLabelFont(Font, boolean)}.
2910: */
2911: public void setCreateEntities(Boolean create, boolean notify) {
2912: this .createEntities = create;
2913: if (notify) {
2914: fireChangeEvent();
2915: }
2916: }
2917:
2918: /**
2919: * Returns the flag that controls whether entities are created for a
2920: * series.
2921: *
2922: * @param series the series index (zero-based).
2923: *
2924: * @return The flag (possibly <code>null</code>).
2925: */
2926: public Boolean getSeriesCreateEntities(int series) {
2927: return this .createEntitiesList.getBoolean(series);
2928: }
2929:
2930: /**
2931: * Sets the flag that controls whether entities are created for a series,
2932: * and sends a {@link RendererChangeEvent} to all registered listeners.
2933: *
2934: * @param series the series index (zero-based).
2935: * @param create the flag (<code>null</code> permitted).
2936: */
2937: public void setSeriesCreateEntities(int series, Boolean create) {
2938: setSeriesCreateEntities(series, create, true);
2939: }
2940:
2941: /**
2942: * Sets the flag that controls whether entities are created for a series
2943: * and, if requested, sends a {@link RendererChangeEvent} to all registered
2944: * listeners.
2945: *
2946: * @param series the series index.
2947: * @param create the flag (<code>null</code> permitted).
2948: * @param notify notify listeners?
2949: */
2950: public void setSeriesCreateEntities(int series, Boolean create,
2951: boolean notify) {
2952: this .createEntitiesList.setBoolean(series, create);
2953: if (notify) {
2954: fireChangeEvent();
2955: }
2956: }
2957:
2958: /**
2959: * Returns the base visibility for all series.
2960: *
2961: * @return The base visibility.
2962: */
2963: public boolean getBaseCreateEntities() {
2964: return this .baseCreateEntities;
2965: }
2966:
2967: /**
2968: * Sets the base flag that controls whether entities are created
2969: * for a series, and sends a {@link RendererChangeEvent}
2970: * to all registered listeners.
2971: *
2972: * @param create the flag.
2973: */
2974: public void setBaseCreateEntities(boolean create) {
2975: // defer argument checking...
2976: setBaseCreateEntities(create, true);
2977: }
2978:
2979: /**
2980: * Sets the base flag that controls whether entities are created and,
2981: * if requested, sends a {@link RendererChangeEvent} to all registered
2982: * listeners.
2983: *
2984: * @param create the visibility.
2985: * @param notify notify listeners?
2986: */
2987: public void setBaseCreateEntities(boolean create, boolean notify) {
2988: this .baseCreateEntities = create;
2989: if (notify) {
2990: fireChangeEvent();
2991: }
2992: }
2993:
2994: /** The adjacent offset. */
2995: private static final double ADJ = Math.cos(Math.PI / 6.0);
2996:
2997: /** The opposite offset. */
2998: private static final double OPP = Math.sin(Math.PI / 6.0);
2999:
3000: /**
3001: * Calculates the item label anchor point.
3002: *
3003: * @param anchor the anchor.
3004: * @param x the x coordinate.
3005: * @param y the y coordinate.
3006: * @param orientation the plot orientation.
3007: *
3008: * @return The anchor point (never <code>null</code>).
3009: */
3010: protected Point2D calculateLabelAnchorPoint(ItemLabelAnchor anchor,
3011: double x, double y, PlotOrientation orientation) {
3012: Point2D result = null;
3013: if (anchor == ItemLabelAnchor.CENTER) {
3014: result = new Point2D.Double(x, y);
3015: } else if (anchor == ItemLabelAnchor.INSIDE1) {
3016: result = new Point2D.Double(x + OPP
3017: * this .itemLabelAnchorOffset, y - ADJ
3018: * this .itemLabelAnchorOffset);
3019: } else if (anchor == ItemLabelAnchor.INSIDE2) {
3020: result = new Point2D.Double(x + ADJ
3021: * this .itemLabelAnchorOffset, y - OPP
3022: * this .itemLabelAnchorOffset);
3023: } else if (anchor == ItemLabelAnchor.INSIDE3) {
3024: result = new Point2D.Double(x + this .itemLabelAnchorOffset,
3025: y);
3026: } else if (anchor == ItemLabelAnchor.INSIDE4) {
3027: result = new Point2D.Double(x + ADJ
3028: * this .itemLabelAnchorOffset, y + OPP
3029: * this .itemLabelAnchorOffset);
3030: } else if (anchor == ItemLabelAnchor.INSIDE5) {
3031: result = new Point2D.Double(x + OPP
3032: * this .itemLabelAnchorOffset, y + ADJ
3033: * this .itemLabelAnchorOffset);
3034: } else if (anchor == ItemLabelAnchor.INSIDE6) {
3035: result = new Point2D.Double(x, y
3036: + this .itemLabelAnchorOffset);
3037: } else if (anchor == ItemLabelAnchor.INSIDE7) {
3038: result = new Point2D.Double(x - OPP
3039: * this .itemLabelAnchorOffset, y + ADJ
3040: * this .itemLabelAnchorOffset);
3041: } else if (anchor == ItemLabelAnchor.INSIDE8) {
3042: result = new Point2D.Double(x - ADJ
3043: * this .itemLabelAnchorOffset, y + OPP
3044: * this .itemLabelAnchorOffset);
3045: } else if (anchor == ItemLabelAnchor.INSIDE9) {
3046: result = new Point2D.Double(x - this .itemLabelAnchorOffset,
3047: y);
3048: } else if (anchor == ItemLabelAnchor.INSIDE10) {
3049: result = new Point2D.Double(x - ADJ
3050: * this .itemLabelAnchorOffset, y - OPP
3051: * this .itemLabelAnchorOffset);
3052: } else if (anchor == ItemLabelAnchor.INSIDE11) {
3053: result = new Point2D.Double(x - OPP
3054: * this .itemLabelAnchorOffset, y - ADJ
3055: * this .itemLabelAnchorOffset);
3056: } else if (anchor == ItemLabelAnchor.INSIDE12) {
3057: result = new Point2D.Double(x, y
3058: - this .itemLabelAnchorOffset);
3059: } else if (anchor == ItemLabelAnchor.OUTSIDE1) {
3060: result = new Point2D.Double(x + 2.0 * OPP
3061: * this .itemLabelAnchorOffset, y - 2.0 * ADJ
3062: * this .itemLabelAnchorOffset);
3063: } else if (anchor == ItemLabelAnchor.OUTSIDE2) {
3064: result = new Point2D.Double(x + 2.0 * ADJ
3065: * this .itemLabelAnchorOffset, y - 2.0 * OPP
3066: * this .itemLabelAnchorOffset);
3067: } else if (anchor == ItemLabelAnchor.OUTSIDE3) {
3068: result = new Point2D.Double(x + 2.0
3069: * this .itemLabelAnchorOffset, y);
3070: } else if (anchor == ItemLabelAnchor.OUTSIDE4) {
3071: result = new Point2D.Double(x + 2.0 * ADJ
3072: * this .itemLabelAnchorOffset, y + 2.0 * OPP
3073: * this .itemLabelAnchorOffset);
3074: } else if (anchor == ItemLabelAnchor.OUTSIDE5) {
3075: result = new Point2D.Double(x + 2.0 * OPP
3076: * this .itemLabelAnchorOffset, y + 2.0 * ADJ
3077: * this .itemLabelAnchorOffset);
3078: } else if (anchor == ItemLabelAnchor.OUTSIDE6) {
3079: result = new Point2D.Double(x, y + 2.0
3080: * this .itemLabelAnchorOffset);
3081: } else if (anchor == ItemLabelAnchor.OUTSIDE7) {
3082: result = new Point2D.Double(x - 2.0 * OPP
3083: * this .itemLabelAnchorOffset, y + 2.0 * ADJ
3084: * this .itemLabelAnchorOffset);
3085: } else if (anchor == ItemLabelAnchor.OUTSIDE8) {
3086: result = new Point2D.Double(x - 2.0 * ADJ
3087: * this .itemLabelAnchorOffset, y + 2.0 * OPP
3088: * this .itemLabelAnchorOffset);
3089: } else if (anchor == ItemLabelAnchor.OUTSIDE9) {
3090: result = new Point2D.Double(x - 2.0
3091: * this .itemLabelAnchorOffset, y);
3092: } else if (anchor == ItemLabelAnchor.OUTSIDE10) {
3093: result = new Point2D.Double(x - 2.0 * ADJ
3094: * this .itemLabelAnchorOffset, y - 2.0 * OPP
3095: * this .itemLabelAnchorOffset);
3096: } else if (anchor == ItemLabelAnchor.OUTSIDE11) {
3097: result = new Point2D.Double(x - 2.0 * OPP
3098: * this .itemLabelAnchorOffset, y - 2.0 * ADJ
3099: * this .itemLabelAnchorOffset);
3100: } else if (anchor == ItemLabelAnchor.OUTSIDE12) {
3101: result = new Point2D.Double(x, y - 2.0
3102: * this .itemLabelAnchorOffset);
3103: }
3104: return result;
3105: }
3106:
3107: /**
3108: * Registers an object to receive notification of changes to the renderer.
3109: *
3110: * @param listener the listener (<code>null</code> not permitted).
3111: */
3112: public void addChangeListener(RendererChangeListener listener) {
3113: if (listener == null) {
3114: throw new IllegalArgumentException(
3115: "Null 'listener' argument.");
3116: }
3117: this .listenerList.add(RendererChangeListener.class, listener);
3118: }
3119:
3120: /**
3121: * Deregisters an object so that it no longer receives
3122: * notification of changes to the renderer.
3123: *
3124: * @param listener the object (<code>null</code> not permitted).
3125: */
3126: public void removeChangeListener(RendererChangeListener listener) {
3127: if (listener == null) {
3128: throw new IllegalArgumentException(
3129: "Null 'listener' argument.");
3130: }
3131: this .listenerList
3132: .remove(RendererChangeListener.class, listener);
3133: }
3134:
3135: /**
3136: * Returns <code>true</code> if the specified object is registered with
3137: * the dataset as a listener. Most applications won't need to call this
3138: * method, it exists mainly for use by unit testing code.
3139: *
3140: * @param listener the listener.
3141: *
3142: * @return A boolean.
3143: */
3144: public boolean hasListener(EventListener listener) {
3145: List list = Arrays.asList(this .listenerList.getListenerList());
3146: return list.contains(listener);
3147: }
3148:
3149: /**
3150: * Sends a {@link RendererChangeEvent} to all registered listeners.
3151: *
3152: * @since 1.0.5
3153: */
3154: protected void fireChangeEvent() {
3155:
3156: // the commented out code would be better, but only if
3157: // RendererChangeEvent is immutable, which it isn't. See if there is
3158: // a way to fix this...
3159:
3160: //if (this.event == null) {
3161: // this.event = new RendererChangeEvent(this);
3162: //}
3163: //notifyListeners(this.event);
3164:
3165: notifyListeners(new RendererChangeEvent(this ));
3166: }
3167:
3168: /**
3169: * Notifies all registered listeners that the renderer has been modified.
3170: *
3171: * @param event information about the change event.
3172: */
3173: public void notifyListeners(RendererChangeEvent event) {
3174: Object[] ls = this .listenerList.getListenerList();
3175: for (int i = ls.length - 2; i >= 0; i -= 2) {
3176: if (ls[i] == RendererChangeListener.class) {
3177: ((RendererChangeListener) ls[i + 1])
3178: .rendererChanged(event);
3179: }
3180: }
3181: }
3182:
3183: /**
3184: * Tests this renderer for equality with another object.
3185: *
3186: * @param obj the object (<code>null</code> permitted).
3187: *
3188: * @return <code>true</code> or <code>false</code>.
3189: */
3190: public boolean equals(Object obj) {
3191: if (obj == this ) {
3192: return true;
3193: }
3194: if (!(obj instanceof AbstractRenderer)) {
3195: return false;
3196: }
3197: AbstractRenderer that = (AbstractRenderer) obj;
3198: if (!ObjectUtilities.equal(this .seriesVisible,
3199: that.seriesVisible)) {
3200: return false;
3201: }
3202: if (!this .seriesVisibleList.equals(that.seriesVisibleList)) {
3203: return false;
3204: }
3205: if (this .baseSeriesVisible != that.baseSeriesVisible) {
3206: return false;
3207: }
3208: if (!ObjectUtilities.equal(this .seriesVisibleInLegend,
3209: that.seriesVisibleInLegend)) {
3210: return false;
3211: }
3212: if (!this .seriesVisibleInLegendList
3213: .equals(that.seriesVisibleInLegendList)) {
3214: return false;
3215: }
3216: if (this .baseSeriesVisibleInLegend != that.baseSeriesVisibleInLegend) {
3217: return false;
3218: }
3219: if (!PaintUtilities.equal(this .paint, that.paint)) {
3220: return false;
3221: }
3222: if (!ObjectUtilities.equal(this .paintList, that.paintList)) {
3223: return false;
3224: }
3225: if (!PaintUtilities.equal(this .basePaint, that.basePaint)) {
3226: return false;
3227: }
3228: if (!PaintUtilities.equal(this .fillPaint, that.fillPaint)) {
3229: return false;
3230: }
3231: if (!ObjectUtilities.equal(this .fillPaintList,
3232: that.fillPaintList)) {
3233: return false;
3234: }
3235: if (!PaintUtilities.equal(this .baseFillPaint,
3236: that.baseFillPaint)) {
3237: return false;
3238: }
3239: if (!PaintUtilities.equal(this .outlinePaint, that.outlinePaint)) {
3240: return false;
3241: }
3242: if (!ObjectUtilities.equal(this .outlinePaintList,
3243: that.outlinePaintList)) {
3244: return false;
3245: }
3246: if (!PaintUtilities.equal(this .baseOutlinePaint,
3247: that.baseOutlinePaint)) {
3248: return false;
3249: }
3250: if (!ObjectUtilities.equal(this .stroke, that.stroke)) {
3251: return false;
3252: }
3253: if (!ObjectUtilities.equal(this .strokeList, that.strokeList)) {
3254: return false;
3255: }
3256: if (!ObjectUtilities.equal(this .baseStroke, that.baseStroke)) {
3257: return false;
3258: }
3259: if (!ObjectUtilities.equal(this .outlineStroke,
3260: that.outlineStroke)) {
3261: return false;
3262: }
3263: if (!ObjectUtilities.equal(this .outlineStrokeList,
3264: that.outlineStrokeList)) {
3265: return false;
3266: }
3267: if (!ObjectUtilities.equal(this .baseOutlineStroke,
3268: that.baseOutlineStroke)) {
3269: return false;
3270: }
3271: if (!ObjectUtilities.equal(this .shape, that.shape)) {
3272: return false;
3273: }
3274: if (!ObjectUtilities.equal(this .shapeList, that.shapeList)) {
3275: return false;
3276: }
3277: if (!ObjectUtilities.equal(this .baseShape, that.baseShape)) {
3278: return false;
3279: }
3280: if (!ObjectUtilities.equal(this .itemLabelsVisible,
3281: that.itemLabelsVisible)) {
3282: return false;
3283: }
3284: if (!ObjectUtilities.equal(this .itemLabelsVisibleList,
3285: that.itemLabelsVisibleList)) {
3286: return false;
3287: }
3288: if (!ObjectUtilities.equal(this .baseItemLabelsVisible,
3289: that.baseItemLabelsVisible)) {
3290: return false;
3291: }
3292: if (!ObjectUtilities.equal(this .itemLabelFont,
3293: that.itemLabelFont)) {
3294: return false;
3295: }
3296: if (!ObjectUtilities.equal(this .itemLabelFontList,
3297: that.itemLabelFontList)) {
3298: return false;
3299: }
3300: if (!ObjectUtilities.equal(this .baseItemLabelFont,
3301: that.baseItemLabelFont)) {
3302: return false;
3303: }
3304:
3305: if (!PaintUtilities.equal(this .itemLabelPaint,
3306: that.itemLabelPaint)) {
3307: return false;
3308: }
3309: if (!ObjectUtilities.equal(this .itemLabelPaintList,
3310: that.itemLabelPaintList)) {
3311: return false;
3312: }
3313: if (!PaintUtilities.equal(this .baseItemLabelPaint,
3314: that.baseItemLabelPaint)) {
3315: return false;
3316: }
3317:
3318: if (!ObjectUtilities.equal(this .positiveItemLabelPosition,
3319: that.positiveItemLabelPosition)) {
3320: return false;
3321: }
3322: if (!ObjectUtilities.equal(this .positiveItemLabelPositionList,
3323: that.positiveItemLabelPositionList)) {
3324: return false;
3325: }
3326: if (!ObjectUtilities.equal(this .basePositiveItemLabelPosition,
3327: that.basePositiveItemLabelPosition)) {
3328: return false;
3329: }
3330:
3331: if (!ObjectUtilities.equal(this .negativeItemLabelPosition,
3332: that.negativeItemLabelPosition)) {
3333: return false;
3334: }
3335: if (!ObjectUtilities.equal(this .negativeItemLabelPositionList,
3336: that.negativeItemLabelPositionList)) {
3337: return false;
3338: }
3339: if (!ObjectUtilities.equal(this .baseNegativeItemLabelPosition,
3340: that.baseNegativeItemLabelPosition)) {
3341: return false;
3342: }
3343: if (this .itemLabelAnchorOffset != that.itemLabelAnchorOffset) {
3344: return false;
3345: }
3346: if (!ObjectUtilities.equal(this .createEntities,
3347: that.createEntities)) {
3348: return false;
3349: }
3350: if (!ObjectUtilities.equal(this .createEntitiesList,
3351: that.createEntitiesList)) {
3352: return false;
3353: }
3354: if (this .baseCreateEntities != that.baseCreateEntities) {
3355: return false;
3356: }
3357: return true;
3358: }
3359:
3360: /**
3361: * Returns a hashcode for the renderer.
3362: *
3363: * @return The hashcode.
3364: */
3365: public int hashCode() {
3366: int result = 193;
3367: result = 37 * result + ObjectUtilities.hashCode(this .stroke);
3368: result = 37 * result
3369: + ObjectUtilities.hashCode(this .baseStroke);
3370: result = 37 * result
3371: + ObjectUtilities.hashCode(this .outlineStroke);
3372: result = 37 * result
3373: + ObjectUtilities.hashCode(this .baseOutlineStroke);
3374: return result;
3375: }
3376:
3377: /**
3378: * Returns an independent copy of the renderer.
3379: *
3380: * @return A clone.
3381: *
3382: * @throws CloneNotSupportedException if some component of the renderer
3383: * does not support cloning.
3384: */
3385: protected Object clone() throws CloneNotSupportedException {
3386: AbstractRenderer clone = (AbstractRenderer) super .clone();
3387:
3388: if (this .seriesVisibleList != null) {
3389: clone.seriesVisibleList = (BooleanList) this .seriesVisibleList
3390: .clone();
3391: }
3392:
3393: if (this .seriesVisibleInLegendList != null) {
3394: clone.seriesVisibleInLegendList = (BooleanList) this .seriesVisibleInLegendList
3395: .clone();
3396: }
3397:
3398: // 'paint' : immutable, no need to clone reference
3399: if (this .paintList != null) {
3400: clone.paintList = (PaintList) this .paintList.clone();
3401: }
3402: // 'basePaint' : immutable, no need to clone reference
3403:
3404: if (this .fillPaintList != null) {
3405: clone.fillPaintList = (PaintList) this .fillPaintList
3406: .clone();
3407: }
3408: // 'outlinePaint' : immutable, no need to clone reference
3409: if (this .outlinePaintList != null) {
3410: clone.outlinePaintList = (PaintList) this .outlinePaintList
3411: .clone();
3412: }
3413: // 'baseOutlinePaint' : immutable, no need to clone reference
3414:
3415: // 'stroke' : immutable, no need to clone reference
3416: if (this .strokeList != null) {
3417: clone.strokeList = (StrokeList) this .strokeList.clone();
3418: }
3419: // 'baseStroke' : immutable, no need to clone reference
3420:
3421: // 'outlineStroke' : immutable, no need to clone reference
3422: if (this .outlineStrokeList != null) {
3423: clone.outlineStrokeList = (StrokeList) this .outlineStrokeList
3424: .clone();
3425: }
3426: // 'baseOutlineStroke' : immutable, no need to clone reference
3427:
3428: if (this .shape != null) {
3429: clone.shape = ShapeUtilities.clone(this .shape);
3430: }
3431: if (this .shapeList != null) {
3432: clone.shapeList = (ShapeList) this .shapeList.clone();
3433: }
3434: if (this .baseShape != null) {
3435: clone.baseShape = ShapeUtilities.clone(this .baseShape);
3436: }
3437:
3438: // 'itemLabelsVisible' : immutable, no need to clone reference
3439: if (this .itemLabelsVisibleList != null) {
3440: clone.itemLabelsVisibleList = (BooleanList) this .itemLabelsVisibleList
3441: .clone();
3442: }
3443: // 'basePaint' : immutable, no need to clone reference
3444:
3445: // 'itemLabelFont' : immutable, no need to clone reference
3446: if (this .itemLabelFontList != null) {
3447: clone.itemLabelFontList = (ObjectList) this .itemLabelFontList
3448: .clone();
3449: }
3450: // 'baseItemLabelFont' : immutable, no need to clone reference
3451:
3452: // 'itemLabelPaint' : immutable, no need to clone reference
3453: if (this .itemLabelPaintList != null) {
3454: clone.itemLabelPaintList = (PaintList) this .itemLabelPaintList
3455: .clone();
3456: }
3457: // 'baseItemLabelPaint' : immutable, no need to clone reference
3458:
3459: // 'postiveItemLabelAnchor' : immutable, no need to clone reference
3460: if (this .positiveItemLabelPositionList != null) {
3461: clone.positiveItemLabelPositionList = (ObjectList) this .positiveItemLabelPositionList
3462: .clone();
3463: }
3464: // 'baseItemLabelAnchor' : immutable, no need to clone reference
3465:
3466: // 'negativeItemLabelAnchor' : immutable, no need to clone reference
3467: if (this .negativeItemLabelPositionList != null) {
3468: clone.negativeItemLabelPositionList = (ObjectList) this .negativeItemLabelPositionList
3469: .clone();
3470: }
3471: // 'baseNegativeItemLabelAnchor' : immutable, no need to clone reference
3472:
3473: if (this .createEntitiesList != null) {
3474: clone.createEntitiesList = (BooleanList) this .createEntitiesList
3475: .clone();
3476: }
3477: clone.listenerList = new EventListenerList();
3478: clone.event = null;
3479: return clone;
3480: }
3481:
3482: /**
3483: * Provides serialization support.
3484: *
3485: * @param stream the output stream.
3486: *
3487: * @throws IOException if there is an I/O error.
3488: */
3489: private void writeObject(ObjectOutputStream stream)
3490: throws IOException {
3491:
3492: stream.defaultWriteObject();
3493: SerialUtilities.writePaint(this .paint, stream);
3494: SerialUtilities.writePaint(this .basePaint, stream);
3495: SerialUtilities.writePaint(this .fillPaint, stream);
3496: SerialUtilities.writePaint(this .baseFillPaint, stream);
3497: SerialUtilities.writePaint(this .outlinePaint, stream);
3498: SerialUtilities.writePaint(this .baseOutlinePaint, stream);
3499: SerialUtilities.writeStroke(this .stroke, stream);
3500: SerialUtilities.writeStroke(this .baseStroke, stream);
3501: SerialUtilities.writeStroke(this .outlineStroke, stream);
3502: SerialUtilities.writeStroke(this .baseOutlineStroke, stream);
3503: SerialUtilities.writeShape(this .shape, stream);
3504: SerialUtilities.writeShape(this .baseShape, stream);
3505: SerialUtilities.writePaint(this .itemLabelPaint, stream);
3506: SerialUtilities.writePaint(this .baseItemLabelPaint, stream);
3507:
3508: }
3509:
3510: /**
3511: * Provides serialization support.
3512: *
3513: * @param stream the input stream.
3514: *
3515: * @throws IOException if there is an I/O error.
3516: * @throws ClassNotFoundException if there is a classpath problem.
3517: */
3518: private void readObject(ObjectInputStream stream)
3519: throws IOException, ClassNotFoundException {
3520:
3521: stream.defaultReadObject();
3522: this .paint = SerialUtilities.readPaint(stream);
3523: this .basePaint = SerialUtilities.readPaint(stream);
3524: this .fillPaint = SerialUtilities.readPaint(stream);
3525: this .baseFillPaint = SerialUtilities.readPaint(stream);
3526: this .outlinePaint = SerialUtilities.readPaint(stream);
3527: this .baseOutlinePaint = SerialUtilities.readPaint(stream);
3528: this .stroke = SerialUtilities.readStroke(stream);
3529: this .baseStroke = SerialUtilities.readStroke(stream);
3530: this .outlineStroke = SerialUtilities.readStroke(stream);
3531: this .baseOutlineStroke = SerialUtilities.readStroke(stream);
3532: this .shape = SerialUtilities.readShape(stream);
3533: this .baseShape = SerialUtilities.readShape(stream);
3534: this .itemLabelPaint = SerialUtilities.readPaint(stream);
3535: this .baseItemLabelPaint = SerialUtilities.readPaint(stream);
3536:
3537: // listeners are not restored automatically, but storage must be
3538: // provided...
3539: this .listenerList = new EventListenerList();
3540:
3541: }
3542:
3543: }
|