hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N MonitoringAnalysisFactory.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MonitoringAnalysisFactory.java 5 Jun 2012 18:21:06 -0000 1.1
@@ -0,0 +1,32 @@
+package org.lcsim.hps.monitoring;
+
+import hep.aida.IPlotterFactory;
+import hep.aida.ref.AnalysisFactory;
+
+/**
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: MonitoringAnalysisFactory.java,v 1.1 2012/06/05 18:21:06 jeremy Exp $
+ */
+public class MonitoringAnalysisFactory extends AnalysisFactory {
+
+ /**
+ * Register this class as the default AnalysisFactory for AIDA by setting the magic property string.
+ */
+ final static void register() {
+ System.setProperty("hep.aida.IAnalysisFactory", MonitoringAnalysisFactory.class.getName());
+ }
+
+ /**
+ * Create a named plotter factory for the monitoring application.
+ */
+ public IPlotterFactory createPlotterFactory(String name) {
+ return new MonitoringPlotFactory(name);
+ }
+
+ /**
+ * Create an unnamed plotter factory for the monitoring application.
+ */
+ public IPlotterFactory createPlotterFactory() {
+ return new MonitoringPlotFactory(null);
+ }
+}
\ No newline at end of file
hps-java/src/main/java/org/lcsim/hps/monitoring
diff -N MonitoringPlotFactory.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MonitoringPlotFactory.java 5 Jun 2012 18:21:06 -0000 1.1
@@ -0,0 +1,64 @@
+package org.lcsim.hps.monitoring;
+
+import hep.aida.IPlotter;
+import hep.aida.ref.plotter.PlotterFactory;
+import hep.aida.ref.plotter.PlotterUtilities;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+/**
+ * This class implements an AIDA IPlotterFactory for the monitoring application.
+ * It extends the reference plotter by putting plots into tabs. Each plotter
+ * factory is given its own top-level tab in a root tabbed pane, under which are
+ * separate tabs for each plotter. The root pane is static and shared across all
+ * plotter factories. It is set externally by the MonitoringApplication before
+ * any calls to AIDA are made from Drivers.
+ * @author Jeremy McCormick <[log in to unmask]>
+ * @version $Id: MonitoringPlotFactory.java,v 1.1 2012/06/05 18:21:06 jeremy Exp $
+ */
+class MonitoringPlotFactory extends PlotterFactory {
+
+ // Name of factory.
+ String name = null;
+
+ // The GUI tabs for this factory's plots.
+ JTabbedPane tabs = new JTabbedPane();
+
+ // Root pane where this factory's top-level tab will be inserted.
+ static JTabbedPane rootPane = null;
+
+ MonitoringPlotFactory() {
+ super();
+ rootPane.addTab("", tabs);
+ }
+
+ MonitoringPlotFactory(String name) {
+ super();
+ this.name = name;
+ if (!(new RuntimeException()).getStackTrace()[2].getClassName().equals("hep.aida.ref.plotter.style.registry.StyleStoreXMLReader"))
+ rootPane.addTab(name, tabs);
+ }
+
+ public IPlotter create(String plotterName) {
+ IPlotter plotter = super.create(plotterName);
+ JPanel plotterPanel = new JPanel(new BorderLayout());
+ plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER);
+ tabs.addTab(plotterName, plotterPanel);
+ return plotter;
+ }
+
+ public IPlotter create() {
+ return create((String) null);
+ }
+
+ /**
+ * Set the static reference to the root tabbed pane where this factory's GUI tabs will be inserted.
+ * @param rootPane
+ */
+ static void setRootPane(JTabbedPane rootPane) {
+ MonitoringPlotFactory.rootPane = rootPane;
+ }
+}
\ No newline at end of file