1 12 13 package org.ejtools.jmx.browser.web.taglib; 14 15 16 17 import java.util.Hashtable ; 18 19 20 21 import org.ejtools.jmx.browser.model.Resource; 22 23 import org.ejtools.servlet.http.jsp.tagext.tree.TreeRenderer; 24 25 26 27 42 43 public class TreeRendererImpl implements TreeRenderer 44 45 { 46 47 48 49 protected static Hashtable icons = new Hashtable (); 50 51 52 53 54 55 66 67 public String getDisplayName(Object o) 68 69 { 70 71 String result = o.toString(); 72 73 74 75 if (o instanceof Resource) 76 77 { 78 79 Resource res = (Resource) o; 80 81 result = res.getCanonicalName().substring(res.getDomain().length() + 1); 82 83 } 84 85 86 87 return result; 88 89 } 90 91 92 93 94 95 106 107 public String getIcon(Object o) 108 109 { 110 111 String icon = (String ) icons.get(o.getClass()); 112 113 114 115 if (icon == null) 116 117 { 118 119 icon = "images/toolbarButtonGraphics/general/Bean16.gif"; 120 121 } 122 123 return icon; 124 125 } 126 127 128 129 130 131 static 132 133 { 134 135 icons.put(org.ejtools.jmx.browser.model.Domain.class, "images/toolbarButtonGraphics/development/J2EEDomain16.gif"); 136 137 icons.put(org.ejtools.jmx.browser.model.Resource.class, "images/toolbarButtonGraphics/development/Bean16.gif"); 138 139 } 140 141 } 142 143 | Popular Tags |