KickJava   Java API By Example, From Geeks To Geeks.

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


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.ConnectionContext;
8 import com.tc.admin.common.ComponentNode;
9 import com.tc.admin.common.XAbstractAction;
10
11 import java.awt.event.ActionEvent JavaDoc;
12 import java.awt.event.KeyEvent JavaDoc;
13 import java.awt.event.MouseEvent JavaDoc;
14
15 import javax.swing.Icon JavaDoc;
16 import javax.swing.JPopupMenu JavaDoc;
17 import javax.swing.KeyStroke JavaDoc;
18
19 public class ClassesNode extends ComponentNode {
20   private JPopupMenu JavaDoc m_popupMenu;
21   private RefreshAction m_refreshAction;
22
23   private static final String JavaDoc REFRESH_ACTION = "RefreshAction";
24
25   public ClassesNode(ConnectionContext cc) {
26     super();
27
28     setLabel(AdminClient.getContext().getMessage("dso.classes"));
29     setComponent(new ClassesPanel(cc));
30
31     initMenu();
32   }
33
34   private void initMenu() {
35     m_refreshAction = new RefreshAction();
36
37     m_popupMenu = new JPopupMenu JavaDoc("Roots Actions");
38     m_popupMenu.add(m_refreshAction);
39
40     addActionBinding(REFRESH_ACTION, m_refreshAction);
41   }
42
43   public JPopupMenu JavaDoc getPopupMenu() {
44     return m_popupMenu;
45   }
46
47   public Icon JavaDoc getIcon() {
48     return ClassesHelper.getHelper().getClassesIcon();
49   }
50
51   public void refresh() {
52     ((ClassesPanel)getComponent()).refresh();
53   }
54
55   private class RefreshAction extends XAbstractAction {
56     private RefreshAction() {
57       super();
58
59       setName(AdminClient.getContext().getMessage("refresh.name"));
60       setSmallIcon(ClassesHelper.getHelper().getRefreshIcon());
61       setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true));
62     }
63
64     public void actionPerformed(ActionEvent JavaDoc ae) {
65       refresh();
66     }
67   }
68
69   public void nodeClicked(MouseEvent JavaDoc me) {
70     m_refreshAction.actionPerformed(null);
71   }
72 }
73
Popular Tags