1 4 package com.tc.admin.dso; 5 6 import java.awt.event.ActionEvent ; 7 import java.awt.event.KeyEvent ; 8 9 import javax.swing.Icon ; 10 import javax.swing.JPopupMenu ; 11 import javax.swing.KeyStroke ; 12 13 import com.tc.admin.AdminClient; 14 import com.tc.admin.AdminClientContext; 15 import com.tc.admin.ConnectionContext; 16 import com.tc.admin.common.ComponentNode; 17 import com.tc.admin.common.XAbstractAction; 18 19 public class LocksNode extends ComponentNode { 20 private ConnectionContext m_cc; 21 private JPopupMenu m_popupMenu; 22 23 private static final String REFRESH_ACTION = "RefreshAction"; 24 26 public LocksNode(ConnectionContext cc) { 27 super(); 28 29 m_cc = cc; 30 31 setLabel(AdminClient.getContext().getMessage("dso.locks")); 32 setComponent(new LocksPanel(m_cc)); 33 34 initMenu(); 35 } 36 37 private void initMenu() { 38 RefreshAction refreshAction = new RefreshAction(); 39 41 m_popupMenu = new JPopupMenu ("Lock Actions"); 42 m_popupMenu.add(refreshAction); 43 45 addActionBinding(REFRESH_ACTION, refreshAction); 46 } 48 49 public JPopupMenu getPopupMenu() { 50 return m_popupMenu; 51 } 52 53 public Icon getIcon() { 54 return LocksHelper.getHelper().getLocksIcon(); 55 } 56 57 public void refresh() { 58 ((LocksPanel)getComponent()).refresh(); 59 } 60 61 private class RefreshAction extends XAbstractAction { 62 private RefreshAction() { 63 super(); 64 65 AdminClientContext acc = AdminClient.getContext(); 66 67 setName(acc.getMessage("refresh.name")); 68 setSmallIcon(LocksHelper.getHelper().getRefreshIcon()); 69 setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0, true)); 70 } 71 72 public void actionPerformed(ActionEvent ae) { 73 refresh(); 74 } 75 } 76 77 107 108 public void tearDown() { 109 super.tearDown(); 110 111 m_cc = null; 112 m_popupMenu = null; 113 } 114 } 115 | Popular Tags |