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 *
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.
24 */
25
26 package sun.tools.jconsole.inspector;
27
28 import java.awt.EventQueue;
29 import java.util.*;
30 import javax.management.*;
31 import javax.swing.*;
32 import javax.swing.tree.*;
33 import sun.tools.jconsole.JConsole;
34 import sun.tools.jconsole.MBeansTab;
35 import sun.tools.jconsole.Resources;
36 import sun.tools.jconsole.inspector.XNodeInfo;
37 import sun.tools.jconsole.inspector.XNodeInfo.Type;
38
39 @SuppressWarnings("serial")
40 public class XTree extends JTree {
41
42 private static final List<String> orderedKeyPropertyList =
43 new ArrayList<String>();
44 static {
45 String keyPropertyList =
46 System.getProperty("com.sun.tools.jconsole.mbeans.keyPropertyList");
47 if (keyPropertyList == null) {
48 orderedKeyPropertyList.add("type");
49 orderedKeyPropertyList.add("j2eeType");
50 } else {
51 StringTokenizer st = new StringTokenizer(keyPropertyList, ",");
52 while (st.hasMoreTokens()) {
53 orderedKeyPropertyList.add(st.nextToken());
54 }
55 }
180 label, token.toString());
181 changeNodeValue(node, userObject);
182 } else {
183 DefaultMutableTreeNode parent =
184 (DefaultMutableTreeNode) node.getParent();
185 model.removeNodeFromParent(node);
186 nodes.remove(hashKey);
187 delParentFromView(dn, 1, parent);
188 }
189 }
190 }
191 }
192 }
193 });
194 }
195
196 /**
197 * Returns true if any of the children nodes is an MBean.
198 */
199 private boolean hasMBeanChildren(DefaultMutableTreeNode node) {
200 for (Enumeration e = node.children(); e.hasMoreElements(); ) {
201 DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
202 if (((XNodeInfo) n.getUserObject()).getType().equals(Type.MBEAN)) {
203 return true;
204 }
205 }
206 return false;
207 }
208
209 /**
210 * Remove all the children nodes which are not MBean.
211 */
212 private void removeNonMBeanChildren(DefaultMutableTreeNode node) {
213 Set<DefaultMutableTreeNode> metadataNodes =
214 new HashSet<DefaultMutableTreeNode>();
215 DefaultTreeModel model = (DefaultTreeModel) getModel();
216 for (Enumeration e = node.children(); e.hasMoreElements(); ) {
217 DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
218 if (!((XNodeInfo) n.getUserObject()).getType().equals(Type.MBEAN)) {
219 metadataNodes.add(n);
220 }
|
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 *
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.
24 */
25
26 package sun.tools.jconsole.inspector;
27
28 import java.awt.EventQueue;
29 import java.util.*;
30 import javax.management.*;
31 import javax.swing.*;
32 import javax.swing.tree.*;
33 import sun.tools.jconsole.JConsole;
34 import sun.tools.jconsole.MBeansTab;
35 import sun.tools.jconsole.Messages;
36 import sun.tools.jconsole.inspector.XNodeInfo;
37 import sun.tools.jconsole.inspector.XNodeInfo.Type;
38
39 @SuppressWarnings("serial")
40 public class XTree extends JTree {
41
42 private static final List<String> orderedKeyPropertyList =
43 new ArrayList<String>();
44 static {
45 String keyPropertyList =
46 System.getProperty("com.sun.tools.jconsole.mbeans.keyPropertyList");
47 if (keyPropertyList == null) {
48 orderedKeyPropertyList.add("type");
49 orderedKeyPropertyList.add("j2eeType");
50 } else {
51 StringTokenizer st = new StringTokenizer(keyPropertyList, ",");
52 while (st.hasMoreTokens()) {
53 orderedKeyPropertyList.add(st.nextToken());
54 }
55 }
180 label, token.toString());
181 changeNodeValue(node, userObject);
182 } else {
183 DefaultMutableTreeNode parent =
184 (DefaultMutableTreeNode) node.getParent();
185 model.removeNodeFromParent(node);
186 nodes.remove(hashKey);
187 delParentFromView(dn, 1, parent);
188 }
189 }
190 }
191 }
192 }
193 });
194 }
195
196 /**
197 * Returns true if any of the children nodes is an MBean.
198 */
199 private boolean hasMBeanChildren(DefaultMutableTreeNode node) {
200 for (Enumeration<?> e = node.children(); e.hasMoreElements();) {
201 DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
202 if (((XNodeInfo) n.getUserObject()).getType().equals(Type.MBEAN)) {
203 return true;
204 }
205 }
206 return false;
207 }
208
209 /**
210 * Remove all the children nodes which are not MBean.
211 */
212 private void removeNonMBeanChildren(DefaultMutableTreeNode node) {
213 Set<DefaultMutableTreeNode> metadataNodes =
214 new HashSet<DefaultMutableTreeNode>();
215 DefaultTreeModel model = (DefaultTreeModel) getModel();
216 for (Enumeration e = node.children(); e.hasMoreElements(); ) {
217 DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
218 if (!((XNodeInfo) n.getUserObject()).getType().equals(Type.MBEAN)) {
219 metadataNodes.add(n);
220 }
|