1 4 package com.tc.admin.dso; 5 6 import org.dijon.Container; 7 import org.dijon.ContainerResource; 8 9 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 StatsPanel extends XContainer implements Poller { 22 private CacheActivityPanel m_cacheActivity; 23 private RatePanel m_txnRate; 24 private RatePanel m_cacheMissRate; 25 26 public StatsPanel(ConnectionContext cc, ObjectName bean) { 27 AdminClientContext acc = AdminClient.getContext(); 28 29 load((ContainerResource) acc.topRes.getComponent("StatsPanel")); 30 31 m_cacheActivity = new CacheActivityPanel(cc, bean, SwingConstants.HORIZONTAL); 32 addPanel("Panel1", m_cacheActivity); 33 34 String stat = "TransactionRate"; 35 String header = acc.getMessage("dso.transaction.rate"); 36 String yAxis = acc.getMessage("dso.transaction.rate.range.label"); 37 String xAxis = null; 38 39 m_txnRate = new RatePanel(cc, bean, stat, header, xAxis, yAxis); 40 addPanel("Panel2", m_txnRate); 41 42 stat = "CacheMissRate"; 43 header = acc.getMessage("dso.cache.miss.rate"); 44 yAxis = acc.getMessage("dso.cache.miss.rate.label"); 45 46 m_cacheMissRate = new RatePanel(cc, bean, stat, header, xAxis, yAxis); 47 48 addPanel("Panel3", m_cacheMissRate); 49 } 50 51 private void addPanel(String parentPanelName, XContainer panel) { 52 Container parentPanel = (Container) getChild(parentPanelName); 53 54 parentPanel.setLayout(new BorderLayout ()); 55 parentPanel.add(panel); 56 } 57 58 public void stop() { 59 if (m_cacheActivity != null) m_cacheActivity.stop(); 60 61 if (m_txnRate != null) m_txnRate.stop(); 62 63 if (m_cacheMissRate != null) m_cacheMissRate.stop(); 64 } 65 66 public void start() { 67 if (m_cacheActivity != null) m_cacheActivity.start(); 68 69 if (m_txnRate != null) m_txnRate.start(); 70 71 if (m_cacheMissRate != null) m_cacheMissRate.start(); 72 } 73 74 public void tearDown() { 75 stop(); 76 77 super.tearDown(); 78 79 m_cacheActivity = null; 80 m_txnRate = null; 81 m_cacheMissRate = null; 82 } 83 } 84 | Popular Tags |