KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > renderer > CategoryItemRendererState


1 /* ======================================
2  * JFreeChart : a free Java chart library
3  * ======================================
4  *
5  * Project Info: http://www.jfree.org/jfreechart/index.html
6  * Project Lead: David Gilbert (david.gilbert@object-refinery.com);
7  *
8  * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it under the terms
11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
12  * either version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License along with this
19  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * ------------------------------
23  * CategoryItemRendererState.java
24  * ------------------------------
25  * (C) Copyright 2003 by Object Refinery Limited.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: CategoryItemRendererState.java,v 1.3 2003/11/03 14:21:27 mungady Exp $
31  *
32  * Changes (since 20-Oct-2003):
33  * ----------------------------
34  * 20-Oct-2003 : Added series running total (DG);
35  *
36  */

37
38 package org.jfree.chart.renderer;
39
40 import org.jfree.chart.plot.PlotRenderingInfo;
41
42 /**
43  * An object that retains temporary state information for a {@link CategoryItemRenderer}.
44  */

45 public class CategoryItemRendererState extends RendererState {
46
47     /** The bar width. */
48     private double barWidth;
49     
50     /** The series running total. */
51     private double seriesRunningTotal;
52     
53     /**
54      * Creates a new object for recording temporary state information for a renderer.
55      *
56      * @param info the plot rendering info.
57      */

58     public CategoryItemRendererState(PlotRenderingInfo info) {
59         super(info);
60         this.barWidth = 0.0;
61         this.seriesRunningTotal = 0.0;
62     }
63     
64     /**
65      * Returns the bar width.
66      *
67      * @return The bar width.
68      */

69     public double getBarWidth() {
70         return this.barWidth;
71     }
72     
73     /**
74      * Sets the bar width. The renderer calculates this value and stores it here - it is not
75      * intended that users can manually set the bar width.
76      *
77      * @param width the width.
78      */

79     public void setBarWidth(double width) {
80         this.barWidth = width;
81     }
82     
83     /**
84      * Returns the series running total.
85      *
86      * @return The running total.
87      */

88     public double getSeriesRunningTotal() {
89         return this.seriesRunningTotal;
90     }
91     
92     /**
93      * Sets the series running total (this method is intended for the use of the renderer only).
94      *
95      * @param total the new total.
96      */

97     void setSeriesRunningTotal(double total) {
98         this.seriesRunningTotal = total;
99     }
100     
101 }
102
Popular Tags