001/* ===========================================================
002 * Orson Charts : a 3D chart library for the Java(tm) platform
003 * ===========================================================
004 * 
005 * (C)opyright 2013-2022, by David Gilbert.  All rights reserved.
006 * 
007 * https://github.com/jfree/orson-charts
008 * 
009 * This program is free software: you can redistribute it and/or modify
010 * it under the terms of the GNU General Public License as published by
011 * the Free Software Foundation, either version 3 of the License, or
012 * (at your option) any later version.
013 *
014 * This program is distributed in the hope that it will be useful,
015 * but WITHOUT ANY WARRANTY; without even the implied warranty of
016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
017 * GNU General Public License for more details.
018 *
019 * You should have received a copy of the GNU General Public License
020 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
021 * 
022 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
023 * Other names may be trademarks of their respective owners.]
024 * 
025 * If you do not wish to be bound by the terms of the GPL, an alternative
026 * commercial license can be purchased.  For details, please see visit the
027 * Orson Charts home page:
028 * 
029 * http://www.object-refinery.com/orsoncharts/index.html
030 * 
031 */
032
033package org.jfree.chart3d.style;
034
035import java.awt.BasicStroke;
036import java.awt.Color;
037import java.awt.Font;
038import java.awt.Stroke;
039import java.awt.Shape;
040import java.awt.geom.Rectangle2D;
041import java.io.IOException;
042import java.io.ObjectInputStream;
043import java.io.ObjectOutputStream;
044import java.io.Serializable;
045import java.util.Arrays;
046
047import javax.swing.event.EventListenerList;
048import org.jfree.chart3d.Colors;
049import org.jfree.chart3d.internal.Args;
050import org.jfree.chart3d.internal.ChartBox3D;
051import org.jfree.chart3d.internal.SerialUtils;
052import org.jfree.chart3d.table.RectanglePainter;
053import org.jfree.chart3d.table.StandardRectanglePainter;
054
055/**
056 * A standard implementation of the {@link ChartStyle} interface.
057 * <br><br>
058 * NOTE: This class is serializable, but the serialization format is subject 
059 * to change in future releases and should not be relied upon for persisting 
060 * instances of this class.
061 * 
062 * @since 1.2
063 */
064@SuppressWarnings("serial")
065public class StandardChartStyle implements ChartStyle, Cloneable, Serializable {
066
067    /** The first font family to try (usually found on Windows). */
068    private static final String FONT_FAMILY_1 = "Palatino Linotype";
069
070    /** The second font family to try (usually found on MacOSX). */
071    private static final String FONT_FAMILY_2 = "Palatino";
072    
073    /**
074     * Creates a default font with the specified {@code style} and 
075     * {@code size}.  The method attempts to use 'Palatino Linotype' 
076     * ('Palatino' on MacOSX) but if it is not found it falls back to the
077     * {@code Font.SERIF} font family.
078     * 
079     * @param style  the style (see java.awt.Font).
080     * @param size  the size.
081     * 
082     * @return The font.
083     * 
084     * @since 1.3
085     */
086    public static Font createDefaultFont(int style, int size) {
087        Font f = new Font(FONT_FAMILY_1, style, size);
088        if ("Dialog".equals(f.getFamily())) {
089            f = new Font(FONT_FAMILY_2, style, size);
090            if ("Dialog".equals(f.getFamily())) {
091                f = new Font(Font.SERIF, style, size);
092            }
093        }
094        return f;
095    }
096    
097    /**
098     * The default background color for the title and subtitle, and legend
099     * header and footer. 
100     */
101    public static final Color DEFAULT_TEXT_BACKGROUND_COLOR 
102            = new Color(255, 255, 255, 100);
103
104    /** The default title font. */
105    public static final Font DEFAULT_TITLE_FONT 
106            = createDefaultFont(Font.PLAIN, 32);
107    
108    /** The default subtitle font. */
109    public static final Font DEFAULT_SUBTITLE_FONT 
110            = createDefaultFont(Font.PLAIN, 18);
111 
112    /** The default chartbox color. */
113    public static final Color DEFAULT_CHARTBOX_COLOR = new Color(255, 255, 255,
114            100);
115    
116    /** The default visibility for gridlines perpendicular to the row-axis. */
117    public static final boolean DEFAULT_ROW_GRIDLINES_VISIBLE = false;
118    
119    /** The default visibility for gridlines perpendicular to the column-axis. */
120    public static final boolean DEFAULT_COLUMN_GRIDLINES_VISIBLE = false;
121
122    /** The default visibility for gridlines perpendicular to the x-axis. */
123    public static final boolean DEFAULT_X_GRIDLINES_VISIBLE = true;
124    
125    /** The default visibility for gridlines perpendicular to the y-axis. */
126    public static final boolean DEFAULT_Y_GRIDLINES_VISIBLE = true;
127    
128    /** The default visibility for gridlines perpendicular to the z-axis. */
129    public static final boolean DEFAULT_Z_GRIDLINES_VISIBLE = true;
130    
131    /** The default gridline color. */
132    public static final Color DEFAULT_GRIDLINE_COLOR = Color.GRAY;
133    
134    /** The default gridline stroke. */
135    public static final Stroke DEFAULT_GRIDLINE_STROKE = new BasicStroke(0f);
136    
137    /** The default font for pie section labels. */
138    public static final Font DEFAULT_SECTION_LABEL_FONT = createDefaultFont(
139            Font.PLAIN, 14);
140    
141    /** The default color for pie section labels. */
142    public static final Color DEFAULT_SECTION_LABEL_COLOR = Color.BLACK;
143
144    /** The default font for axis labels. */
145    public static final Font DEFAULT_AXIS_LABEL_FONT 
146            = createDefaultFont(Font.BOLD, 12);
147    
148    /** The default foreground color for axis labels. */
149    public static final Color DEFAULT_AXIS_LABEL_COLOR = Color.BLACK;
150
151    /** The default font for axis tick labels. */
152    public static final Font DEFAULT_AXIS_TICK_LABEL_FONT 
153            = createDefaultFont(Font.PLAIN, 12);
154
155    /** The default foreground color for axis tick labels. */
156    public static final Color DEFAULT_AXIS_TICK_LABEL_COLOR = Color.BLACK;
157
158    /** The default font for legend headers. */
159    public static final Font DEFAULT_LEGEND_HEADER_FONT = createDefaultFont(
160            Font.BOLD, 14);
161    
162    /** The default foreground color for the legend header if there is one. */
163    public static final Color DEFAULT_LEGEND_HEADER_COLOR = Color.BLACK;
164    
165    /** The default legend item shape. */
166    public static final Shape DEFAULT_LEGEND_ITEM_SHAPE 
167            = new Rectangle2D.Double(-6, -4, 12, 8);
168
169    /** The default font for legend item text. */
170    public static final Font DEFAULT_LEGEND_ITEM_FONT = createDefaultFont(
171            Font.PLAIN, 12);
172
173    /** The default legend item color. */
174    public static final Color DEFAULT_LEGEND_ITEM_COLOR = Color.BLACK;
175    
176    /** The default legend item background color. */
177    public static final Color DEFAULT_LEGEND_ITEM_BACKGROUND_COLOR 
178            = new Color(255, 255, 255, 100);
179
180    /** The default font for legend footers. */
181    public static final Font DEFAULT_LEGEND_FOOTER_FONT = createDefaultFont(
182            Font.PLAIN, 10);
183
184    /** The default foreground color for the legend footer if there is one. */
185    public static final Color DEFAULT_LEGEND_FOOTER_COLOR = Color.BLACK;
186
187    /** The default font for marker labels. */
188    public static final Font DEFAULT_MARKER_LABEL_FONT = createDefaultFont(
189            Font.PLAIN, 10);
190    
191    /** The default foreground color for marker labels. */
192    public static final Color DEFAULT_MARKER_LABEL_COLOR = Color.DARK_GRAY;
193    
194    /** The default stroke for marker lines. */
195    public static final Stroke DEFAULT_MARKER_LINE_STROKE = new BasicStroke(
196            2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
197    
198    /** The default color for marker lines. */
199    public static final Color DEFAULT_MARKER_LINE_COLOR = Color.DARK_GRAY;
200    
201    /** The default fill color for markers. */
202    public static final Color DEFAULT_MARKER_FILL_COLOR 
203            = new Color(127, 127, 127, 63);
204
205    /** The background painter. */
206    private RectanglePainter backgroundPainter;
207    
208    /** The chart title font. */
209    private Font titleFont;
210    
211    /** The foreground color for the chart title. */
212    private Color titleColor;
213    
214    /** The background color for the chart title. */
215    private Color titleBackgroundColor;
216
217    /** The chart subtitle font. */
218    private Font subtitleFont;
219    
220    /** The foreground color for the chart subtitle. */
221    private Color subtitleColor;
222    
223    /** The background color for the chart subtitle. */
224    private Color subtitleBackgroundColor;
225    
226    /** The color for the chart box, if there is one. */
227    private Color chartBoxColor;
228    
229    /** Are gridlines visible for the row-axis? */
230    private boolean rowAxisGridlinesVisible;
231    
232    /** Are gridlines visible for the column-axis? */
233    private boolean columnAxisGridlinesVisible;
234
235    /** Are gridlines visible for the x-axis? */
236    private boolean xAxisGridlinesVisible;
237    
238    /** Are gridlines visible for the y-axis? */
239    private boolean yAxisGridlinesVisible;
240    
241    /** Are gridlines visible for the z-axis? */
242    private boolean zAxisGridlinesVisible;
243    
244    /** The gridline color. */
245    private Color gridlineColor;
246    
247    /** The gridline stroke. */
248    private transient Stroke gridlineStroke;
249    
250    /** The font for pie section labels. */
251    private Font sectionLabelFont;
252    
253    /** The foreground color for pie section labels. */
254    private Color sectionLabelColor;
255    
256    /** The standard colors (to color pie sections or data series). */
257    private Color[] standardColors;
258    
259    /** The axis label font. */
260    private Font axisLabelFont;
261    
262    /** The color for the axis label. */
263    private Color axisLabelColor;
264    
265    /** The axis tick label font. */
266    private Font axisTickLabelFont;
267    
268    /** The color used to draw axis tick labels. */
269    private Color axisTickLabelColor;
270    
271    /** The legend header font. */
272    private Font legendHeaderFont;
273    
274    /** The legend header foreground color. */
275    private Color legendHeaderColor;
276    
277    /** The legend header background color. */
278    private Color legendHeaderBackgroundColor;
279    
280    /** The legend item shape. */
281    private Shape legendItemShape;
282
283    /** The legend item font. */
284    private Font legendItemFont;
285    
286    /** The legend item color. */
287    private Color legendItemColor;
288    
289    /** The legend item background color. */
290    private Color legendItemBackgroundColor;
291    
292    /** The legend footer font. */
293    private Font legendFooterFont;
294    
295    /** The foreground color for the legend footer if there is one. */
296    private Color legendFooterColor;
297    
298    /** The background color for the legend footer if there is one. */
299    private Color legendFooterBackgroundColor;
300
301    /** The font used to draw marker labels. */
302    private Font markerLabelFont;
303  
304    /** The color used to draw marker labels. */
305    private Color markerLabelColor;
306    
307    /** The stroke used to draw marker lines. */
308    private transient Stroke markerLineStroke;
309    
310    /** The color used to draw marker lines. */
311    private Color markerLineColor;
312    
313    /** The color used to fill the band representing the marker range. */
314    private Color markerFillColor;
315    
316    /** Storage for registered change listeners. */
317    private transient EventListenerList listenerList;
318
319    /**
320     * A flag that controls whether or not the chart will notify listeners
321     * of changes (defaults to {@code true}, but sometimes it is useful 
322     * to disable this).
323     */
324    private boolean notify;
325
326    /**
327     * Creates a new instance with default attributes.
328     */
329    public StandardChartStyle() {
330        this.backgroundPainter = new StandardRectanglePainter(Color.WHITE);
331        this.titleFont = DEFAULT_TITLE_FONT;
332        this.titleColor = Color.BLACK;
333        this.titleBackgroundColor = DEFAULT_TEXT_BACKGROUND_COLOR;
334        this.subtitleColor = Color.BLACK;
335        this.subtitleBackgroundColor = DEFAULT_TEXT_BACKGROUND_COLOR;
336        this.subtitleFont = DEFAULT_SUBTITLE_FONT;
337        this.chartBoxColor = DEFAULT_CHARTBOX_COLOR;
338        this.rowAxisGridlinesVisible = DEFAULT_ROW_GRIDLINES_VISIBLE;
339        this.columnAxisGridlinesVisible = DEFAULT_COLUMN_GRIDLINES_VISIBLE;
340        this.xAxisGridlinesVisible = DEFAULT_X_GRIDLINES_VISIBLE;
341        this.yAxisGridlinesVisible = DEFAULT_Y_GRIDLINES_VISIBLE;
342        this.zAxisGridlinesVisible = DEFAULT_Z_GRIDLINES_VISIBLE;
343        this.gridlineColor = DEFAULT_GRIDLINE_COLOR;
344        this.gridlineStroke = DEFAULT_GRIDLINE_STROKE;
345        this.sectionLabelFont = DEFAULT_SECTION_LABEL_FONT;
346        this.sectionLabelColor = DEFAULT_SECTION_LABEL_COLOR;
347        this.standardColors = Colors.getDefaultColors();
348        this.axisLabelFont = DEFAULT_AXIS_LABEL_FONT;
349        this.axisLabelColor = DEFAULT_AXIS_LABEL_COLOR;
350        this.axisTickLabelFont = DEFAULT_AXIS_TICK_LABEL_FONT;
351        this.axisTickLabelColor = DEFAULT_AXIS_TICK_LABEL_COLOR;
352        this.legendHeaderFont = DEFAULT_LEGEND_HEADER_FONT;
353        this.legendHeaderColor = DEFAULT_LEGEND_HEADER_COLOR;
354        this.legendHeaderBackgroundColor = DEFAULT_TEXT_BACKGROUND_COLOR;
355        this.legendItemShape = DEFAULT_LEGEND_ITEM_SHAPE;
356        this.legendItemFont = DEFAULT_LEGEND_ITEM_FONT;
357        this.legendItemColor = DEFAULT_LEGEND_ITEM_COLOR;
358        this.legendItemBackgroundColor = DEFAULT_LEGEND_ITEM_BACKGROUND_COLOR;
359        this.legendFooterFont = DEFAULT_LEGEND_FOOTER_FONT;
360        this.legendFooterColor = DEFAULT_LEGEND_FOOTER_COLOR;
361        this.legendFooterBackgroundColor = DEFAULT_TEXT_BACKGROUND_COLOR;
362        this.markerLabelFont = DEFAULT_MARKER_LABEL_FONT;
363        this.markerLabelColor = DEFAULT_MARKER_LABEL_COLOR;
364        this.markerLineStroke = DEFAULT_MARKER_LINE_STROKE;
365        this.markerLineColor = DEFAULT_MARKER_LINE_COLOR;
366        this.markerFillColor = DEFAULT_MARKER_FILL_COLOR;
367        this.listenerList = new EventListenerList();
368        this.notify = true;
369    }
370    
371    /**
372     * A copy constructor that creates a new style that is a copy of an
373     * existing style (note that the existing style listeners are not copied).
374     * 
375     * @param source  the source style to copy ({@code null} not 
376     *         permitted).
377     */
378    public StandardChartStyle(StandardChartStyle source) {
379        Args.nullNotPermitted(source, "source");
380        this.backgroundPainter = source.getBackgroundPainter();
381        this.titleFont = source.getTitleFont();
382        this.titleColor = source.getTitleColor();
383        this.titleBackgroundColor = source.getTitleBackgroundColor();
384        this.subtitleFont = source.getSubtitleFont();
385        this.subtitleColor = source.getSubtitleColor();
386        this.subtitleBackgroundColor = source.getSubtitleBackgroundColor();
387        this.chartBoxColor = source.getChartBoxColor();
388        this.xAxisGridlinesVisible = source.getXAxisGridlinesVisible();
389        this.yAxisGridlinesVisible = source.getYAxisGridlinesVisible();
390        this.zAxisGridlinesVisible = source.getZAxisGridlinesVisible();
391        this.sectionLabelFont = source.getSectionLabelFont();
392        this.sectionLabelColor = source.getSectionLabelColor();
393        this.standardColors = source.getStandardColors();
394        this.gridlineColor = source.getGridlineColor();
395        this.gridlineStroke = source.getGridlineStroke();
396        this.axisLabelFont = source.getAxisLabelFont();
397        this.axisLabelColor = source.getAxisLabelColor();
398        this.axisTickLabelFont = source.getAxisTickLabelFont();
399        this.axisTickLabelColor = source.getAxisTickLabelColor();
400        this.legendHeaderFont = source.getLegendHeaderFont();
401        this.legendHeaderColor = source.getLegendHeaderColor();
402        this.legendHeaderBackgroundColor 
403                = source.getLegendHeaderBackgroundColor();
404        this.legendItemShape = source.getLegendItemShape();
405        this.legendItemFont = source.getLegendItemFont();
406        this.legendItemColor = source.getLegendItemColor();
407        this.legendItemBackgroundColor = source.getLegendItemBackgroundColor();
408        this.legendFooterFont = source.getLegendFooterFont();
409        this.legendFooterColor = source.getLegendFooterColor();
410        this.legendFooterBackgroundColor 
411                = source.getLegendFooterBackgroundColor();
412        this.markerLabelFont = source.getMarkerLabelFont();
413        this.markerLabelColor = source.getMarkerLabelColor();
414        this.markerLineStroke = source.getMarkerLineStroke();
415        this.markerLineColor = source.getMarkerLineColor();
416        this.markerFillColor = source.getMarkerFillColor();
417        this.listenerList = new EventListenerList();
418        this.notify = true;        
419    }
420    
421    /**
422     * Returns the background painter.
423     * 
424     * @return The background painter (never {@code null}). 
425     */
426    @Override
427    public RectanglePainter getBackgroundPainter() {
428        return this.backgroundPainter;
429    }
430    
431    /**
432     * Sets the background painter.
433     * 
434     * @param painter  the painter ({@code null} not permitted). 
435     */
436    public void setBackgroundPainter(RectanglePainter painter) {
437        Args.nullNotPermitted(painter, "painter");
438        this.backgroundPainter = painter;
439        fireChangeEvent();
440    }
441    
442    /**
443     * Returns the chart title font.  The default value is 
444     * {@link #DEFAULT_TITLE_FONT}.
445     * 
446     * @return The chart title font (never {@code null}). 
447     */
448    @Override
449    public Font getTitleFont() {
450        return this.titleFont;
451    }
452    
453    /**
454     * Sets the font used for the chart title and sends a 
455     * {@link ChartStyleChangeEvent} to all registered listeners.
456     * 
457     * @param font  the font ({@code null} not permitted). 
458     */
459    public void setTitleFont(Font font) {
460        Args.nullNotPermitted(font, "font");
461        this.titleFont = font;
462        fireChangeEvent();
463    }
464    
465    /**
466     * Returns the title color.  The default value is {@link Color#BLACK}.
467     * 
468     * @return The title color (never {@code null}). 
469     */
470    @Override
471    public Color getTitleColor() {
472        return this.titleColor;
473    }
474    
475    /**
476     * Sets the foreground color for the chart title and sends a 
477     * change event to all registered listeners.
478     * 
479     * @param color  the color ({@code null} not permitted).
480     */
481    public void setTitleColor(Color color) {
482        this.titleColor = color;
483        fireChangeEvent();
484    }
485    
486    /**
487     * Returns the background color for the title.  The default value is
488     * {@link #DEFAULT_TEXT_BACKGROUND_COLOR}.
489     * 
490     * @return The background color (never {@code null}). 
491     */
492    @Override
493    public Color getTitleBackgroundColor() {
494        return this.titleBackgroundColor;
495    }
496    
497    /**
498     * Sets the background color for the title and sends a 
499     * change event to all registered listeners.
500     * 
501     * @param color  the color ({@code null} not permitted). 
502     */
503    public void setTitleBackgroundColor(Color color) {
504        this.titleBackgroundColor = color;
505        fireChangeEvent();
506    }
507    
508    /**
509     * Returns the font used for the chart subtitle.  The default value 
510     * is {@link #DEFAULT_SUBTITLE_FONT}.
511     * 
512     * @return The chart subtitle font (never {@code null}). 
513     */
514    @Override
515    public Font getSubtitleFont() {
516        return this.subtitleFont;
517    }
518
519    /**
520     * Sets the font used for the chart subtitle and sends a 
521     * {@link ChartStyleChangeEvent} to all registered listeners.
522     * 
523     * @param font  the font ({@code null} not permitted). 
524     */
525    public void setSubtitleFont(Font font) {
526        Args.nullNotPermitted(font, "font");
527        this.subtitleFont = font;
528        fireChangeEvent();
529    }
530   
531    /**
532     * Returns the color for the chart subtitle.  The default value is 
533     * {@link Color#BLACK}.
534     * 
535     * @return The color (never {@code null}).
536     */
537    @Override
538    public Color getSubtitleColor() {
539        return this.subtitleColor;
540    }
541    
542    /**
543     * Sets the color for the chart subtitle and sends a 
544     * change event to all registered listeners.
545     * 
546     * @param color  the color ({@code null} not permitted). 
547     */
548    public void setSubtitleColor(Color color) {
549        Args.nullNotPermitted(color, "color");
550        this.subtitleColor = color;
551        fireChangeEvent();
552    }
553    
554    /**
555     * Returns the background color for the chart subtitle.  The default value
556     * is {@link #DEFAULT_TEXT_BACKGROUND_COLOR}.
557     * 
558     * @return The background color (never {@code null}). 
559     */
560    @Override
561    public Color getSubtitleBackgroundColor() {
562        return this.subtitleBackgroundColor;
563    }
564    
565    /**
566     * Sets the background color for the chart subtitle and sends a 
567     * change event to all registered listeners.
568     * 
569     * @param color  the color ({@code null} not permitted). 
570     */
571    public void setSubtitleBackgroundColor(Color color) {
572        Args.nullNotPermitted(color, "color");
573        this.subtitleBackgroundColor = color;
574        fireChangeEvent();
575    }
576
577    /**
578     * Returns the color used for the {@link ChartBox3D} (for those charts that
579     * have one).  The default value is {@link #DEFAULT_CHARTBOX_COLOR}.
580     * 
581     * @return The color (never {@code null}). 
582     */
583    @Override
584    public Color getChartBoxColor() {
585        return this.chartBoxColor;
586    }
587    
588    /**
589     * Sets the color used for the chart box and sends a 
590     * {@link ChartStyleChangeEvent} to all registered listeners.
591     * 
592     * @param color  the color ({@code null} not permitted). 
593     */
594    public void setChartBoxColor(Color color) {
595        Args.nullNotPermitted(color, "color");
596        this.chartBoxColor = color;
597        fireChangeEvent();
598    }
599    
600    /**
601     * Returns the flag that controls whether or not gridlines are drawn 
602     * perpendicular to the column axis in category plots.
603     * 
604     * @return A boolean. 
605     */
606    @Override
607    public boolean getColumnAxisGridlinesVisible() {
608        return this.columnAxisGridlinesVisible;
609    }
610    
611    /**
612     * Returns the flag that controls whether or not gridlines are drawn 
613     * perpendicular to the row axis in category plots.
614     * 
615     * @return A boolean. 
616     */
617    @Override
618    public boolean getRowAxisGridlinesVisible() {
619        return this.rowAxisGridlinesVisible;
620    }
621
622    /**
623     * Returns the flag that specifies whether or not gridlines are drawn for
624     * the x-axis.  The default value is {@code false}.
625     * 
626     * @return A boolean. 
627     */
628    @Override
629    public boolean getXAxisGridlinesVisible() {
630        return this.xAxisGridlinesVisible;
631    }
632    
633    /**
634     * Sets the flag that controls whether or not gridlines are drawn for 
635     * the x-axis and sends a {@link ChartStyleChangeEvent}  to all 
636     * registered listeners.
637     * 
638     * @param visible  the new flag value. 
639     */
640    public void setXAxisGridlinesVisible(boolean visible) {
641        this.xAxisGridlinesVisible = visible;
642        fireChangeEvent();
643    }
644    
645    /**
646     * Returns the flag that specifies whether or not gridlines are drawn for
647     * the y-axis.  The default value is {@code true}.
648     * 
649     * @return A boolean. 
650     */
651    @Override
652    public boolean getYAxisGridlinesVisible() {
653        return this.yAxisGridlinesVisible;
654    }
655    
656    /**
657     * Sets the flag that controls whether or not gridlines are drawn for 
658     * the y-axis and sends a {@link ChartStyleChangeEvent}  to all 
659     * registered listeners.
660     * 
661     * @param visible  the new flag value. 
662     */
663    public void setYAxisGridlinesVisible(boolean visible) {
664        this.yAxisGridlinesVisible = visible;
665        fireChangeEvent();
666    }
667
668    /**
669     * Returns the flag that specifies whether or not gridlines are drawn for
670     * the z-axis.  The default value is {@code true}.
671     * 
672     * @return A boolean. 
673     */
674    @Override
675    public boolean getZAxisGridlinesVisible() {
676        return this.zAxisGridlinesVisible;
677    }
678    
679    /**
680     * Sets the flag that controls whether or not gridlines are drawn for 
681     * the z-axis and sends a {@link ChartStyleChangeEvent}  to all 
682     * registered listeners.
683     * 
684     * @param visible  the new flag value. 
685     */
686    public void setZAxisGridlinesVisible(boolean visible) {
687        this.zAxisGridlinesVisible = visible;
688        fireChangeEvent();
689    }
690
691    /**
692     * Returns the color used for the gridlines.  The default value is
693     * {@link #DEFAULT_GRIDLINE_STROKE}.
694     * 
695     * @return The color used for the gridlines (never {@code null}).
696     */
697    @Override
698    public Color getGridlineColor() {
699        return this.gridlineColor;
700    }
701    
702    /**
703     * Sets the color for the gridlines and sends a 
704     * {@link ChartStyleChangeEvent} to all registered listeners.
705     * 
706     * @param color  the color ({@code null} not permitted). 
707     */
708    public void setGridlineColor(Color color) {
709        Args.nullNotPermitted(color, "color");
710        this.gridlineColor = color;
711        fireChangeEvent();
712    }
713    
714    /**
715     * Returns the stroke used to draw the gridlines.  The default value is
716     * {@link #DEFAULT_GRIDLINE_STROKE}.
717     * 
718     * @return The stroke (never {@code null}).
719     */
720    @Override
721    public Stroke getGridlineStroke() {
722        return this.gridlineStroke;
723    }
724
725    /**
726     * Sets the stroke used for gridlines and sends a 
727     * {@link ChartStyleChangeEvent} to all registered listeners.
728     * 
729     * @param stroke  the stroke ({@code null} not permitted).
730     */
731    public void setGridlineStroke(Stroke stroke) {
732        Args.nullNotPermitted(stroke, "stroke");
733        this.gridlineStroke = stroke;
734        fireChangeEvent();
735    }
736    /**
737     * Returns the font used for pie section labels.  The default value is
738     * {@link #DEFAULT_SECTION_LABEL_FONT}.
739     * 
740     * @return The font used for pie section labels (never {@code null}).
741     */
742    @Override
743    public Font getSectionLabelFont() {
744        return this.sectionLabelFont;
745    }
746    
747    /**
748     * Sets the font used for the pie section labels and sends a 
749     * {@link ChartStyleChangeEvent} to all registered listeners.
750     * 
751     * @param font  the font ({@code null} not permitted). 
752     */
753    public void setSectionLabelFont(Font font) {
754        Args.nullNotPermitted(font, "font");
755        this.sectionLabelFont = font;
756        fireChangeEvent();
757    }
758    
759    /**
760     * Returns the color used to display pie section labels.  The default
761     * value is {@link #DEFAULT_SECTION_LABEL_COLOR}.
762     * 
763     * @return The color (never {@code null}). 
764     */
765    @Override
766    public Color getSectionLabelColor() {
767        return this.sectionLabelColor;
768    }
769
770    /**
771     * Sets the color used for the pie section labels and sends a 
772     * {@link ChartStyleChangeEvent} to all registered listeners.
773     * 
774     * @param color  the color ({@code null} not permitted). 
775     */
776    public void setSectionLabelColor(Color color) {
777        Args.nullNotPermitted(color, "color");
778        this.sectionLabelColor = color;
779        fireChangeEvent();
780    }
781    
782    /**
783     * Returns the standard colors for the style.  The default value is
784     * initialised by calling {@link Colors#getDefaultColors()}.
785     * 
786     * @return The standard colors (never {@code null}).
787     */
788    @Override
789    public Color[] getStandardColors() {
790        return this.standardColors;
791    }
792    
793    /**
794     * Sets the standard colors for the chart and sends a 
795     * {@link ChartStyleChangeEvent} to all registered listeners.
796     * 
797     * @param colors  the colors ({@code null} not permitted). 
798     */
799    public void setStandardColors(Color... colors) {
800        this.standardColors = colors;
801        fireChangeEvent();
802    }
803    
804    /**
805     * Returns the font used for the axis label.  The default value is 
806     * {@link #DEFAULT_AXIS_LABEL_FONT}.
807     * 
808     * @return The font used for the axis label.
809     */
810    @Override
811    public Font getAxisLabelFont() {
812        return this.axisLabelFont;
813    }
814    
815    /**
816     * Sets the font used for the axis label and sends a 
817     * {@link ChartStyleChangeEvent} to all registered listeners.
818     * 
819     * @param font  the font ({@code null} not permitted). 
820     */
821    public void setAxisLabelFont(Font font) {
822        Args.nullNotPermitted(font, "font");
823        this.axisLabelFont = font;
824        fireChangeEvent();
825    }
826
827    /**
828     * Returns the foreground color for the axis label (the main label, not
829     * the tick labels).  The default value is 
830     * {@link #DEFAULT_AXIS_LABEL_COLOR}.
831     * 
832     * @return The color (never {@code null}). 
833     */
834    @Override
835    public Color getAxisLabelColor() {
836        return this.axisLabelColor;
837    }
838    
839    /**
840     * Sets the foreground color for the axis label and sends a 
841     * {@link ChartStyleChangeEvent} to all registered listeners.
842     * 
843     * @param color  the color ({@code null} not permitted). 
844     */
845    public void setAxisLabelColor(Color color) {
846        Args.nullNotPermitted(color, "color");
847        this.axisLabelColor = color;
848        fireChangeEvent();
849    }
850    
851    /**
852     * Returns the font used for the axis tick labels.  The default value 
853     * is {@link #DEFAULT_AXIS_TICK_LABEL_FONT}.
854     * 
855     * @return The font (never {@code null}). 
856     */
857    @Override
858    public Font getAxisTickLabelFont() {
859        return this.axisTickLabelFont;
860    }
861    
862    /**
863     * Sets the font used for the axis tick labels and sends a 
864     * {@link ChartStyleChangeEvent} to all registered listeners.
865     * 
866     * @param font  the font ({@code null} not permitted). 
867     */
868    public void setAxisTickLabelFont(Font font) {
869        Args.nullNotPermitted(font, "font");
870        this.axisTickLabelFont = font;
871        fireChangeEvent();
872    }    
873
874    /**
875     * Returns the color used to draw the tick labels on the axis.  The 
876     * default value is {@link #DEFAULT_AXIS_TICK_LABEL_COLOR}.
877     * 
878     * @return The color (never {@code null}).
879     */
880    @Override
881    public Color getAxisTickLabelColor() {
882        return this.axisTickLabelColor;
883    }
884    
885    /**
886     * Sets the foreground color for the axis tick labels and sends a 
887     * {@link ChartStyleChangeEvent} to all registered listeners.
888     * 
889     * @param color  the color ({@code null} not permitted). 
890     */
891    public void setAxisTickLabelColor(Color color) {
892        Args.nullNotPermitted(color, "color");
893        this.axisTickLabelColor = color;
894        fireChangeEvent();
895    }
896    
897    /**
898     * Returns the font used to display the legend header.  The default 
899     * value is {@link #DEFAULT_LEGEND_HEADER_FONT}.
900     * 
901     * @return The font (never {@code null}). 
902     */
903    @Override
904    public Font getLegendHeaderFont() {
905        return this.legendHeaderFont;
906    }
907    
908    /**
909     * Sets the legend header font and sends a {@link ChartStyleChangeEvent} to
910     * all registered listeners.
911     * 
912     * @param font  the font ({@code null} not permitted). 
913     */
914    public void setLegendHeaderFont(Font font) {
915        Args.nullNotPermitted(font, "font");
916        this.legendHeaderFont = font;
917        fireChangeEvent();
918    }
919    
920    /**
921     * Returns the foreground color for the legend header.  The default value
922     * is {@link #DEFAULT_LEGEND_HEADER_COLOR}.
923     * 
924     * @return The color (never {@code null}). 
925     */
926    @Override
927    public Color getLegendHeaderColor() {
928        return this.legendHeaderColor;
929    }
930    
931    /**
932     * Sets the foreground color for the legend header and sends a 
933     * {@link ChartStyleChangeEvent} to all registered listeners.
934     * 
935     * @param color  the color ({@code null} not permitted). 
936     */
937    public void setLegendHeaderColor(Color color) {
938        Args.nullNotPermitted(color, "color");
939        this.legendHeaderColor = color;
940        fireChangeEvent();
941    }
942
943    /**
944     * Returns the background color for the legend header.  The default value
945     * is {@link #DEFAULT_TEXT_BACKGROUND_COLOR}.
946     * 
947     * @return The color (never {@code null}). 
948     */
949    @Override
950    public Color getLegendHeaderBackgroundColor() {
951        return this.legendHeaderBackgroundColor;
952    }
953    
954    /**
955     * Sets the background color for the legend header and sends a 
956     * {@link ChartStyleChangeEvent} to all registered listeners.
957     * 
958     * @param color  the color ({@code null} not permitted).
959     */
960    public void setLegendHeaderBackgroundColor(Color color) {
961        Args.nullNotPermitted(color, "color");
962        this.legendHeaderBackgroundColor = color;
963        fireChangeEvent();
964    }
965
966    /**
967     * Returns the standard shape for legend items.  The default value 
968     * is {@link #DEFAULT_LEGEND_ITEM_SHAPE}.
969     * 
970     * @return The legend shape (never {@code null}). 
971     */
972    @Override
973    public Shape getLegendItemShape() {
974        return this.legendItemShape;
975    }
976   
977    /**
978     * Sets the default shape for legend items and sends a 
979     * {@link ChartStyleChangeEvent} to all registered listeners.
980     * 
981     * @param shape  the shape ({@code null} not permitted). 
982     */
983    public void setLegendItemShape(Shape shape) {
984        Args.nullNotPermitted(shape, "shape");
985        this.legendItemShape = shape;
986        fireChangeEvent();
987    }
988    
989    /**
990     * Returns the font used for legend item text.  The default value is 
991     * {@link #DEFAULT_LEGEND_ITEM_FONT}.
992     * 
993     * @return The font used for legend item text (never {@code null}). 
994     */
995    @Override
996    public Font getLegendItemFont() {
997        return this.legendItemFont;
998    }
999    
1000    /**
1001     * Sets the legend item font and sends a {@link ChartStyleChangeEvent} to
1002     * all registered listeners.
1003     * 
1004     * @param font  the font ({@code null} not permitted). 
1005     */
1006    public void setLegendItemFont(Font font) {
1007        Args.nullNotPermitted(font, "font");
1008        this.legendItemFont = font;
1009        fireChangeEvent();
1010    }
1011
1012    /**
1013     * Returns the foreground color used for the legend items.  The default
1014     * value is {@link #DEFAULT_LEGEND_ITEM_COLOR}.
1015     * 
1016     * @return The color (never {@code null}). 
1017     */
1018    @Override
1019    public Color getLegendItemColor() {
1020        return this.legendItemColor;
1021    }
1022    
1023    /**
1024     * Sets the foreground color used for legend item text and sends a
1025     * {@link ChartStyleChangeEvent} to all registered listeners.
1026     * 
1027     * @param color  the color ({@code null} not permitted).
1028     */
1029    public void setLegendItemColor(Color color) {
1030        Args.nullNotPermitted(color, "color");
1031        this.legendItemColor = color;
1032        fireChangeEvent();
1033    }
1034    
1035    /**
1036     * Returns the background color for legend items.  The default value is
1037     * {@link #DEFAULT_LEGEND_ITEM_BACKGROUND_COLOR}.
1038     * 
1039     * @return The color (never {@code null}). 
1040     */
1041    @Override
1042    public Color getLegendItemBackgroundColor() {
1043        return this.legendItemBackgroundColor;
1044    }
1045
1046    /**
1047     * Sets the background color for legend items and sends a 
1048     * {@link ChartStyleChangeEvent} to all registered listeners.
1049     * 
1050     * @param color  the color ({@code null} not permitted). 
1051     */
1052    public void setLegendItemBackgroundColor(Color color) {
1053        Args.nullNotPermitted(color, "color");
1054        this.legendItemBackgroundColor = color;
1055        fireChangeEvent();
1056    }
1057
1058    /**
1059     * Returns the font for the legend footer.  The default value is 
1060     * {@link #DEFAULT_LEGEND_FOOTER_FONT}.
1061     * 
1062     * @return The font (never {@code null}). 
1063     */
1064    @Override
1065    public Font getLegendFooterFont() {
1066        return this.legendFooterFont;
1067    }
1068
1069    /**
1070     * Sets the legend footer font and sends a {@link ChartStyleChangeEvent} to
1071     * all registered listeners.
1072     * 
1073     * @param font  the font ({@code null} not permitted). 
1074     */
1075    public void setLegendFooterFont(Font font) {
1076        Args.nullNotPermitted(font, "font");
1077        this.legendFooterFont = font;
1078        fireChangeEvent();
1079    }
1080    
1081    /**
1082     * Returns the foreground color for the legend footer.  The default
1083     * value is {@link #DEFAULT_LEGEND_FOOTER_COLOR}.
1084     * 
1085     * @return The color (never {@code null}). 
1086     */
1087    @Override
1088    public Color getLegendFooterColor() {
1089        return this.legendFooterColor;
1090    }
1091    
1092    /**
1093     * Sets the foreground color for the legend footer and sends a 
1094     * {@link ChartStyleChangeEvent} to all registered listeners.
1095     * 
1096     * @param color  the color ({@code null} not permitted). 
1097     */
1098    public void setLegendFooterColor(Color color) {
1099        Args.nullNotPermitted(color, "color");
1100        this.legendFooterColor = color;
1101        fireChangeEvent();
1102    }
1103    
1104    /**
1105     * Returns the background color for the legend footer.  The default
1106     * value is {@link #DEFAULT_TEXT_BACKGROUND_COLOR}.
1107     * 
1108     * @return The color (never {@code null}). 
1109     */
1110    @Override
1111    public Color getLegendFooterBackgroundColor() {
1112        return this.legendFooterBackgroundColor;
1113    }
1114    
1115    /**
1116     * Sets the background color for the legend footer and sends a 
1117     * {@link ChartStyleChangeEvent} to all registered listeners.
1118     * 
1119     * @param color  the color ({@code null} not permitted).
1120     */
1121    public void setLegendFooterBackgroundColor(Color color) {
1122        Args.nullNotPermitted(color, "color");
1123        this.legendFooterBackgroundColor = color;
1124        fireChangeEvent();
1125    }
1126    
1127    /**
1128     * Returns the font used to draw marker labels.
1129     * 
1130     * @return The font used to draw marker labels (never {@code null}).
1131     */
1132    @Override
1133    public Font getMarkerLabelFont() {
1134        return this.markerLabelFont;
1135    }
1136    
1137    /**
1138     * Sets the marker label font and sends a change event to all registered
1139     * listeners.
1140     * 
1141     * @param font  the font ({@code null} not permitted). 
1142     */
1143    public void setMarkerLabelFont(Font font) {
1144        Args.nullNotPermitted(font, "font");
1145        this.markerLabelFont = font;
1146        fireChangeEvent();
1147    }
1148
1149    /**
1150     * Returns the color for the marker labels.
1151     * 
1152     * @return The color for the marker labels (never {@code null}). 
1153     */
1154    @Override
1155    public Color getMarkerLabelColor() {
1156        return this.markerLabelColor;
1157    }
1158    
1159    /**
1160     * Sets the color for the marker labels and sends a change event to all
1161     * registered listeners.
1162     * 
1163     * @param color  the color ({@code null} not permitted). 
1164     */
1165    public void setMarkerLabelColor(Color color) {
1166        Args.nullNotPermitted(color, "color");
1167        this.markerLabelColor = color;
1168        fireChangeEvent();
1169    }
1170
1171    /**
1172     * Returns the stroke used to draw marker lines.
1173     * 
1174     * @return The stroke used to draw marker lines (never {@code null}).
1175     */
1176    @Override
1177    public Stroke getMarkerLineStroke() {
1178        return this.markerLineStroke;
1179    }
1180    
1181    /**
1182     * Sets the stroke for the marker lines and sends a change event to all
1183     * registered listeners.
1184     * 
1185     * @param stroke  the stroke ({@code null} not permitted). 
1186     */
1187    public void setMarkerLineStroke(Stroke stroke) {
1188        Args.nullNotPermitted(stroke, "stroke");
1189        this.markerLineStroke = stroke;
1190        fireChangeEvent();
1191    }
1192
1193    /**
1194     * Returns the color used to draw marker lines.
1195     * 
1196     * @return The color used to draw marker lines (never {@code null}). 
1197     */
1198    @Override
1199    public Color getMarkerLineColor() {
1200        return markerLineColor;
1201    }
1202    
1203    /**
1204     * Sets the marker line color and sends a change event to all registered
1205     * listeners.
1206     * 
1207     * @param color  the color ({@code null} not permitted). 
1208     */
1209    public void setMarkerLineColor(Color color) {
1210        Args.nullNotPermitted(color, "color");
1211        this.markerLineColor = color;
1212        fireChangeEvent();
1213    }
1214
1215    /**
1216     * Returns the color used to fill the band representing the marker range.
1217     * 
1218     * @return The fill color (never {@code null}). 
1219     */
1220    @Override
1221    public Color getMarkerFillColor() {
1222        return markerFillColor;
1223    }
1224    
1225    /**
1226     * Sets the marker fill color and sends a change event to all registered
1227     * listeners.
1228     * 
1229     * @param color  the color ({@code null} not permitted).
1230     */
1231    public void setMarkerFillColor(Color color) {
1232        Args.nullNotPermitted(color, "color");
1233        this.markerFillColor = color;
1234        fireChangeEvent();
1235    }
1236
1237    /**
1238     * Registers a listener to receive notification of changes to the chart.
1239     * When a style is added to a chart, the chart will register as a listener
1240     * on the style.
1241     * 
1242     * @param listener  the listener. 
1243     */
1244    @Override
1245    public void addChangeListener(ChartStyleChangeListener listener) {
1246        this.listenerList.add(ChartStyleChangeListener.class, listener);   
1247    }
1248  
1249    /**
1250     * Deregisters a listener so that it no longer receives notification of
1251     * changes to the chart.
1252     * 
1253     * @param listener  the listener. 
1254     */
1255    @Override
1256    public void removeChangeListener(ChartStyleChangeListener listener) {
1257        this.listenerList.remove(ChartStyleChangeListener.class, listener);  
1258    }
1259  
1260    /**
1261     * Notifies all registered listeners that the chart style has been modified.
1262     *
1263     * @param event  information about the change event.
1264     */
1265    public void notifyListeners(ChartStyleChangeEvent event) {
1266        // if the 'notify' flag has been switched to false, we don't notify
1267        // the listeners
1268        if (!this.notify) {
1269            return;
1270        }
1271        Object[] listeners = this.listenerList.getListenerList();
1272        for (int i = listeners.length - 2; i >= 0; i -= 2) {
1273            if (listeners[i] == ChartStyleChangeListener.class) { 
1274                ((ChartStyleChangeListener) listeners[i + 1]).styleChanged(event);
1275            }
1276        }
1277    }
1278    /**
1279     * Returns a flag that controls whether or not change events are sent to
1280     * registered listeners.
1281     * 
1282     * @return A boolean.
1283     *
1284     * @see #setNotify(boolean)
1285     */
1286    public boolean isNotify() {
1287        return this.notify;
1288    }
1289
1290    /**
1291     * Sets a flag that controls whether or not listeners receive
1292     * {@link ChartStyleChangeEvent} notifications.  This can be useful when
1293     * updating multiple style attributes, you can call setNotify(false) first,
1294     * update the styles, then call setNotify(true) at the end. 
1295     *
1296     * @param notify  a boolean.
1297     *
1298     * @see #isNotify()
1299     */
1300    public void setNotify(boolean notify) {
1301        this.notify = notify;
1302        // if the flag is being set to true, there may be queued up changes...
1303        if (notify) {
1304            fireChangeEvent();
1305        }
1306    }
1307  
1308    /**
1309     * Sends a {@link ChartStyleChangeEvent} to all registered listeners.
1310     */
1311    protected void fireChangeEvent() {
1312        notifyListeners(new ChartStyleChangeEvent(this, this));
1313    }
1314
1315    /**
1316     * Returns a clone of the chart style (note that the change listeners
1317     * are not cloned).
1318     * 
1319     * @return A clone (never {@code null}). 
1320     */
1321    @Override
1322    public ChartStyle clone() {
1323        try {
1324            return (ChartStyle) super.clone();
1325        } catch (CloneNotSupportedException e) {
1326            throw new IllegalStateException(
1327                    "If we get here, a bug needs fixing.");
1328        }
1329    }
1330    
1331    /**
1332     * Tests this instance for equality with an arbitrary object.
1333     * 
1334     * @param obj  the object ({@code null} permitted).
1335     * 
1336     * @return A boolean. 
1337     */
1338    @Override
1339    public boolean equals(Object obj) {
1340        if (obj == this) {
1341            return true;
1342        }
1343        if (!(obj instanceof StandardChartStyle)) {
1344            return false;
1345        }
1346        StandardChartStyle that = (StandardChartStyle) obj;
1347        if (!this.backgroundPainter.equals(that.backgroundPainter)) {
1348            return false;
1349        }
1350        if (!this.titleFont.equals(that.titleFont)) {
1351            return false;
1352        }
1353        if (!this.titleColor.equals(that.titleColor)) {
1354            return false;
1355        }
1356        if (!this.titleBackgroundColor.equals(that.titleBackgroundColor)) {
1357            return false;
1358        }
1359        if (!this.subtitleFont.equals(that.subtitleFont)) {
1360            return false;
1361        }
1362        if (!this.subtitleColor.equals(that.subtitleColor)) {
1363            return false;
1364        }
1365        if (!this.subtitleBackgroundColor.equals(
1366                that.subtitleBackgroundColor)) {
1367            return false;
1368        }
1369        if (!this.chartBoxColor.equals(that.chartBoxColor)) {
1370            return false;
1371        }
1372        if (this.rowAxisGridlinesVisible!= that.rowAxisGridlinesVisible) {
1373            return false;
1374        }
1375        if (this.columnAxisGridlinesVisible 
1376                != that.columnAxisGridlinesVisible) {
1377            return false;
1378        }
1379        if (this.xAxisGridlinesVisible != that.xAxisGridlinesVisible) {
1380            return false;
1381        }
1382        if (this.yAxisGridlinesVisible != that.yAxisGridlinesVisible) {
1383            return false;
1384        }
1385        if (this.zAxisGridlinesVisible != that.zAxisGridlinesVisible) {
1386            return false;
1387        }
1388        if (!this.gridlineColor.equals(that.gridlineColor)) {
1389            return false;
1390        }
1391        if (!this.gridlineStroke.equals(that.gridlineStroke)) {
1392            return false;
1393        }
1394        if (!this.sectionLabelFont.equals(that.sectionLabelFont)) {
1395            return false;
1396        }
1397        if (!this.sectionLabelColor.equals(that.sectionLabelColor)) {
1398            return false;
1399        }
1400        if (!Arrays.equals(this.standardColors, that.standardColors)) {
1401            return false;
1402        }
1403        if (!this.axisLabelFont.equals(that.axisLabelFont)) {
1404            return false;
1405        }
1406        if (!this.axisLabelColor.equals(that.axisLabelColor)) {
1407            return false;
1408        }
1409        if (!this.axisTickLabelFont.equals(that.axisTickLabelFont)) {
1410            return false;
1411        }
1412        if (!this.axisTickLabelColor.equals(that.axisTickLabelColor)) {
1413            return false;
1414        }
1415        if (!this.legendHeaderFont.equals(that.legendHeaderFont)) {
1416            return false;
1417        }
1418        if (!this.legendHeaderColor.equals(that.legendHeaderColor)) {
1419            return false;
1420        }
1421        if (!this.legendHeaderBackgroundColor.equals(
1422                that.legendHeaderBackgroundColor)) {
1423            return false;
1424        }
1425        if (!this.legendItemShape.equals(that.legendItemShape)) {
1426            return false;
1427        }
1428        if (!this.legendItemFont.equals(that.legendItemFont)) {
1429            return false;
1430        }
1431        if (!this.legendItemColor.equals(that.legendItemColor)) {
1432            return false;
1433        }
1434        if (!this.legendItemBackgroundColor.equals(
1435                that.legendItemBackgroundColor)) {
1436            return false;
1437        }
1438        if (!this.legendFooterFont.equals(that.legendFooterFont)) {
1439            return false;
1440        }
1441        if (!this.legendFooterColor.equals(that.legendFooterColor)) {
1442            return false;
1443        }
1444        if (!this.legendFooterBackgroundColor.equals(
1445                that.legendFooterBackgroundColor)) {
1446            return false;
1447        }
1448        if (!this.markerLabelFont.equals(that.markerLabelFont)) {
1449            return false;
1450        }
1451        if (!this.markerLabelColor.equals(that.markerLabelColor)) {
1452            return false;
1453        }
1454        if (!this.markerLineColor.equals(that.markerLineColor)) {
1455            return false;
1456        }
1457        if (!this.markerLineStroke.equals(that.markerLineStroke)) {
1458            return false;
1459        }
1460        if (!this.markerFillColor.equals(that.markerFillColor)) {
1461            return false;
1462        }
1463        return true;
1464    }
1465    
1466    /**
1467     * Provides serialization support.
1468     *
1469     * @param stream  the output stream.
1470     *
1471     * @throws IOException  if there is an I/O error.
1472     */
1473    private void writeObject(ObjectOutputStream stream) throws IOException {
1474        stream.defaultWriteObject();
1475        SerialUtils.writeStroke(this.gridlineStroke, stream);
1476        SerialUtils.writeStroke(this.markerLineStroke, stream);
1477    }
1478
1479    /**
1480     * Provides serialization support.
1481     *
1482     * @param stream  the input stream.
1483     *
1484     * @throws IOException  if there is an I/O error.
1485     * @throws ClassNotFoundException  if there is a classpath problem.
1486     */
1487    private void readObject(ObjectInputStream stream)
1488        throws IOException, ClassNotFoundException {
1489        stream.defaultReadObject();
1490        this.gridlineStroke = SerialUtils.readStroke(stream);
1491        this.markerLineStroke = SerialUtils.readStroke(stream);
1492    }
1493
1494}