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