1
2
3
4
5
6
7
8
9
10
11
12
13 package org.gscg.common.gui.statistics.components;
14
15 import java.util.ArrayList;
16
17 import nl.tudelft.simulation.jstats.Swingable;
18
19 import org.gscg.common.gui.ColorInterface;
20 import org.jfree.chart.JFreeChart;
21
22 /***
23 * The BoxAndWhiskerChart is used to show the minimum, average and maxmimum of a
24 * set of values.
25 * <p>
26 * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
27 * Delft, the Netherlands. All rights reserved.
28 *
29 * See for project information <a href="http://www.simulation.tudelft.nl/">
30 * www.simulation.tudelft.nl </a>.
31 *
32 * The source code and binary code of this software is proprietary information
33 * of Delft University of Technology.
34 *
35 * @author <a
36 * href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
37 * van Houten </a>
38 * @version $Revision: 1.1 $ $Date: 2005/06/16 12:33:54 $
39 * @since 1.0.0
40 */
41 public class BoxAndWhiskerChart extends
42 nl.tudelft.simulation.jstats.charts.boxAndWhisker.BoxAndWhiskerChart
43 implements StatisticsChartInterface
44 {
45 /*** the actor panel */
46 private ColorInterface actorPanel = null;
47
48 /*** the list with tallies implementing the statistic interface */
49 private ArrayList tallies = new ArrayList();
50
51 /***
52 * constructs a new BoxAndWhiskerChart
53 *
54 * @param description the description of the chart
55 * @param actorPanel the actor panel
56 */
57 public BoxAndWhiskerChart(final String description,
58 final ColorInterface actorPanel)
59 {
60 super(description);
61 this.actorPanel = actorPanel;
62 super.getChart().setBackgroundPaint(
63 this.actorPanel.getBusinessPanelBackGroundColor());
64 }
65
66 /***
67 * @see org.gscg.common.gui.statistics.components.StatisticsChartInterface#getChartTitle()
68 */
69 public String getChartTitle()
70 {
71 return this.toString();
72 }
73
74 /***
75 * @see org.gscg.common.gui.statistics.components.StatisticsChartInterface#getJFreeChart()
76 */
77 public JFreeChart getJFreeChart()
78 {
79 return super.getChart();
80 }
81
82 /***
83 * @see org.gscg.common.gui.statistics.components.StatisticsChartInterface#getSwingable()
84 */
85 public Swingable getSwingable()
86 {
87 return null;
88 }
89
90 /***
91 * @see java.lang.Object#toString()
92 */
93 public String toString()
94 {
95 return super.getChart().getTitle().getText();
96 }
97
98 /***
99 * Method add
100 *
101 * @param gamingPersistent the gaming persistent to add
102 */
103 public void add(final GamingPersistent gamingPersistent)
104 {
105 super.add(gamingPersistent.getPersistent());
106
107 if (StatisticsInterface.class.isAssignableFrom(gamingPersistent
108 .getClass()))
109 {
110 this.tallies.add(gamingPersistent);
111 }
112 }
113
114 /***
115 * @see org.gscg.common.gui.statistics.components.StatisticsInterface#setStatus(boolean)
116 */
117 public void setStatus(final boolean status)
118 {
119 for (int i = 0; i < this.tallies.size(); i++)
120 {
121 ((StatisticsInterface) this.tallies.get(i)).setStatus(status);
122 }
123 }
124 }