KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > dso > ClientTreeNode


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin.dso;
5
6 import com.tc.admin.AdminClient;
7 import com.tc.admin.AdminClientContext;
8 import com.tc.admin.ConnectionContext;
9 import com.tc.admin.common.ComponentNode;
10 import com.tc.admin.common.PollerNode;
11 import com.tc.admin.common.RatePanel;
12
13 import javax.management.ObjectName JavaDoc;
14 import javax.swing.SwingConstants JavaDoc;
15
16 public class ClientTreeNode extends ComponentNode {
17   private DSOClient m_client;
18   private CacheActivityPanel m_cacheActivity;
19   private RatePanel m_txnRate;
20   private ClientStatsPanel m_clientStats;
21
22   public ClientTreeNode(ConnectionContext cc, DSOClient client) {
23     super(client.getRemoteAddress());
24     setComponent(new ClientPanel(m_client = client));
25
26     AdminClientContext acc = AdminClient.getContext();
27     int i = 0;
28     ObjectName JavaDoc bean = client.getObjectName();
29     ComponentNode node;
30
31     m_cacheActivity = new CacheActivityPanel(cc, bean, SwingConstants.VERTICAL);
32     node = new PollerNode(acc.getMessage("dso.cache.activity"),
33                            m_cacheActivity);
34     
35     m_cacheActivity.setNode(node);
36     insert(node, i++);
37
38     String JavaDoc stat = "TransactionRate";
39     String JavaDoc header = acc.getMessage("dso.transaction.rate");
40     String JavaDoc xAxis = null;
41     String JavaDoc yAxis = acc.getMessage("dso.transaction.rate.range.label");
42     
43     m_txnRate = new RatePanel(cc, bean, stat, header, xAxis, yAxis);
44     m_txnRate.setNode(node = new PollerNode(header, m_txnRate));
45     insert(node, i++);
46
47     m_clientStats = new ClientStatsPanel(cc, bean);
48     node = new PollerNode(acc.getMessage("dso.all.statistics"),
49                           m_clientStats);
50     m_clientStats.setNode(node);
51     insert(node, i++);
52   }
53
54   public DSOClient getClient() {
55     return m_client;
56   }
57
58   public void tearDown() {
59     m_cacheActivity.stop();
60     m_txnRate.stop();
61     m_clientStats.stop();
62
63     super.tearDown();
64
65     m_cacheActivity = null;
66     m_txnRate = null;
67     m_clientStats = null;
68   }
69 }
70
Popular Tags