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 70 public class OpenJMSConsumerFolder 71 extends DefaultMutableTreeNode 72 implements OpenJMSNode { 73 74 static private JTree tree_ = null; 76 77 static private boolean commandsCreated_ = false; 79 80 static private JPopupMenu commands_ = null; 82 83 88 public OpenJMSConsumerFolder(JTree tree) { 89 if (!commandsCreated_) { 90 tree_ = tree; 91 createCommands(); 92 commandsCreated_ = true; 93 } 94 } 95 96 103 protected void createCommands() { 104 commands_ = new JPopupMenu (); 105 106 JMenuItem m = new JMenuItem ("Create Consumer"); 107 m.addActionListener(new ActionListener () { 108 109 public void actionPerformed(ActionEvent evt) { 110 createConsumer(); 111 } 112 } 113 ); 114 commands_.add(m); 115 } 116 117 122 public boolean getAllowsChildren() { 123 return true; 124 } 125 126 127 133 public boolean isLeaf() { 134 return false; 135 } 136 137 145 public void displayCommands(Rectangle loc) { 146 double x; 147 double y; 148 149 x = loc.getX(); 150 y = loc.getY(); 151 y += loc.getHeight(); 152 153 commands_.show(tree_, (int) x, (int) y); 154 } 155 156 161 private void refresh() { 162 DefaultTreeModel model = (DefaultTreeModel ) tree_.getModel(); 163 model.nodeStructureChanged((DefaultMutableTreeNode ) this); 164 } 165 166 170 public void update() { 171 } 172 173 179 public String toString() { 180 return "Consumers"; 181 } 182 183 189 static private OpenJMSConsumerFolder getInstanceSelected() { 190 Object loc = tree_.getLastSelectedPathComponent(); 191 return (OpenJMSConsumerFolder) loc; 192 } 193 194 201 static private void createConsumer() { 202 } 203 } | Popular Tags |