1 22 package org.objectweb.joram.client.tools.admin; 23 24 import javax.swing.*; 25 import javax.swing.tree.*; 26 27 import org.objectweb.joram.client.jms.Destination; 28 import org.objectweb.joram.client.jms.Queue; 29 import org.objectweb.joram.client.jms.Topic; 30 31 class DestinationTreeNode extends DefaultMutableTreeNode 32 implements AdminTreeNode 33 { 34 protected AdminController c; 35 private Destination dest; 36 37 public DestinationTreeNode(AdminController c, Destination dest) 38 { 39 super(dest); 40 this.c = c; 41 this.dest = dest; 42 } 43 44 public void refresh(DefaultTreeModel treeModel) 45 { 46 } 47 48 public String getDescription() 49 { 50 StringBuffer sb = new StringBuffer (); 51 sb.append("<font face=Arial><b>"); 52 sb.append(dest); 53 sb.append("</b><br><br>"); 54 55 try { 56 Queue q = (Queue) dest; 57 sb.append("<b>Pending messages: </b>" + c.getPendingMessages(q) + "<br>"); 58 sb.append("<b>Pending requests: </b>" + c.getPendingRequests(q) + "<br>"); 59 } 60 catch (Exception exc) {System.err.println(exc);} 61 62 try { 63 Topic t = (Topic) dest; 64 sb.append("<b>Subscriptions: </b>" + c.getSubscriptions(t) + "<br>"); 65 } 66 catch (Exception exc) {System.err.println(exc);} 67 68 sb.append("</font>"); 69 return sb.toString(); 70 } 71 72 public JPopupMenu getContextMenu() 73 { 74 JPopupMenu popup = new JPopupMenu("Destination"); 75 76 return popup; 77 } 78 79 public ImageIcon getImageIcon() 80 { 81 return AdminToolConstants.queueIcon; 82 } 83 84 public Destination getDestination() { return dest; } 85 86 public ServerTreeNode getParentServerTreeNode() { 87 return (ServerTreeNode) getParent().getParent(); 88 } 89 90 public String toString() { 91 String name = c.findDestinationJndiName(dest); 92 if (name == null) 93 return dest.toString(); 94 else 95 return name; 96 } 97 98 public boolean getAllowsChildren() { 99 return true; 100 } 101 } 102 | Popular Tags |