Commit in hps-java/src/main/java/org/lcsim/hps/monitoring/deprecated on MAIN | |||
AIDAFrame.java | +53 | added 1.1 | |
RunControlDriver.java | +86 | added 1.1 | |
RunControlDialog.java | +106 | added 1.1 | |
+245 |
moving classes out of monitoring package that I consider deprecated
diff -N AIDAFrame.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ AIDAFrame.java 25 Oct 2013 19:41:01 -0000 1.1 @@ -0,0 +1,53 @@
+package org.lcsim.hps.monitoring.deprecated; + +import hep.aida.*; +import hep.aida.ref.plotter.PlotterUtilities; +import java.awt.BorderLayout; +import javax.swing.*; + +/** + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: AIDAFrame.java,v 1.1 2013/10/25 19:41:01 jeremy Exp $ + * @deprecated + */ +@Deprecated +public class AIDAFrame extends JFrame { + + JPanel controlsPanel; + JMenuBar menubar; + JTabbedPane tabbedPane; + + public AIDAFrame() { + tabbedPane = new JTabbedPane(); + this.getContentPane().setLayout(new BorderLayout()); + + menubar = new JMenuBar(); + this.setJMenuBar(menubar); + + this.add(tabbedPane, BorderLayout.CENTER); + + controlsPanel = new JPanel(); + controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.X_AXIS)); + this.add(controlsPanel, BorderLayout.SOUTH); + } + + public void addPlotter(IPlotter plotter) { + JPanel plotterPanel = new JPanel(new BorderLayout()); + // Now embed the plotter + plotterPanel.add(PlotterUtilities.componentForPlotter(plotter), BorderLayout.CENTER); + tabbedPane.add(plotter.title(), plotterPanel); + } + + public JTabbedPane getTabbedPane() { + return tabbedPane; + } + + public JPanel getControlsPanel() { + return controlsPanel; + } + + public JMenuBar getMenubar() { + return menubar; + } +}
\ No newline at end of file
diff -N RunControlDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ RunControlDriver.java 25 Oct 2013 19:41:01 -0000 1.1 @@ -0,0 +1,86 @@
+package org.lcsim.hps.monitoring.deprecated; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import org.lcsim.event.EventHeader; +import org.lcsim.util.Driver; + +/** + * Lightweight driver for stepping through events in offline analysis, without + * running the MonitoringApp. + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: RunControlDriver.java,v 1.1 2013/10/25 19:41:01 jeremy Exp $ + * @deprecated + */ +@Deprecated +public class RunControlDriver extends Driver implements ActionListener { + + JButton nextButton; + JButton runButton; + JFrame nextFrame; + boolean run = false; + final Object syncObject; + + public RunControlDriver() { + syncObject = new Object(); + } + + @Override + protected void startOfData() { + nextFrame = new JFrame(); + nextFrame.setAlwaysOnTop(true); + nextFrame.getContentPane().setLayout(new BoxLayout(nextFrame.getContentPane(), BoxLayout.X_AXIS)); + + nextButton = new JButton("Next event"); + nextButton.addActionListener(this); + nextFrame.add(nextButton); + runButton = new JButton("Run"); + runButton.addActionListener(this); + nextFrame.add(runButton); + + nextFrame.pack(); + nextFrame.setVisible(true); + } + + @Override + protected void process(EventHeader event) { + if (!run) { + synchronized (syncObject) { + try { + syncObject.wait(); + } catch (InterruptedException e) { + } + } + } + } + + @Override + protected void endOfData() { + nextFrame.setVisible(false); + } + + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() == nextButton) { + synchronized (syncObject) { + syncObject.notify(); + } + } + if (ae.getSource() == runButton) { + if (!run) { + runButton.setText("Pause"); + run = true; + synchronized (syncObject) { + syncObject.notify(); + } + } else { + run = false; + runButton.setText("Run"); + } + } + } +}
diff -N RunControlDialog.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ RunControlDialog.java 25 Oct 2013 19:41:01 -0000 1.1 @@ -0,0 +1,106 @@
+package org.lcsim.hps.monitoring.deprecated; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import org.lcsim.event.EventHeader; +import org.lcsim.util.aida.AIDA; + +/** + * Lightweight driver for stepping through events in offline analysis, without + * running the MonitoringApp. + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: RunControlDialog.java,v 1.1 2013/10/25 19:41:01 jeremy Exp $ + * @deprecated + */ +@Deprecated +public class RunControlDialog implements ActionListener { + + JButton nextButton; + JButton runButton; + JButton saveButton; + JFrame nextFrame; + boolean run = false; + final Object syncObject = new Object(); + + public RunControlDialog() { + nextFrame = new JFrame(); + nextFrame.setAlwaysOnTop(true); + nextFrame.getContentPane().setLayout(new BoxLayout(nextFrame.getContentPane(), BoxLayout.X_AXIS)); + + nextButton = new JButton("Next event"); + nextButton.addActionListener(this); + nextFrame.add(nextButton); + + runButton = new JButton("Run"); + runButton.addActionListener(this); + nextFrame.add(runButton); + + saveButton = new JButton("Save"); + saveButton.addActionListener(this); + nextFrame.add(saveButton); + + nextFrame.pack(); + nextFrame.setVisible(true); + nextFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + //return true to process the event; return false to discard; waits if in pause mode + public boolean process(EventHeader event) { + if (!run) { + synchronized (syncObject) { + try { + syncObject.wait(); + } catch (InterruptedException e) { + } + } + } + return true; + } + + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() == nextButton) { + synchronized (syncObject) { + syncObject.notify(); + } + } + if (ae.getSource() == runButton) { + if (!run) { + runButton.setText("Pause"); + run = true; + synchronized (syncObject) { + syncObject.notify(); + } + } else { + run = false; + runButton.setText("Run"); + } + } + if (ae.getSource() == saveButton) { + savePlots(); + } + } + + /** + * Save plots to a selected output file. + */ + private void savePlots() { + JFileChooser fc = new JFileChooser(); + int r = fc.showSaveDialog(nextFrame); + if (r == JFileChooser.APPROVE_OPTION) { + File fileName = fc.getSelectedFile(); + try { + AIDA.defaultInstance().saveAs(fileName); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1