KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.dijon.ContainerResource;
7
8 import com.tc.admin.AdminClient;
9 import com.tc.admin.AdminClientContext;
10 import com.tc.admin.ConnectionContext;
11 import com.tc.admin.common.XAbstractAction;
12 import com.tc.admin.common.XContainer;
13 import com.tc.admin.common.XTree;
14 import com.tc.stats.DSOClassInfo;
15
16 import java.awt.event.ActionEvent JavaDoc;
17 import java.awt.event.KeyEvent JavaDoc;
18
19 import javax.swing.KeyStroke JavaDoc;
20
21 public class ClassesPanel extends XContainer {
22   private ConnectionContext m_cc;
23   private ClassesTable m_table;
24   private XTree m_tree;
25   private ClassesTreeMap m_treeMap;
26
27   private static final String JavaDoc REFRESH = "Refresh";
28
29   public ClassesPanel(ConnectionContext cc) {
30     super();
31
32     AdminClientContext cntx = AdminClient.getContext();
33
34     load((ContainerResource)cntx.topRes.getComponent("ClassesPanel"));
35
36     m_cc = cc;
37
38     DSOClassInfo[] classInfo = ClassesHelper.getHelper().getClassInfo(m_cc);
39
40     m_table = (ClassesTable)findComponent("ClassTable");
41     m_table.setClassInfo(classInfo);
42
43     m_tree = (XTree)findComponent("ClassTree");
44     m_tree.setShowsRootHandles(true);
45     m_tree.setModel(new ClassTreeModel(classInfo));
46
47     m_treeMap = (ClassesTreeMap)findComponent("ClassesTreeMap");
48     m_treeMap.setModel((ClassTreeModel)m_tree.getModel());
49
50     KeyStroke JavaDoc ks = KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true);
51     getActionMap().put(REFRESH, new RefreshAction());
52     getInputMap().put(ks, REFRESH);
53   }
54
55   public class RefreshAction extends XAbstractAction {
56     public void actionPerformed(ActionEvent JavaDoc ae) {
57       refresh();
58     }
59   }
60
61   public void refresh() {
62     AdminClientContext acc = AdminClient.getContext();
63
64     acc.controller.setStatus(acc.getMessage("dso.classes.refreshing"));
65     acc.controller.block();
66
67     DSOClassInfo[] classInfo = ClassesHelper.getHelper().getClassInfo(m_cc);
68
69     m_table.setClassInfo(classInfo);
70
71     ((ClassTreeModel)m_tree.getModel()).setClassInfo(classInfo);
72
73     m_treeMap.setModel((ClassTreeModel)m_tree.getModel());
74
75     acc.controller.clearStatus();
76     acc.controller.unblock();
77   }
78 }
79
Popular Tags