1. /* ===========================================================
  2. * JFreeChart : a free chart library for the Java(tm) platform
  3. * ===========================================================
  4. *
  5. * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.
  6. *
  7. * Project Info: http://www.jfree.org/jfreechart/index.html
  8. *
  9. * This library is free software; you can redistribute it and/or modify it under the terms
  10. * of the GNU Lesser General Public License as published by the Free Software Foundation;
  11. * either version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  14. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License along with this
  18. * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. *
  21. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  22. * in the United States and other countries.]
  23. *
  24. * ------------------------------
  25. * CategoryItemRendererState.java
  26. * ------------------------------
  27. * (C) Copyright 2003, 2004, by Object Refinery Limited.
  28. *
  29. * Original Author: David Gilbert (for Object Refinery Limited);
  30. * Contributor(s): -;
  31. *
  32. * $Id: CategoryItemRendererState.java,v 1.1 2004/08/31 14:47:48 mungady Exp $
  33. *
  34. * Changes (since 20-Oct-2003):
  35. * ----------------------------
  36. * 20-Oct-2003 : Added series running total (DG);
  37. *
  38. */
  39. package org.jfree.chart.renderer.category;
  40. import org.jfree.chart.plot.PlotRenderingInfo;
  41. import org.jfree.chart.renderer.RendererState;
  42. /**
  43. * An object that retains temporary state information for a {@link CategoryItemRenderer}.
  44. */
  45. public class CategoryItemRendererState extends RendererState {
  46. /** The bar width. */
  47. private double barWidth;
  48. /** The series running total. */
  49. private double seriesRunningTotal;
  50. /**
  51. * Creates a new object for recording temporary state information for a renderer.
  52. *
  53. * @param info the plot rendering info.
  54. */
  55. public CategoryItemRendererState(PlotRenderingInfo info) {
  56. super(info);
  57. this.barWidth = 0.0;
  58. this.seriesRunningTotal = 0.0;
  59. }
  60. /**
  61. * Returns the bar width.
  62. *
  63. * @return The bar width.
  64. */
  65. public double getBarWidth() {
  66. return this.barWidth;
  67. }
  68. /**
  69. * Sets the bar width. The renderer calculates this value and stores it here - it is not
  70. * intended that users can manually set the bar width.
  71. *
  72. * @param width the width.
  73. */
  74. public void setBarWidth(double width) {
  75. this.barWidth = width;
  76. }
  77. /**
  78. * Returns the series running total.
  79. *
  80. * @return The running total.
  81. */
  82. public double getSeriesRunningTotal() {
  83. return this.seriesRunningTotal;
  84. }
  85. /**
  86. * Sets the series running total (this method is intended for the use of the renderer only).
  87. *
  88. * @param total the new total.
  89. */
  90. void setSeriesRunningTotal(double total) {
  91. this.seriesRunningTotal = total;
  92. }
  93. }