01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.admin.dso;
05:
06: import org.jfree.chart.JFreeChart;
07: import org.jfree.data.time.TimeSeries;
08:
09: import com.tc.admin.AdminClient;
10: import com.tc.admin.AdminClientContext;
11: import com.tc.admin.ConnectionContext;
12: import com.tc.admin.common.DemoChartFactory;
13: import com.tc.admin.common.MultiStatisticPanel;
14: import com.tc.admin.common.Poller;
15: import com.tc.admin.common.XContainer;
16:
17: import java.awt.BorderLayout;
18:
19: import javax.management.ObjectName;
20:
21: public class CacheActivityPanel extends XContainer implements Poller {
22: private MultiStatisticPanel m_panel;
23:
24: public CacheActivityPanel(ConnectionContext cc, ObjectName bean,
25: int orientation) {
26: super (new BorderLayout());
27:
28: AdminClientContext acc = AdminClient.getContext();
29:
30: String[] stats = { "ObjectFlushRate", "ObjectFaultRate", };
31:
32: String[] names = { acc.getMessage("dso.object.flush.rate"),
33: acc.getMessage("dso.object.fault.rate") };
34:
35: String header = acc.getMessage("dso.cache.activity");
36: String xAxis = null;
37: String yAxis = acc.getMessage("dso.cache.rate.range.label");
38:
39: m_panel = new MultiStatisticPanel(cc, bean, stats, names,
40: header, xAxis, yAxis, orientation) {
41: public JFreeChart createChart(TimeSeries series) {
42: return DemoChartFactory.getXYLineChart("", "", "",
43: series);
44: }
45: };
46: add(m_panel);
47: }
48:
49: public boolean isRunning() {
50: return m_panel != null && m_panel.isRunning();
51: }
52:
53: public void stop() {
54: if (isRunning())
55: m_panel.stop();
56: }
57:
58: public void start() {
59: if (!isRunning())
60: m_panel.start();
61: }
62:
63: public void tearDown() {
64: if (isRunning())
65: m_panel.stop();
66:
67: super.tearDown();
68: m_panel = null;
69: }
70: }
|