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.dso;
05:
06: import com.tc.admin.AdminClient;
07: import com.tc.admin.ConnectionContext;
08: import com.tc.admin.common.ComponentNode;
09: import com.tc.admin.common.XAbstractAction;
10:
11: import java.awt.event.ActionEvent;
12: import java.awt.event.KeyEvent;
13: import java.awt.event.MouseEvent;
14:
15: import javax.swing.Icon;
16: import javax.swing.JPopupMenu;
17: import javax.swing.KeyStroke;
18:
19: public class ClassesNode extends ComponentNode {
20: private JPopupMenu m_popupMenu;
21: private RefreshAction m_refreshAction;
22:
23: private static final String 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("Roots Actions");
38: m_popupMenu.add(m_refreshAction);
39:
40: addActionBinding(REFRESH_ACTION, m_refreshAction);
41: }
42:
43: public JPopupMenu getPopupMenu() {
44: return m_popupMenu;
45: }
46:
47: public Icon 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,
62: true));
63: }
64:
65: public void actionPerformed(ActionEvent ae) {
66: refresh();
67: }
68: }
69:
70: public void nodeClicked(MouseEvent me) {
71: m_refreshAction.actionPerformed(null);
72: }
73: }
|