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.dijon.Container;
07: import org.dijon.ContainerResource;
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.Poller;
13: import com.tc.admin.common.RatePanel;
14: import com.tc.admin.common.XContainer;
15:
16: import java.awt.BorderLayout;
17:
18: import javax.management.ObjectName;
19: import javax.swing.SwingConstants;
20:
21: public class ClientStatsPanel extends XContainer implements Poller {
22: private CacheActivityPanel m_cacheActivity;
23: private RatePanel m_txnRate;
24:
25: public ClientStatsPanel(ConnectionContext cc, ObjectName bean) {
26: AdminClientContext acc = AdminClient.getContext();
27:
28: load((ContainerResource) acc.topRes
29: .getComponent("ClientStatsPanel"));
30:
31: m_cacheActivity = new CacheActivityPanel(cc, bean,
32: SwingConstants.VERTICAL);
33: addPanel("Panel1", m_cacheActivity);
34:
35: String stat = "TransactionRate";
36: String header = acc.getMessage("dso.transaction.rate");
37: String xAxis = null;
38: String yAxis = acc
39: .getMessage("dso.transaction.rate.range.label");
40:
41: m_txnRate = new RatePanel(cc, bean, stat, header, xAxis, yAxis);
42: addPanel("Panel2", m_txnRate);
43: }
44:
45: private void addPanel(String parentPanelName, XContainer panel) {
46: Container parentPanel = (Container) getChild(parentPanelName);
47:
48: parentPanel.setLayout(new BorderLayout());
49: parentPanel.add(panel);
50: }
51:
52: public void stop() {
53: if (m_cacheActivity != null)
54: m_cacheActivity.stop();
55:
56: if (m_txnRate != null)
57: m_txnRate.stop();
58: }
59:
60: public void start() {
61: if (m_cacheActivity != null)
62: m_cacheActivity.start();
63:
64: if (m_txnRate != null)
65: m_txnRate.start();
66: }
67:
68: public void tearDown() {
69: stop();
70:
71: super.tearDown();
72:
73: m_cacheActivity = null;
74: m_txnRate = null;
75: }
76: }
|