1 package net.suberic.pooka.gui; 2 import javax.swing.tree.*; 3 import javax.swing.*; 4 import java.util.Hashtable ; 5 import java.awt.event.*; 6 import net.suberic.util.gui.ConfigurablePopupMenu; 7 import net.suberic.pooka.Pooka; 8 9 10 public class MailTreeNode extends DefaultMutableTreeNode { 11 12 public Action[] defaultActions = null; 13 14 public Hashtable commands; 15 16 public JComponent parentContainer; 17 18 private boolean subscribed = false; 20 21 public ConfigurablePopupMenu popupMenu; 22 23 MailTreeNode(Object userObj, JComponent parent) { 24 super(userObj); 25 26 parentContainer = parent; 27 28 } 29 30 34 public void showPopupMenu(JComponent component, MouseEvent e) { 35 configurePopupMenu(); 36 37 if (popupMenu != null) 38 popupMenu.show(component, e.getX(), e.getY()); 39 40 } 41 42 45 public void updatePopupTheme() { 46 if (popupMenu != null) { 47 SwingUtilities.invokeLater( new Runnable () { 48 public void run() { 49 try { 50 FolderPanel fp = ((FolderPanel)getParentContainer()); 51 Pooka.getUIFactory().getPookaThemeManager().updateUI(fp, popupMenu, true); 52 } catch (Exception e) { 53 54 } 55 } 56 }); 57 } 58 } 59 60 67 public void configurePopupMenu() { 68 69 } 70 71 protected void setCommands() { 72 commands = new Hashtable (); 73 74 Action[] actions = getActions(); 75 if (actions != null) { 76 for (int i = 0; i < actions.length; i++) { 77 Action a = actions[i]; 78 commands.put(a.getValue(Action.NAME), a); 79 } 80 } 81 82 } 83 84 85 public Action[] getActions() { 86 return getDefaultActions(); 87 } 88 89 public Action getAction(String name) { 90 if (commands != null) 91 return (Action)commands.get(name); 92 else 93 return null; 94 } 95 96 public Action[] getDefaultActions() { 97 return defaultActions; 98 } 99 100 public JComponent getParentContainer() { 101 return parentContainer; 102 } 103 104 public boolean isSubscribed() { 105 return subscribed; 106 } 107 108 public void setSubscribed(boolean newValue) { 109 subscribed=newValue; 110 } 111 } 112 113 | Popular Tags |