From: Lukas P. <pe...@us...> - 2002-08-31 08:46:37
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/sheets In directory usw-pr-cvs1:/tmp/cvs-serv4206 Added Files: MultiRootSheet.java Log Message: automatically adds Alloc/CPU/Mon --- NEW FILE: MultiRootSheet.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.sheets; import java.util.*; import java.lang.reflect.InvocationTargetException; import org.openide.TopManager; import org.openide.nodes.Sheet; import org.openide.nodes.Node; import org.openide.nodes.PropertySupport; import java.util.ResourceBundle; import org.openide.util.NbBundle; import net.sourceforge.javaprofiler.jpi.AllocStat; import net.sourceforge.javaprofiler.jpi.CPUStat; import net.sourceforge.javaprofiler.jpi.MonStat; import net.sourceforge.javaprofiler.module.nodes.*; public class MultiRootSheet implements SheetFactory { private final Object ref; public MultiRootSheet(Object reference) { ref=reference; } public Sheet create() { ResourceBundle bundle=NbBundle.getBundle(getClass()); Sheet sh=new Sheet(); Sheet.Set set=Sheet.createPropertiesSet(); try { Node.Property pr; pr=new PropertySupport.Reflection(ref, String.class, "toString", null); pr.setName("Description"); pr.setDisplayName(bundle.getString("LBL_Description")); set.put(pr); if (ref instanceof AllocStat) AllocStatProperty.addProperties(set, (AllocStat) ref); if (ref instanceof CPUStat) CPUStatProperty.addProperties(set, (CPUStat) ref); if (ref instanceof MonStat) MonStatProperty.addProperties(set, (MonStat) ref); } catch (NoSuchMethodException e) { TopManager.getDefault().notifyException(e); } sh.put(set); return sh; } } /* * $Log: MultiRootSheet.java,v $ * Revision 1.1 2002/08/31 08:46:34 petrul * automatically adds Alloc/CPU/Mon * */ |