|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun * Microsystems, Inc. All Rights Reserved. */ /* * MFolderNode.java * * Created on May 14, 2003, 2:57 PM */ package org.netbeans.modules.j2ee.deployment.impl.ui; import org.openide.ErrorManager; import org.openide.nodes.*; import javax.management.ObjectName; import javax.management.j2ee.Management; import javax.management.NotificationListener; import org.netbeans.modules.j2ee.deployment.impl.ServerTarget; /** * * @author nn136682 */ public class MFolderNode extends org.openide.nodes.AbstractNode { static private final String ICON = "org/netbeans/modules/j2ee/deployment/impl/ui/resources/mfolder";//NOI18N private ObjectName[] queries; ServerTarget target; /** Creates a new instance of MFolderNode */ public MFolderNode(ServerTarget target, ObjectName[] queries, String name) { super(new MFolderChildren(target, queries)); this.target = target; setDisplayName(name); setIconBase(ICON); this.queries = queries; } public void refresh(Management management) { //((MFolderChildren)getChildren()).refreshNodes(); setChildren(new MFolderChildren(target, queries)); } private static class MFolderChildren extends Children.Keys { private ServerTarget target; private ObjectName[] queries; MFolderChildren(ServerTarget target, ObjectName[] queries) { this.target = target; this.queries = queries; } public void refreshNodes() { if (target.getInstance().isRunning()) setKeys(queries); else setKeys(java.util.Collections.EMPTY_SET); } protected void addNotify() { if (target.getInstance().isRunning()) setKeys(queries); else setKeys(java.util.Collections.EMPTY_SET); } protected void removeNotify() { setKeys(java.util.Collections.EMPTY_SET); } protected Node[] createNodes(Object key) { Management management = target.getManagement(); if (management == null) return new Node[0]; java.util.List children = new java.util.ArrayList(); try { java.util.Set childSet = management.queryNames((ObjectName)key, null); if (childSet != null) children.addAll(childSet); } catch(Exception e) { ErrorManager.getDefault().notify(ErrorManager.WARNING, e); } ManagementNode[] nodes = new ManagementNode[children.size()]; for (int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.