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.sessions;
05:
06: import org.dijon.ContainerResource;
07:
08: import com.tc.admin.AdminClient;
09: import com.tc.admin.AdminClientContext;
10: import com.tc.admin.common.XContainer;
11: import com.tc.admin.common.XObjectTable;
12: import com.tc.admin.common.XObjectTableModel;
13: import com.tc.management.exposed.SessionsProductMBean;
14: import com.tc.management.opentypes.adapters.ClassCreationCount;
15:
16: public class SessionsProductPanel extends XContainer {
17: private SessionsProductTable m_sessionsProductTable;
18: private XObjectTable m_classCreationTable;
19: private SessionsProductMBean m_bean;
20: private SessionsProductWrapper m_wrapper;
21:
22: public SessionsProductPanel(SessionsProductMBean bean) {
23: super ();
24:
25: m_wrapper = new SessionsProductWrapper(m_bean = bean);
26:
27: AdminClientContext cntx = AdminClient.getContext();
28: load((ContainerResource) cntx.topRes
29: .getComponent("SessionsProductPanel"));
30: }
31:
32: public void load(ContainerResource containerRes) {
33: super .load(containerRes);
34:
35: m_sessionsProductTable = (SessionsProductTable) findComponent("SessionsProductTable");
36: m_sessionsProductTable.setBean(m_wrapper);
37:
38: m_classCreationTable = (XObjectTable) findComponent("ClassCreationTable");
39: m_classCreationTable.setModel(new ClassCreationTableModel());
40: }
41:
42: public SessionsProductMBean getBean() {
43: return m_bean;
44: }
45:
46: public SessionsProductWrapper getWrapper() {
47: return m_wrapper;
48: }
49:
50: public void refresh() {
51: m_wrapper = new SessionsProductWrapper(m_bean);
52: m_sessionsProductTable.setBean(m_wrapper);
53:
54: XObjectTableModel model = (XObjectTableModel) m_classCreationTable
55: .getModel();
56: ClassCreationCount[] ccc = getWrapper().getClassCreationCount();
57:
58: model.set(ccc);
59: m_classCreationTable.sort();
60: }
61:
62: class ClassCreationTableModel extends XObjectTableModel {
63: public ClassCreationTableModel() {
64: super (ClassCreationCount.class, new String[] { "ClassName",
65: "Count" }, new String[] { "Class name", "Count" },
66: getWrapper().getClassCreationCount());
67: }
68: }
69:
70: public void tearDown() {
71: super.tearDown();
72: }
73: }
|