author | sla |
Tue, 19 Mar 2013 13:26:42 +0100 | |
changeset 18197 | ae73e4f50e08 |
parent 14342 | 8435a30053c1 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
14342
8435a30053c1
7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents:
12851
diff
changeset
|
2 |
* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.tools.jconsole; |
|
27 |
||
28 |
import java.awt.BorderLayout; |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
29 |
import java.awt.EventQueue; |
2 | 30 |
import java.awt.event.MouseAdapter; |
31 |
import java.awt.event.MouseEvent; |
|
32 |
import java.awt.event.MouseListener; |
|
33 |
import java.beans.*; |
|
34 |
import java.io.*; |
|
35 |
import java.util.Set; |
|
36 |
import javax.management.*; |
|
37 |
import javax.swing.*; |
|
38 |
import javax.swing.event.*; |
|
39 |
import javax.swing.tree.*; |
|
697
fb86c99b92a2
6711106: REGRESSION: Bad usage of SnapshotMBeanServerConnection in MBeans tab and JConsole plugins.
lmalvent
parents:
55
diff
changeset
|
40 |
import sun.tools.jconsole.ProxyClient.SnapshotMBeanServerConnection; |
2 | 41 |
import sun.tools.jconsole.inspector.*; |
42 |
||
43 |
import com.sun.tools.jconsole.JConsoleContext; |
|
44 |
||
45 |
@SuppressWarnings("serial") |
|
46 |
public class MBeansTab extends Tab implements |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
47 |
NotificationListener, PropertyChangeListener, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
48 |
TreeSelectionListener, TreeWillExpandListener { |
2 | 49 |
|
50 |
private XTree tree; |
|
51 |
private XSheet sheet; |
|
52 |
private XDataViewer viewer; |
|
53 |
||
54 |
public static String getTabName() { |
|
12851
3334e1c781d0
7017818: NLS: JConsoleResources.java cannot be handled by translation team
egahlin
parents:
5506
diff
changeset
|
55 |
return Messages.MBEANS; |
2 | 56 |
} |
57 |
||
58 |
public MBeansTab(final VMPanel vmPanel) { |
|
59 |
super(vmPanel, getTabName()); |
|
60 |
addPropertyChangeListener(this); |
|
61 |
setupTab(); |
|
62 |
} |
|
63 |
||
64 |
public XDataViewer getDataViewer() { |
|
65 |
return viewer; |
|
66 |
} |
|
67 |
||
68 |
public XTree getTree() { |
|
69 |
return tree; |
|
70 |
} |
|
71 |
||
72 |
public XSheet getSheet() { |
|
73 |
return sheet; |
|
74 |
} |
|
75 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
76 |
@Override |
2 | 77 |
public void dispose() { |
78 |
super.dispose(); |
|
79 |
sheet.dispose(); |
|
80 |
} |
|
81 |
||
82 |
public int getUpdateInterval() { |
|
83 |
return vmPanel.getUpdateInterval(); |
|
84 |
} |
|
85 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
86 |
private void buildMBeanServerView() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
87 |
new SwingWorker<Set<ObjectName>, Void>() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
88 |
@Override |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
89 |
public Set<ObjectName> doInBackground() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
90 |
// Register listener for MBean registration/unregistration |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
91 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
92 |
try { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
93 |
getMBeanServerConnection().addNotificationListener( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
94 |
MBeanServerDelegate.DELEGATE_NAME, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
95 |
MBeansTab.this, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
96 |
null, |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
97 |
null); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
98 |
} catch (InstanceNotFoundException e) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
99 |
// Should never happen because the MBeanServerDelegate |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
100 |
// is always present in any standard MBeanServer |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
101 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
102 |
if (JConsole.isDebug()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
103 |
e.printStackTrace(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
104 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
105 |
} catch (IOException e) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
106 |
if (JConsole.isDebug()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
107 |
e.printStackTrace(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
108 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
109 |
vmPanel.getProxyClient().markAsDead(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
110 |
return null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
111 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
112 |
// Retrieve MBeans from MBeanServer |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
113 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
114 |
Set<ObjectName> mbeans = null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
115 |
try { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
116 |
mbeans = getMBeanServerConnection().queryNames(null, null); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
117 |
} catch (IOException e) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
118 |
if (JConsole.isDebug()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
119 |
e.printStackTrace(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
120 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
121 |
vmPanel.getProxyClient().markAsDead(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
122 |
return null; |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
123 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
124 |
return mbeans; |
2 | 125 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
126 |
@Override |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
127 |
protected void done() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
128 |
try { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
129 |
// Wait for mbsc.queryNames() result |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
130 |
Set<ObjectName> mbeans = get(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
131 |
// Do not display anything until the new tree has been built |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
132 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
133 |
tree.setVisible(false); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
134 |
// Cleanup current tree |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
135 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
136 |
tree.removeAll(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
137 |
// Add MBeans to tree |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
138 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
139 |
tree.addMBeansToView(mbeans); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
140 |
// Display the new tree |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
141 |
// |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
142 |
tree.setVisible(true); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
143 |
} catch (Exception e) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
144 |
Throwable t = Utils.getActualException(e); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
145 |
if (JConsole.isDebug()) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
146 |
System.err.println("Problem at MBean tree construction"); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
147 |
t.printStackTrace(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
148 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
149 |
} |
2 | 150 |
} |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
151 |
}.execute(); |
2 | 152 |
} |
153 |
||
154 |
public MBeanServerConnection getMBeanServerConnection() { |
|
155 |
return vmPanel.getProxyClient().getMBeanServerConnection(); |
|
156 |
} |
|
157 |
||
697
fb86c99b92a2
6711106: REGRESSION: Bad usage of SnapshotMBeanServerConnection in MBeans tab and JConsole plugins.
lmalvent
parents:
55
diff
changeset
|
158 |
public SnapshotMBeanServerConnection getSnapshotMBeanServerConnection() { |
fb86c99b92a2
6711106: REGRESSION: Bad usage of SnapshotMBeanServerConnection in MBeans tab and JConsole plugins.
lmalvent
parents:
55
diff
changeset
|
159 |
return vmPanel.getProxyClient().getSnapshotMBeanServerConnection(); |
fb86c99b92a2
6711106: REGRESSION: Bad usage of SnapshotMBeanServerConnection in MBeans tab and JConsole plugins.
lmalvent
parents:
55
diff
changeset
|
160 |
} |
fb86c99b92a2
6711106: REGRESSION: Bad usage of SnapshotMBeanServerConnection in MBeans tab and JConsole plugins.
lmalvent
parents:
55
diff
changeset
|
161 |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
162 |
@Override |
2 | 163 |
public void update() { |
164 |
// Ping the connection to see if it is still alive. At |
|
165 |
// some point the ProxyClient class should centralize |
|
166 |
// the connection aliveness monitoring and no longer |
|
167 |
// rely on the custom tabs to ping the connections. |
|
168 |
// |
|
169 |
try { |
|
170 |
getMBeanServerConnection().getDefaultDomain(); |
|
171 |
} catch (IOException ex) { |
|
172 |
vmPanel.getProxyClient().markAsDead(); |
|
173 |
} |
|
174 |
} |
|
175 |
||
176 |
private void setupTab() { |
|
177 |
// set up the split pane with the MBean tree and MBean sheet panels |
|
178 |
setLayout(new BorderLayout()); |
|
179 |
JSplitPane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); |
|
180 |
mainSplit.setDividerLocation(160); |
|
181 |
mainSplit.setBorder(BorderFactory.createEmptyBorder()); |
|
182 |
||
183 |
// set up the MBean tree panel (left pane) |
|
184 |
tree = new XTree(this); |
|
185 |
tree.setCellRenderer(new XTreeRenderer()); |
|
186 |
tree.getSelectionModel().setSelectionMode( |
|
187 |
TreeSelectionModel.SINGLE_TREE_SELECTION); |
|
188 |
tree.addTreeSelectionListener(this); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
189 |
tree.addTreeWillExpandListener(this); |
2 | 190 |
tree.addMouseListener(ml); |
191 |
JScrollPane theScrollPane = new JScrollPane( |
|
192 |
tree, |
|
193 |
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, |
|
194 |
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); |
|
195 |
JPanel treePanel = new JPanel(new BorderLayout()); |
|
196 |
treePanel.add(theScrollPane, BorderLayout.CENTER); |
|
197 |
mainSplit.add(treePanel, JSplitPane.LEFT, 0); |
|
198 |
||
199 |
// set up the MBean sheet panel (right pane) |
|
200 |
viewer = new XDataViewer(this); |
|
201 |
sheet = new XSheet(this); |
|
202 |
mainSplit.add(sheet, JSplitPane.RIGHT, 0); |
|
203 |
||
204 |
add(mainSplit); |
|
205 |
} |
|
206 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
207 |
/* notification listener: handleNotification */ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
208 |
public void handleNotification( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
209 |
final Notification notification, Object handback) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
210 |
EventQueue.invokeLater(new Runnable() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
211 |
public void run() { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
212 |
if (notification instanceof MBeanServerNotification) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
213 |
ObjectName mbean = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
214 |
((MBeanServerNotification) notification).getMBeanName(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
215 |
if (notification.getType().equals( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
216 |
MBeanServerNotification.REGISTRATION_NOTIFICATION)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
217 |
tree.addMBeanToView(mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
218 |
} else if (notification.getType().equals( |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
219 |
MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
220 |
tree.removeMBeanFromView(mbean); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
221 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
222 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
223 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
224 |
}); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
225 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
226 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
227 |
/* property change listener: propertyChange */ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
228 |
public void propertyChange(PropertyChangeEvent evt) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
229 |
if (JConsoleContext.CONNECTION_STATE_PROPERTY.equals(evt.getPropertyName())) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
230 |
boolean connected = (Boolean) evt.getNewValue(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
231 |
if (connected) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
232 |
buildMBeanServerView(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
233 |
} else { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
234 |
sheet.dispose(); |
2 | 235 |
} |
236 |
} |
|
237 |
} |
|
238 |
||
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
239 |
/* tree selection listener: valueChanged */ |
2 | 240 |
public void valueChanged(TreeSelectionEvent e) { |
241 |
DefaultMutableTreeNode node = |
|
242 |
(DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); |
|
243 |
sheet.displayNode(node); |
|
244 |
} |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
245 |
/* tree mouse listener: mousePressed */ |
2 | 246 |
private MouseListener ml = new MouseAdapter() { |
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
247 |
@Override |
2 | 248 |
public void mousePressed(MouseEvent e) { |
249 |
if (e.getClickCount() == 1) { |
|
250 |
int selRow = tree.getRowForLocation(e.getX(), e.getY()); |
|
251 |
if (selRow != -1) { |
|
252 |
TreePath selPath = |
|
253 |
tree.getPathForLocation(e.getX(), e.getY()); |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
254 |
DefaultMutableTreeNode node = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
255 |
(DefaultMutableTreeNode) selPath.getLastPathComponent(); |
2 | 256 |
if (sheet.isMBeanNode(node)) { |
257 |
tree.expandPath(selPath); |
|
258 |
} |
|
259 |
} |
|
260 |
} |
|
261 |
} |
|
262 |
}; |
|
55
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
263 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
264 |
/* tree will expand listener: treeWillExpand */ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
265 |
public void treeWillExpand(TreeExpansionEvent e) |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
266 |
throws ExpandVetoException { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
267 |
TreePath path = e.getPath(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
268 |
if (!tree.hasBeenExpanded(path)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
269 |
DefaultMutableTreeNode node = |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
270 |
(DefaultMutableTreeNode) path.getLastPathComponent(); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
271 |
if (sheet.isMBeanNode(node) && !tree.hasMetadataNodes(node)) { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
272 |
tree.addMetadataNodes(node); |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
273 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
274 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
275 |
} |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
276 |
|
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
277 |
/* tree will expand listener: treeWillCollapse */ |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
278 |
public void treeWillCollapse(TreeExpansionEvent e) |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
279 |
throws ExpandVetoException { |
5ecee29e98d8
6655515: MBeans tab: operation return values of type Component displayed as String
lmalvent
parents:
2
diff
changeset
|
280 |
} |
2 | 281 |
} |