1 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 ; 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, true)); 62 } 63 64 public void actionPerformed(ActionEvent ae) { 65 refresh(); 66 } 67 } 68 69 public void nodeClicked(MouseEvent me) { 70 m_refreshAction.actionPerformed(null); 71 } 72 } 73 | Popular Tags |