KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejtools > jmx > browser > web > taglib > TreeRendererImpl


1 /*
2
3  * EJTools, the Enterprise Java Tools
4
5  *
6
7  * Distributable under LGPL license.
8
9  * See terms of license at www.gnu.org.
10
11  */

12
13 package org.ejtools.jmx.browser.web.taglib;
14
15
16
17 import java.util.Hashtable JavaDoc;
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 /**
28
29  * Description of the Class
30
31  *
32
33  * @author letiemble
34
35  * @created 25 avril 2002
36
37  * @version $Revision: 1.6 $
38
39  * @todo Javadoc to complete
40
41  */

42
43 public class TreeRendererImpl implements TreeRenderer
44
45 {
46
47    /** Description of the Field */
48
49    protected static Hashtable JavaDoc icons = new Hashtable JavaDoc();
50
51
52
53
54
55    /**
56
57     * Gets the displayName attribute of the TreeRendererImpl object
58
59     *
60
61     * @param o Description of the Parameter
62
63     * @return The displayName value
64
65     */

66
67    public String JavaDoc getDisplayName(Object JavaDoc o)
68
69    {
70
71       String JavaDoc 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    /**
96
97     * Gets the icon attribute of the TreeRendererImpl object
98
99     *
100
101     * @param o Description of the Parameter
102
103     * @return The icon value
104
105     */

106
107    public String JavaDoc getIcon(Object JavaDoc o)
108
109    {
110
111       String JavaDoc icon = (String JavaDoc) 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    /** Map of the class/icons */
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