From: Jan S. <st...@us...> - 2002-05-16 11:58:48
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/nodes In directory usw-pr-cvs1:/tmp/cvs-serv26396 Added Files: ListenerNode.java Log Message: Listener node class. --- NEW FILE: ListenerNode.java --- /* * 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 the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.module.nodes; import java.util.*; import java.text.MessageFormat; import org.openide.TopManager; import org.openide.actions.*; import org.openide.nodes.*; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; import org.openide.util.actions.SystemAction; import net.sourceforge.javaprofiler.module.actions.*; import net.sourceforge.javaprofiler.module.data.ConListener; import net.sourceforge.javaprofiler.module.data.ProfilerData; /** * Node for connection listener. * * @author Jan Stola */ public class ListenerNode extends AbstractNode implements ConListenerCookie { private ConListener listener; private ResourceBundle bundle=NbBundle.getBundle(ListenerNode.class); public ListenerNode(ConListener listener) { super(Children.LEAF); this.listener=listener; setIconBase("/net/sourceforge/javaprofiler/module/resources/ListenerNodeIcon"); String messageFormat=bundle.getString("LBL_listenerNode"); setDisplayName(MessageFormat.format(messageFormat, new Object[]{new Integer(listener.getLocation())})); setShortDescription(bundle.getString("HINT_listenerNode")); getCookieSet().add(this); } protected SystemAction[] createActions() { return new SystemAction[] { SystemAction.get(TerminateListenerAction.class), null, SystemAction.get(PropertiesAction.class) }; } public HelpCtx getHelpCtx() { return new HelpCtx(ListenerNode.class); } protected Sheet createSheet() { Sheet sheet=super.createSheet(); Sheet.Set props=sheet.get(Sheet.PROPERTIES); if (props==null) { props=Sheet.createPropertiesSet(); sheet.put(props); } props.put(new PropertySupport.ReadOnly("port", String.class, bundle.getString("LBL_listenerLocation"), bundle.getString("HINT_listenerLocation")) { public Object getValue() { return new Integer(listener.getLocation()); } }); return sheet; } public boolean canCopy() { return false; } /** * Terminates listening to the connection from the profiled process. */ public void terminate() { listener.terminate(); ProfilerData.getData().removeConListener(listener); } } /* * $Log: ListenerNode.java,v $ * Revision 1.1 2002/05/16 11:58:45 stolis * Listener node class. * */ |