From: Jan S. <st...@us...> - 2002-01-27 23:07:56
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/nodes In directory usw-pr-cvs1:/tmp/cvs-serv5570 Added Files: SnapshotNode.java Log Message: Node for snapshot. --- NEW FILE: SnapshotNode.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 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.data.Snapshot; import net.sourceforge.javaprofiler.module.actions.*; import net.sourceforge.javaprofiler.module.data.ProfilerData; /** * Node for one snapshot. * * @author Jan Stola */ public class SnapshotNode extends AbstractNode implements SnapshotCookie { private Snapshot snapshot; private ResourceBundle bundle=NbBundle.getBundle(SnapshotNode.class); public SnapshotNode(Snapshot snapshot) { super(Children.LEAF); this.snapshot=snapshot; setIconBase("/net/sourceforge/javaprofiler/module/resources/SnapshotNodeIcon"); //setDefaultAction(SystemAction.get(?.class)); setDisplayName(snapshot.getName()); setShortDescription(NbBundle.getMessage(SnapshotNode.class, "HINT_snapshotNode")); getCookieSet().add(this); } protected SystemAction[] createActions() { return new SystemAction[] { SystemAction.get(PropertiesAction.class) }; } public HelpCtx getHelpCtx() { return new HelpCtx(SnapshotNode.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("name", String.class, bundle.getString("LBL_snapshotName"), bundle.getString("HINT_snapshotName")) { public Object getValue() { return snapshot.getName(); } }); props.put(new PropertySupport.ReadOnly("time", String.class, bundle.getString("LBL_snapshotTime"), bundle.getString("HINT_snapshotTime")) { public Object getValue() { return new Long(snapshot.getSnapshot().time()); } }); return sheet; } public boolean canCopy() { return false; } } /* * $Log: SnapshotNode.java,v $ * Revision 1.1 2002/01/27 23:07:54 stolis * Node for snapshot. * */ |