hps-java/src/main/java/org/lcsim/hps/monitoring
diff -u -r1.59 -r1.60
--- MonitoringApplication.java 4 Oct 2013 06:02:19 -0000 1.59
+++ MonitoringApplication.java 6 Nov 2013 19:19:56 -0000 1.60
@@ -28,6 +28,7 @@
import static org.lcsim.hps.monitoring.MonitoringCommands.steeringFileCmd;
import static org.lcsim.hps.monitoring.MonitoringCommands.steeringResourceCmd;
import static org.lcsim.hps.monitoring.MonitoringCommands.updateTimeCmd;
+import hep.aida.jfree.AnalysisFactory;
import java.awt.AWTException;
import java.awt.BorderLayout;
@@ -82,27 +83,32 @@
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.lcsim.hps.evio.LCSimEventBuilder;
+import org.lcsim.hps.monitoring.deprecated.Resettable;
import org.lcsim.job.JobControlManager;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
/**
- * Monitoring application for HPS Test Run, which can run LCSim steering files
- * on data converted from the ET ring. This class is accessible to users by
- * calling its main() method.
- *
+ * Monitoring application for HPS Test Run, which can run LCSim steering files on data
+ * converted from the ET ring. This class is accessible to users by calling its main()
+ * method.
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: MonitoringApplication.java,v 1.59 2013/10/04 06:02:19 jeremy Exp $
+ * @version $Id: MonitoringApplication.java,v 1.60 2013/11/06 19:19:56 jeremy Exp $
*/
-// FIXME: Review minimum size settings to see which are actually being respected. Remove where not needed.
-// FIXME: Since this class is almost 2k lines, might want to refactor into multiple classes.
-// TODO: Capture std err and out and redirect to a text panel within the app.
-// TODO: Review use of Resettable and Redrawable to see if they can be removed and standard Driver API used instead.
+// FIXME: Review minimum size settings to see which are actually being respected. Remove
+// where they are not needed.
+// FIXME: Since this class is almost 2k lines, might want to refactor it into multiple
+// classes.
+// TODO: Capture std err and out and redirect to a text panel within the application.
+// TODO: Review use of Resettable and Redrawable to see if they can be removed and the
+// standard Driver API used instead. Resettable can maybe be replaced by startOfData().
+// TODO: Add JFreeChart backend support and make CL option to use it.
+// FIXME: Tracebacks from errors should be caught and written into the log table.
public class MonitoringApplication {
// Top-level Swing components.
private JPanel mainPanel;
- private JPanel leftPanel;
+ private JPanel leftPanel;
private JPanel rightPanel;
private JTabbedPane plotPane;
private JTabbedPane tabs;
@@ -113,8 +119,9 @@
private JMenuBar menuBar;
private EventButtonsPanel buttonsPanel;
private JFrame frame;
-
- // References to menu items that will be enabled/disabled depending on application state.
+
+ // References to menu items that will be enabled/disabled depending on application
+ // state.
private JMenuItem connectItem;
private JMenuItem disconnectItem;
private JMenuItem resetConnectionItem;
@@ -128,70 +135,70 @@
private JMenuItem saveJobSettingsItem;
private JMenuItem loadJobSettingsItem;
private JMenuItem resetJobSettingsItem;
-
+
// Saved references to System.out and System.err in case need to reset.
private final PrintStream sysOut = System.out;
private final PrintStream sysErr = System.err;
-
+
// ET connection parameters and state.
private ConnectionParameters connectionParameters;
private EtConnection connection;
private int connectionStatus = ConnectionStatus.DISCONNECTED;
-
+
// Event processing objects.
private JobControlManager jobManager;
private LCSimEventBuilder eventBuilder;
private EtEventProcessor eventProcessor;
private Thread eventProcessingThread;
-
+
// Job timing.
private Timer timer;
private long jobStartTime;
-
+
// ActionListener for GUI event dispatching.
private ActionListener actionListener;
-
+
// Logging objects.
private static Logger logger;
private Handler logHandler;
private DefaultTableModel logTableModel;
- static final String[] logTableColumns = {"Source", "Message", "Date", "Level"};
+ static final String[] logTableColumns = { "Source", "Message", "Date", "Level" };
private JTable logTable;
private Level defaultLogMessageLevel = Level.INFO;
-
+
// Some default GUI size parameters.
private final int logTableWidth = 700;
private final int logTableHeight = 270;
-
+
// Format for screenshots. Hard-coded to PNG.
private static final String screenshotFormat = "png";
-
+
// The AIDA remote server.
private AIDAServer server;
-
+
// Listener for processing EtEvents.
private EtEventListener etListener = new MonitoringApplicationEtListener();
-
+
// Maximum time in millis to wait for the ET system to disconnect.
// TODO: Make this an option in the JobPanel.
private int maxCleanupTime = 5000;
-
+
// Format of date field for log.
private final SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss.SSS");
private static final String LCSIM_FAIL_MESSAGE = "Failed to setup LCSim.";
-
+
private static final int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
private static final int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
-
- private static final int leftPanelWidth = (int)(screenWidth * 0.33);
- private static final int rightPanelWidth = (int)(screenWidth * 0.40);
-
+
+ private static final int leftPanelWidth = (int) (screenWidth * 0.33);
+ private static final int rightPanelWidth = (int) (screenWidth * 0.40);
+
private static final int connectionStatusPanelHeight = 50;
private static final int connectionStatusPanelWidth = 400;
-
+
/**
- * Constructor for the monitoring application. Users cannot access this.
- * Call the main method instead.
+ * Constructor for the monitoring application. Users cannot access this. Call the main
+ * method instead.
*/
private MonitoringApplication() {
@@ -200,7 +207,7 @@
// Create the ActionEventListener for event dispatching.
actionListener = new MonitoringApplicationActionListener();
-
+
// Setup the application menus.
createMenu();
@@ -212,12 +219,13 @@
// Setup AIDA.
setupAida();
-
+
// Log that the application started successfully.
- log("Application initialized successfully.");
+ log("Application initialized successfully.");
}
-
+
private void setupAida() {
+ AnalysisFactory.configure();
MonitoringAnalysisFactory.register();
MonitoringPlotFactory.setRootPane(plotPane);
}
@@ -231,19 +239,22 @@
createLeftPanel();
createRightPanel();
}
-
+
+ /**
+ * Create the left panel.
+ */
private void createLeftPanel() {
-
+
// Lefthand panel containing the three application tabs.
leftPanel = new JPanel();
- // set border ex.
- //leftPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
- //leftPanel.setBorder(BorderFactory.createEmptyBorder());
- leftPanel.setMinimumSize(new Dimension(leftPanelWidth, screenHeight-30));
+ // set border ex.
+ // leftPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
+ // leftPanel.setBorder(BorderFactory.createEmptyBorder());
+ leftPanel.setMinimumSize(new Dimension(leftPanelWidth, screenHeight - 30));
leftPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
-
+
// Event processing buttons.
c = new GridBagConstraints();
c.gridx = 0;
@@ -253,7 +264,7 @@
buttonsPanel = new EventButtonsPanel();
buttonsPanel.addActionListener(actionListener);
leftPanel.add(buttonsPanel, c);
-
+
// Connection status panel.
c.gridx = 0;
c.gridy = 1;
@@ -290,7 +301,7 @@
c.weightx = c.weighty = 1.0;
c.insets = new Insets(0, 0, 0, 10);
leftPanel.add(tabsPanel, c);
-
+
// Layout attributes for left panel.
c = new GridBagConstraints();
c.gridx = 0;
@@ -302,15 +313,18 @@
c.insets = new Insets(0, 5, 0, 0);
mainPanel.add(leftPanel, c);
}
-
+
+ /**
+ * Create the right panel.
+ */
private void createRightPanel() {
-
+
// Create right-hand panel.
rightPanel = new JPanel();
- rightPanel.setPreferredSize(new Dimension(rightPanelWidth, screenHeight-30));
- rightPanel.setMinimumSize(new Dimension(rightPanelWidth, screenHeight-30));
- rightPanel.setLayout(new BorderLayout());
-
+ rightPanel.setPreferredSize(new Dimension(rightPanelWidth, screenHeight - 30));
+ rightPanel.setMinimumSize(new Dimension(rightPanelWidth, screenHeight - 30));
+ rightPanel.setLayout(new BorderLayout());
+
// Create plot pane with empty tabs.
plotPane = new JTabbedPane();
rightPanel.add(plotPane, BorderLayout.CENTER);
@@ -325,7 +339,10 @@
c.weighty = 1.0;
mainPanel.add(rightPanel, c);
}
-
+
+ /**
+ * Create the menu items.
+ */
private void createMenu() {
menuBar = new JMenuBar();
@@ -333,24 +350,25 @@
JMenu connectionMenu = new JMenu("Connection");
connectionMenu.setMnemonic(KeyEvent.VK_C);
menuBar.add(connectionMenu);
-
+
connectItem = addMenuItem("Connect", KeyEvent.VK_C, connectCmd, true, "Connect to ET system using parameters from connection panel.", connectionMenu);
- disconnectItem = addMenuItem("Disconnect", KeyEvent.VK_D, disconnectCmd, false, "Disconnect from the current ET session.", connectionMenu);
+ disconnectItem = addMenuItem("Disconnect", KeyEvent.VK_D, disconnectCmd, false, "Disconnect from the current ET session.", connectionMenu);
resetConnectionItem = addMenuItem("Reset Connection Settings", KeyEvent.VK_R, resetConnectionSettingsCmd, true, "Reset connection settings to defaults.", connectionMenu);
- connectionLoadItem = addMenuItem("Load Connection...", KeyEvent.VK_L, loadConnectionCmd, true, "Load connection settings from a saved properties file.", connectionMenu);
+ connectionLoadItem = addMenuItem("Load Connection...", KeyEvent.VK_L, loadConnectionCmd, true, "Load connection settings from a saved properties file.", connectionMenu);
addMenuItem("Save Connection...", KeyEvent.VK_S, saveConnectionCmd, true, "Save connection settings to a properties file.", connectionMenu);
addMenuItem("Exit", KeyEvent.VK_X, exitCmd, true, "Exit from the application.", connectionMenu);
JMenu eventMenu = new JMenu("Event");
eventMenu.setMnemonic(KeyEvent.VK_E);
menuBar.add(eventMenu);
-
+
addMenuItem("Reset Event Monitor", KeyEvent.VK_E, resetEventsCmd, true, "Reset timer and counters in the event monitor tab.", eventMenu);
/**
- * FIXME: Rest of these should be converted to use the addMenuItem() helper method...
+ * FIXME: Rest of these should be converted to use the addMenuItem() helper
+ * method...
*/
-
+
JMenuItem eventRefreshItem = new JMenuItem("Set Event Refresh...");
eventRefreshItem.setMnemonic(KeyEvent.VK_V);
eventRefreshItem.setActionCommand(eventRefreshCmd);
@@ -453,10 +471,20 @@
saveLogItem.addActionListener(actionListener);
saveLogItem.setToolTipText("Save the log records to a tab delimited text file.");
logMenu.add(saveLogItem);
-
+
addMenuItem("Clear log", KeyEvent.VK_C, clearLogTableCmd, true, "Clear the log table of all messages.", logMenu);
}
-
+
+ /**
+ * Add a menu item.
+ * @param label The label.
+ * @param mnemonic The single letter shortcut.
+ * @param cmd The command.
+ * @param enabled Whether it is enabled.
+ * @param tooltip The tooltip text.
+ * @param menu The menu to which it should be added.
+ * @return
+ */
private JMenuItem addMenuItem(String label, int mnemonic, String cmd, boolean enabled, String tooltip, JMenu menu) {
JMenuItem item = new JMenuItem(label);
item.setMnemonic(mnemonic);
@@ -477,26 +505,32 @@
* Puts log messages into the application's log table GUI component.
*/
public void publish(LogRecord record) {
- Object[] row = new Object[]{record.getLoggerName(), // source
- record.getMessage(), // message
- dateFormat.format(new Date(record.getMillis())), // date
- record.getLevel()}; // level
+ Object[] row = new Object[] { record.getLoggerName(), // source
+ record.getMessage(), // message
+ dateFormat.format(new Date(record.getMillis())), // date
+ record.getLevel() }; // level
logTableModel.insertRow(logTable.getRowCount(), row);
}
+ /**
+ * Close the handler (no-op).
+ */
public void close() throws SecurityException {
}
+ /**
+ * Flush the handler (no-op).
+ */
public void flush() {
}
}
/**
- * Creates the application's log table GUI component, which is a JTable
- * containing messages from the logger.
+ * Creates the application's log table GUI component, which is a JTable containing
+ * messages from the logger.
*/
private void createLogTable() {
-
+
String data[][] = new String[0][0];
logTableModel = new DefaultTableModel(data, logTableColumns);
logTable = new JTable(logTableModel);
@@ -515,8 +549,7 @@
}
/**
- * Setup the application's Logger object for writing messages to the log
- * table.
+ * Setup the application's Logger object for writing messages to the log table.
*/
private void setupLogger() {
logger = Logger.getLogger(this.getClass().getSimpleName());
@@ -528,7 +561,6 @@
/**
* Create the monitoring application frame and run it on a separate thread.
- *
* @return Reference to the created application.
*/
private static final MonitoringApplication createMonitoringApplication() {
@@ -543,7 +575,6 @@
/**
* Run the monitoring application from the command line.
- *
* @param args The command line arguments.
*/
public static void main(String[] args) {
@@ -585,10 +616,18 @@
}
}
+ /**
+ * Load connection settings from a file.
+ * @param file The properties file.
+ */
private void loadConnectionSettings(File file) {
connectionPanel.loadPropertiesFile(file);
}
+ /**
+ * Load job settings from a file.
+ * @param file The properties file.
+ */
private void loadJobSettings(File file) {
try {
jobPanel.setJobSettings(new JobSettings(file));
@@ -606,14 +645,19 @@
*/
private class MonitoringApplicationActionListener implements ActionListener {
+ /**
+ * Action handler method for the app.
+ * @param e The event to handle.
+ */
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd != MonitoringCommands.updateTimeCmd) {
- // Log actions performed. Catch errors in case logging is not initialized yet.
+ // Log actions performed. Catch errors in case logging is not initialized
+ // yet.
try {
log(Level.FINEST, "Action performed <" + cmd + ">.");
} catch (Exception xx) {
- xx.printStackTrace();
+ xx.printStackTrace();
}
}
if (connectCmd.equals(cmd)) {
@@ -677,13 +721,16 @@
}
/**
- * This fires when a steering resource file is selected from the combo box.
- * The Job Settings are changed to use a resource type.
+ * This fires when a steering resource file is selected from the combo box. The Job
+ * Settings are changed to use a resource type.
*/
private void steeringResourceSelected() {
jobPanel.setSteeringType(JobPanel.RESOURCE);
}
+ /**
+ * Save the job settings to a selected file.
+ */
private void saveJobSettings() {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Save Job Settings");
@@ -702,6 +749,9 @@
}
}
+ /**
+ * Load job settings from a selected file.
+ */
private void loadJobSettings() {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Load Job Settings");
@@ -719,6 +769,9 @@
}
}
+ /**
+ * Reset the job settings to the defaults.
+ */
private void resetJobSettings() {
jobPanel.resetJobSettings();
// Redirect System.out and err back to the terminal.
@@ -726,8 +779,8 @@
}
/**
- * This is the primary entry point for starting a monitoring session. The
- * session is started on a new thread so it doesn't block.
+ * This is the primary entry point for starting a monitoring session. The session is
+ * started on a new thread so it doesn't block.
*/
private void startSessionThread() {
if (getConnectionStatus() != ConnectionStatus.CONNECTED) {
@@ -744,8 +797,7 @@
}
/**
- * Set a new log level for the application and also forward to the event
- * processor.
+ * Set a new log level for the application and also forward to the event processor.
*/
private void setLogLevel() {
Level newLevel = jobPanel.getLogLevel();
@@ -753,56 +805,9 @@
if (eventProcessor != null) {
eventProcessor.setLogLevel(newLevel);
}
-
+
log(Level.INFO, "Log Level was changed to <" + jobPanel.getLogLevel().toString() + ">.");
}
-
- /*
- private class DisconnectDialog extends JDialog {
-
- static final String cmd = "done";
- volatile boolean done = false;
-
- DisconnectDialog() {
- super((JFrame)null, "Disconnecting");
- setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 0;
- c.fill = GridBagConstraints.NONE;
- getContentPane().add(new JLabel("You are about to be disconnected."), c);
- JButton b = new JButton("Ok");
- b.setActionCommand(cmd);
- b.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent evt) {
- if (evt.getActionCommand().equals(cmd)) {
- done = true;
- dispose();
- }
- }
- });
- c = new GridBagConstraints();
- c.gridx = 0;
- c.gridy = 1;
- c.fill = GridBagConstraints.NONE;
- getContentPane().add(b, c);
- pack();
- setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- setModal(false);
- //setMinimumSize(new Dimension(100, 100));
- setResizable(false);
- setLocationRelativeTo(null);
- setVisible(true);
- toFront();
- }
-
- void waitForConfirm() {
- while (!done) {
- }
- return;
- }
- }
- */
/**
* The listener for hooking into the event processor.
@@ -844,20 +849,21 @@
public void errorOnEvent() {
eventPanel.updateBadEventCount();
}
-
+
/**
- * End of job actions. This cleans up the Monitoring Application to put
- * it into the proper state for subsequent disconnection from the ET ring.
+ * End of job actions. This cleans up the Monitoring Application to put it into
+ * the proper state for subsequent disconnection from the ET ring.
*/
public void finish() {
// Show a warning dialog box before disconnecting, if this option is selected.
- // This needs to go here rather than in disconnect() so that the LCSim plots stay up.
+ // This needs to go here rather than in disconnect() so that the LCSim plots
+ // stay up.
if (warnOnDisconnect()) {
log(Level.FINEST, "Waiting for user to verify disconnect request.");
- showDialog("You are about to be disconnected.");
- //DisconnectDialog d = new DisconnectDialog();
- //d.waitForConfirm();
+ showDialog("You are about to be disconnected.");
+ // DisconnectDialog d = new DisconnectDialog();
+ // d.waitForConfirm();
}
try {
@@ -891,7 +897,7 @@
if (server != null) {
log(Level.INFO, "Closing remote AIDA server.");
server.close();
- server = null;
+ server = null;
log(Level.INFO, "Remote AIDA server was closed.");
}
} catch (Exception e) {
@@ -925,7 +931,6 @@
/**
* Set the connection status.
- *
* @param status The connection status.
*/
private void setConnectionStatus(int status) {
@@ -937,7 +942,6 @@
/**
* Get the current connection status.
- *
* @return The connection status.
*/
private int getConnectionStatus() {
@@ -946,7 +950,6 @@
/**
* Pop-up a modal dialog.
- *
* @param m The message to display in the dialog box.
*/
private void showDialog(String m) {
@@ -962,21 +965,21 @@
frame.setContentPane(mainPanel);
frame.setJMenuBar(menuBar);
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
- //frame.setMinimumSize(new Dimension(600, 850));
+ // frame.setMinimumSize(new Dimension(600, 850));
frame.setResizable(true);
frame.pack();
-
- // Maximize frame size.
- //final GraphicsConfiguration config = frame.getGraphicsConfiguration();
- //final int left = Toolkit.getDefaultToolkit().getScreenInsets(config).left;
- //final int right = Toolkit.getDefaultToolkit().getScreenInsets(config).right;
- //final int top = Toolkit.getDefaultToolkit().getScreenInsets(config).top;
- //final int bottom = Toolkit.getDefaultToolkit().getScreenInsets(config).bottom;
- //final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- //final int width = screenSize.width - left - right;
- //final int height = screenSize.height - top - bottom;
- //frame.setSize(width,height);
-
+
+ // Maximize frame size.
+ // final GraphicsConfiguration config = frame.getGraphicsConfiguration();
+ // final int left = Toolkit.getDefaultToolkit().getScreenInsets(config).left;
+ // final int right = Toolkit.getDefaultToolkit().getScreenInsets(config).right;
+ // final int top = Toolkit.getDefaultToolkit().getScreenInsets(config).top;
+ // final int bottom = Toolkit.getDefaultToolkit().getScreenInsets(config).bottom;
+ // final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ // final int width = screenSize.width - left - right;
+ // final int height = screenSize.height - top - bottom;
+ // frame.setSize(width,height);
+
frame.setVisible(true);
}
@@ -1020,7 +1023,6 @@
/**
* Get the full title of the application.
- *
* @return The application title.
*/
private static String getApplicationTitle() {
@@ -1029,7 +1031,6 @@
/**
* Get the hostname, which is used in the application title.
- *
* @return The hostname.
*/
private static String getHostname() {
@@ -1042,7 +1043,6 @@
/**
* Get the user name, which is used in the application title.
- *
* @return The user name.
*/
private static String getUserName() {
@@ -1054,9 +1054,8 @@
}
/**
- * Call the reset() method on Drivers which implement {@link Resettable}.
- * They must implement the
- * {@link Resettable} interface for this to work.
+ * Call the reset() method on Drivers which implement {@link Resettable}. They must
+ * implement the {@link Resettable} interface for this to work.
*/
private synchronized void resetDrivers() {
if (jobManager != null) {
@@ -1074,9 +1073,9 @@
}
/**
- * Redirect System.out and System.err to a file. This is primarily used to
- * capture lengthy debug output from event processing. Messages sent to the
- * Logger are unaffected.
+ * Redirect System.out and System.err to a file. This is primarily used to capture
+ * lengthy debug output from event processing. Messages sent to the Logger are
+ * unaffected.
*/
private void logToFile() {
JFileChooser fc = new JFileChooser();
@@ -1106,7 +1105,7 @@
log("Redirected System output to file <" + logFile.getPath() + ">.");
} catch (IOException e) {
- e.printStackTrace();
+ e.printStackTrace();
log(Level.SEVERE, "Error redirecting System output to file <" + logFile.getPath() + ">.");
showDialog("Error redirecting System output to log file.");
}
@@ -1114,6 +1113,11 @@
}
}
+ /**
+ * Redirect <code>System.out</code> and <code>System.err</code> to a file.
+ * @param file The output log file.
+ * @throws FileNotFoundException if the file does not exist.
+ */
private void redirectStdOutAndErrToFile(File file) throws FileNotFoundException {
PrintStream ps = new PrintStream(new FileOutputStream(file.getPath()));
System.setOut(ps);
@@ -1121,9 +1125,9 @@
}
/**
- * Redirect System.out and System.err back to the terminal, e.g. if they
- * were previously sent to a file. This is independent of messages that are
- * sent to the application's log table.
+ * Redirect <code>System.out</code> and <code>System.err</code> back to the terminal,
+ * e.g. if they were previously sent to a file. This is independent of messages that
+ * are sent to the application's log table.
*/
private void logToTerminal() {
System.setOut(sysOut);
@@ -1152,15 +1156,15 @@
eventPanel.setEventRefresh(newEventRefresh);
log("Event refresh set to <" + newEventRefresh + ">.");
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
log(Level.WARNING, "Ignored invalid event refresh setting.");
showDialog("The value " + inputValue + " is not valid for Event Refresh Rate.");
}
}
/**
- * Using a modal dialog, set the maximum number of events to process before
- * an automatic disconnect.
+ * Using a modal dialog, set the maximum number of events to process before an
+ * automatic disconnect.
*/
private void setMaxEvents() {
String inputValue = JOptionPane.showInputDialog("Max Events:", eventPanel.getMaxEvents());
@@ -1178,15 +1182,15 @@
}
log("Max events set to <" + newMaxEvents + ">.");
} catch (Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
log(Level.WARNING, "Ignored invalid max events setting <" + inputValue + ">.");
showDialog("The value " + inputValue + " is not valid for Max Events.");
}
}
/**
- * Set the GUI state to disconnected, which will enable/disable applicable
- * GUI components and menu items.
+ * Set the GUI state to disconnected, which will enable/disable applicable GUI
+ * components and menu items.
*/
private void setDisconnectedGuiState() {
@@ -1216,8 +1220,8 @@
}
/**
- * Set the GUI to connected state, which will enable/disable appropriate
- * components and menu items.
+ * Set the GUI to connected state, which will enable/disable appropriate components
+ * and menu items.
*/
private void setConnectedGuiState() {
@@ -1276,7 +1280,6 @@
/**
* Save a screenshot to an output file.
- *
* @param fileName The name of the output file.
*/
private void takeScreenshot(String fileName) {
@@ -1287,18 +1290,17 @@
BufferedImage image = robot.createScreenCapture(screenRectangle);
ImageIO.write(image, screenshotFormat, new File(fileName));
} catch (AWTException e) {
- e.printStackTrace();
+ e.printStackTrace();
showDialog(e.getMessage());
} catch (IOException e) {
- e.printStackTrace();
+ e.printStackTrace();
showDialog(e.getMessage());
}
}
/**
- * Get the fully qualified class name of the current event builder for
- * converting from EVIO to LCIO.
- *
+ * Get the fully qualified class name of the current event builder for converting from
+ * EVIO to LCIO.
* @return The class name of the event builder.
*/
private String getEventBuilderClassName() {
@@ -1307,7 +1309,6 @@
/**
* Get the type of steering file being used.
- *
* @return The type of the steering file.
*/
private int getSteeringType() {
@@ -1316,7 +1317,6 @@
/**
* Get the current max events setting.
- *
* @return The maximum number of events to process before disconnect.
*/
private int getMaxEvents() {
@@ -1324,8 +1324,8 @@
}
/**
- * Execute a monitoring session. This is executed in a separate thread so as
- * not to block the GUI or other threads during a monitoring session.
+ * Execute a monitoring session. This is executed in a separate thread so as not to
+ * block the GUI or other threads during a monitoring session.
*/
private void session() {
@@ -1353,7 +1353,7 @@
try {
eventProcessingThread.join();
} catch (InterruptedException e) {
- e.printStackTrace();
+ e.printStackTrace();
}
log("Event processor finished with status <" + ConnectionStatus.toString(eventProcessor.getStatus()) + ">.");
endStatus = eventProcessor.getStatus();
@@ -1391,7 +1391,6 @@
/**
* Create the thread that will execute the EtEvent processing chain.
- *
* @return The thread on which event processing will occur.
*/
private void createEventProcessingThread() {
@@ -1402,7 +1401,8 @@
// Add the application's listener for callbacks to the GUI components.
eventProcessor.addListener(this.etListener);
- // Set pause mode from JobPanel, after which it can be toggled using the event buttons.
+ // Set pause mode from JobPanel, after which it can be toggled using the event
+ // buttons.
eventProcessor.pauseMode(this.jobPanel.pauseMode());
// Create a new thread for event processing.
@@ -1421,8 +1421,7 @@
}
/**
- * Connect to the ET system specified in the GUI's connection panel
- * settings.
+ * Connect to the ET system specified in the GUI's connection panel settings.
*/
private void connect() {
@@ -1440,9 +1439,7 @@
}
/**
- * Get the steering parameter, which is either a file path or resource
- * string.
- *
+ * Get the steering parameter, which is either a file path or resource string.
* @return The steering parameter.
*/
private String getSteering() {
@@ -1451,7 +1448,6 @@
/**
* Get the name of the detector for conditions data.
- *
* @return The name of the detector.
*/
private String getDetectorName() {
@@ -1460,7 +1456,6 @@
/**
* Get the connection parameter settings from the connection panel.
- *
* @return The connection parameters.
*/
private ConnectionParameters getConnectionParameters() {
@@ -1469,7 +1464,6 @@
/**
* Get whether a warning dialog will open before disconnect.
- *
* @return True if warning will occur before disconnect; false if no.
*/
private boolean warnOnDisconnect() {
@@ -1478,7 +1472,6 @@
/**
* Get whether errors in event processing will cause automatic disconnect.
- *
* @return True if disconnect on event processing error; false to continue.
*/
private boolean disconnectOnError() {
@@ -1491,7 +1484,6 @@
/**
* Disconnect from the current ET session with a particular status.
- *
* @param status The connection status.
*/
synchronized private void disconnect(int status) {
@@ -1515,7 +1507,7 @@
log(Level.FINE, "Stopping the event processor.");
eventProcessor.stop();
}
-
+
// Set the application status from the caller.
setConnectionStatus(status);
@@ -1532,9 +1524,9 @@
}
/**
- * This is a thread for cleaning up the ET connection. This is executed
- * under a separate thread, because it could potentially block forever.
- * So we need to be able to kill it after waiting for X amount of time.
+ * This is a thread for cleaning up the ET connection. This is executed under a
+ * separate thread, because it could potentially block forever. So we need to be able
+ * to kill it after waiting for X amount of time.
*/
private class EtCleanupThread extends Thread {
@@ -1575,7 +1567,7 @@
// Wait X seconds for cleanup thread to finish.
cleanupThread.join(this.maxCleanupTime);
} catch (InterruptedException e) {
- e.printStackTrace();
+ e.printStackTrace();
}
if (cleanupThread.succeeded()) {
@@ -1601,13 +1593,15 @@
*/
private void setupLCSim() {
- log(Level.INFO, "Setting up LCSim.");
+ log(Level.INFO, "Setting up LCSim.");
- // Clear the static AIDA tree in case plots are hanging around from previous sessions.
+ // Clear the static AIDA tree in case plots are hanging around from previous
+ // sessions.
resetAidaTree();
-
+
// Reset the plots tab.
- this.plotPane.removeAll();
+ plotPane.removeAll();
+ // ((MonitoringAnalysisFactory)MonitoringAnalysisFactory.create()).clearPlotFactories();
// Get steering resource or file as a String parameter.
String steering = getSteering();
@@ -1621,7 +1615,8 @@
}
try {
- // Create job manager and configure based on steering type of resource or file.
+ // Create job manager and configure based on steering type of resource or
+ // file.
jobManager = new JobControlManager();
jobManager.setPerformDryRun(true);
if (steeringType == JobPanel.RESOURCE) {
@@ -1633,15 +1628,16 @@
log(Level.CONFIG, "Setting up steering file <" + steering + ">.");
jobManager.setup(new File(steering));
}
-
+
// Call configure to trigger conditions setup and other initialization.
jobManager.configure();
// Setup the event builder to translate from EVIO to LCIO.
createEventBuilder();
- } // Catch all other setup exceptions and re-throw them as RuntimeExceptions.
- catch (Exception e) {
+ // Catch all other setup exceptions and re-throw them as RuntimeExceptions.
+ } catch (Exception e) {
[truncated at 1000 lines; 91 more skipped]