1 48 49 50 package org.exolab.jms.tools.admin; 51 52 import java.awt.Rectangle ; 53 import java.awt.event.ActionEvent ; 54 import java.awt.event.ActionListener ; 55 56 import javax.swing.JMenuItem ; 57 import javax.swing.JPopupMenu ; 58 import javax.swing.JTree ; 59 import javax.swing.tree.DefaultMutableTreeNode ; 60 import javax.swing.tree.DefaultTreeModel ; 61 62 63 69 public class OpenJMSTopicFolder 70 extends DefaultMutableTreeNode 71 implements OpenJMSNode { 72 73 static private JTree tree_ = null; 75 76 static private boolean commandsCreated_ = false; 78 79 static private JPopupMenu commands_ = null; 81 82 87 public OpenJMSTopicFolder(JTree tree) { 88 if (!commandsCreated_) { 89 tree_ = tree; 90 createCommands(); 91 commandsCreated_ = true; 92 } 93 } 94 95 102 protected void createCommands() { 103 commands_ = new JPopupMenu (); 104 105 JMenuItem m = new JMenuItem ("Create Topic"); 106 m.addActionListener(new ActionListener () { 107 108 public void actionPerformed(ActionEvent evt) { 109 createTopic(); 110 } 111 } 112 ); 113 commands_.add(m); 114 } 115 116 121 public boolean getAllowsChildren() { 122 return true; 123 } 124 125 126 132 public boolean isLeaf() { 133 return false; 134 } 135 136 144 public void displayCommands(Rectangle loc) { 145 double x; 146 double y; 147 148 x = loc.getX(); 149 y = loc.getY(); 150 y += loc.getHeight(); 151 152 commands_.show(tree_, (int) x, (int) y); 153 } 154 155 160 private void refresh() { 161 DefaultTreeModel model = (DefaultTreeModel ) tree_.getModel(); 162 model.nodeStructureChanged((DefaultMutableTreeNode ) this); 163 } 164 165 169 public void update() { 170 } 171 172 178 public String toString() { 179 return "Topics"; 180 } 181 182 188 static private OpenJMSTopicFolder getInstanceSelected() { 189 Object loc = tree_.getLastSelectedPathComponent(); 190 return (OpenJMSTopicFolder) loc; 191 } 192 193 200 static private void createTopic() { 201 } 202 } | Popular Tags |