Commit in java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui on MAIN
ConnectionPanel.java+1-13719 -> 720
DatePanel.java+34added 720
EventPanel.java-292719 removed
EventPanelUpdater.java-69719 removed
FieldPanel.java+84added 720
JobPanel.java+2-26719 -> 720
JobSettings.java-3719 -> 720
MonitoringApplication.java+64-223719 -> 720
RunPanel.java+120added 720
SettingsFrame.java-37719 removed
+305-663
3 added + 3 removed + 4 modified, total 10 files
Remove tabbed pane on left side and replace with run summary panel.  Additional changes and reorg.

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
ConnectionPanel.java 719 -> 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/ConnectionPanel.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/ConnectionPanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -179,18 +179,6 @@
     }
 
     /**
-     * Save connection parameters to selected output file.
-     */
-    void save() {
-        JFileChooser fc = new JFileChooser();
-        int r = fc.showSaveDialog(ConnectionPanel.this);
-        if (r == JFileChooser.APPROVE_OPTION) {
-            File file = fc.getSelectedFile();
-            writePropertiesFile(file);
-        }
-    }
-
-    /**
      * Load connection parameters from a selected file.
      */
     void load() {
@@ -213,7 +201,7 @@
      * Write connection parameters to a file.
      * @param file The output properties file.
      */
-    private void writePropertiesFile(File file) {
+    void writePropertiesFile(File file) {
         Properties prop = new Properties();
         prop.setProperty("etName", etNameField.getText());
         prop.setProperty("host", hostField.getText());

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
DatePanel.java added at 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/DatePanel.java	                        (rev 0)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/DatePanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -0,0 +1,34 @@
+package org.hps.monitoring.gui;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class DatePanel extends FieldPanel {
+    
+    private SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss");
+    
+    DatePanel(String fieldName, String defaultValue, int size, boolean editable) {
+        super(fieldName, defaultValue, size, editable);
+    }
+    
+    DatePanel(String fieldName, Date defaultValue, SimpleDateFormat format, int size, boolean editable) {
+        super(fieldName, format.format(defaultValue), size, editable);
+    }
+        
+    void setDateFormat(SimpleDateFormat dateFormat) {
+        this.dateFormat = dateFormat;
+    }
+    
+    void setValue(Date date) {
+        setValue(dateFormat.format(date));
+    }
+    
+    Date getDateValue() {
+        try {
+            return dateFormat.parse(getValue());
+        } catch (ParseException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
EventPanel.java removed after 719
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/EventPanel.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/EventPanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -1,292 +0,0 @@
-package org.hps.monitoring.gui;
-
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.swing.JTextField;
-import javax.swing.SwingUtilities;
-
-/**
- * This is the GUI component for displaying event information in real time.
- * @author Jeremy McCormick <[log in to unmask]>
- */
-class EventPanel extends FieldsPanel { 
-
-    private JTextField eventCounterField; // number of events in this job
-    private JTextField elapsedTimeField; // elapsed time between job start
-    private JTextField avgEventRateField; // average event rate in this job
-    private JTextField refreshField; // number of events to wait before updating GUI
-    private JTextField sessionSuppliedField; // number of events supplied in this session; ignored by reset command
-    private JTextField totalSuppliedField; // number of events supplied since the application started
-    /*private JTextField maxEventsField;*/ // maximum number of events to process before disconenct
-    private JTextField runNumberField; // Run number from CODA Pre Start event.
-    private JTextField runStartField; // Start of run date from CODA Pre Start event.
-    private JTextField runEventsField; // Number of events in run.
-    private JTextField runStopField; // End of run date from CODA End Event.
-    
-    private static final int defaultEventRefresh = 1;
-    private int eventRefresh = defaultEventRefresh;
-    private int eventCount;
-    private int sessionSupplied;
-    private int totalSupplied;
-    private boolean updateEvent = true;
-    private long jobStartTime;
-    
-    private final static DecimalFormat rateFormat = new DecimalFormat("#.##");
-    
-    final static SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM-dd-yyyy HH:mm:ss");
- 
-    /**
-     * Class constructor.
-     */
-    EventPanel() {
-        
-        super(new Insets(5, 5, 5, 5), false);
-
-        setLayout(new GridBagLayout());
-
-        elapsedTimeField = addField("Elapsed Time [seconds]", "0", 10);
-        eventCounterField = addField("Events Processed", "0", 10);
-        avgEventRateField = addField("Average Events Per Second", "0", 6);
-        runNumberField = addField("Run Number", "", 8);
-        runStartField = addField("Run Started", "", 22);
-        runStopField = addField("Run Stopped", "", 22);
-        runEventsField = addField("Events in Run", "", 10);
-        sessionSuppliedField = addField("Session Supplied Events", "0", 8);
-        totalSuppliedField = addField("Total Supplied Events", "0", 8);
-        refreshField = addField("Event Refresh", Integer.toString(eventRefresh), 8);
-        //maxEventsField = addField("Max Events", "-1", 8);
-    }
-            
-    /**
-     * Get the event refresh rate.
-     * @return The event refresh rate.
-     */
-    int getEventRefresh() {
-    	return eventRefresh;
-    }
-    
-    /**
-     * Get the max events setting from its GUI component.
-     * @return The max events.
-     */
-    /*
-    int getMaxEvents() {
-        return Integer.parseInt(maxEventsField.getText());
-    }
-    */
-    
-    /**
-     * Set the max events.
-     * @param maxEvents The max events.
-     */
-    /*
-    void setMaxEvents(final int maxEvents) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                maxEventsField.setText(Integer.toString(maxEvents));
-            }
-        });
-    }
-    */
-    
-    /**
-     * Set the run number.
-     * @param runNumber The run number.
-     */
-    void setRunNumber(final int runNumber) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                runNumberField.setText(Integer.toString(runNumber));
-            }
-        });
-    }
-    
-    void setJobStartTime(long jobStartTime) {
-        this.jobStartTime = jobStartTime;
-    }
-    
-    /**
-     * Set the number of events in the run.
-     * @param eventCount The number of events in the run.
-     */
-    void setRunEventCount(final int eventCount) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                runEventsField.setText(Integer.toString(eventCount));
-            }
-        });
-    }
-    
-    /**
-     * Set the run start time in milliseconds since the epoch (Unix time).
-     * @param millis The run start time.
-     */
-    void setRunStartTime(final long millis) {
-        final Date d = new Date(millis);
-        SwingUtilities.invokeLater(new Runnable() {
-           public void run() {
-               runStartField.setText(dateFormat.format(d));
-           }
-        });
-    }
-    
-    /**
-     * Set the run end time in milliseconds.
-     * @param millis The run end time.
-     */
-    void setRunEndTime(final long millis) {
-        final Date d = new Date(millis);
-        SwingUtilities.invokeLater(new Runnable() {
-           public void run() {
-               runStopField.setText(dateFormat.format(d));
-           }
-        });
-    }
-    
-    /**
-     * Check if the panel should be updated for this event.
-     */
-    private void checkUpdateEvent() {
-        updateEvent = ((eventCount % getEventRefresh()) == 0);
-    }
-    
-    /**
-     * At end of job, final event totals are pushed to the GUI. 
-     */
-    void endJob() {
-        incrementEventCounts();
-    }
-    
-    /**
-     * Update the event counters.
-     */
-    void updateEventCount() {
-        ++eventCount;
-        ++sessionSupplied;
-        ++totalSupplied;
-        checkUpdateEvent();
-        if (updateEvent) {
-            incrementEventCounts();
-        }
-    }
-    
-    /**
-     * Increment the event counts in the GUI.  This happens when the event
-     * is flagged for updating.
-     */
-    private void incrementEventCounts() {
-        Runnable r = new Runnable() {
-            public void run() {
-                eventCounterField.setText(Integer.toString(eventCount));
-                sessionSuppliedField.setText(Integer.toString(sessionSupplied));
-                totalSuppliedField.setText(Integer.toString(totalSupplied));
-            }
-        };
-        SwingUtilities.invokeLater(r);
-    }
-   
-    /**
-     * Update the average event rate.
-     * @param jobStartTime The start time of the job in milliseconds.
-     */
-    void updateAverageEventRate() {
-        if (updateEvent) {
-            if (eventCount > 0) {
-                final double elapsedTime = System.currentTimeMillis() - jobStartTime;
-                if (elapsedTime > 0) {
-                    final double jobSeconds = elapsedTime / 1000;
-                    final double eventsPerSecond = eventCount / jobSeconds;
-                    SwingUtilities.invokeLater(new Runnable() {
-                        public void run() {
-                            avgEventRateField.setText(rateFormat.format(eventsPerSecond));
-                        }
-                    });
-                }
-            }
-        }
-    }
-     
-    /**
-     * Set the elapsed time for the session in milliseconds.
-     * @param time The elapsed time.
-     */
-    void setElapsedTime(final long time) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                elapsedTimeField.setText(Long.toString(time));
-            }
-        });       
-    }
-        
-    /**
-     * Set the event refresh rate.
-     * @param eventRefresh The event refresh rate.
-     */
-    void setEventRefresh(final int eventRefresh) {
-        this.eventRefresh = eventRefresh;
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                refreshField.setText(Integer.toString(eventRefresh));
-            }
-        });                
-    }
-        
-    /**
-     * Reset all the event counts.
-     */
-    synchronized void reset() {
-        resetEventCount();
-        resetAverageEventRate();
-        resetElapsedTime();
-    }
-	    
-    /**
-     * Reset the event counter.
-     */
-    private void resetEventCount() {
-        eventCount = 0;
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                eventCounterField.setText("0");
-            }
-        });  		
-    }
-
-    /**
-     * Reset the elapsed time field.
-     */
-    private void resetElapsedTime() {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                elapsedTimeField.setText("0");
-            }
-        });
-    }   
-
-    /**
-     * Reset the average event rate.
-     */
-    private void resetAverageEventRate() {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                avgEventRateField.setText("0");
-            }
-        });	
-    }
-
-    /**
-     * Reset the session supplied events.
-     */
-    void resetSessionSupplied() {
-        this.sessionSupplied = 0;
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                sessionSuppliedField.setText("0");
-            }
-        });
-    }	
-}
\ No newline at end of file

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
EventPanelUpdater.java removed after 719
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/EventPanelUpdater.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/EventPanelUpdater.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -1,69 +0,0 @@
-package org.hps.monitoring.gui;
-
-import org.hps.monitoring.record.evio.EvioEventProcessor;
-import org.jlab.coda.jevio.EvioEvent;
-
-/**
- * This class is an {@link org.hps.monitoring.record.evio.EvioEventProcessor}
- * that updates the {@link EventPanel} as EVIO events are processed. 
- * 
- * @author Jeremy McCormick <[log in to unmask]>
- */
-public class EventPanelUpdater extends EvioEventProcessor {
-    
-    EventPanel eventPanel;
-    
-    long jobStartTime;
-    
-    EventPanelUpdater(EventPanel eventPanel) {
-        this.eventPanel = eventPanel;
-    }
-    
-    public void startJob() {
-        
-        // Reset event GUI.
-        eventPanel.reset();
-
-        // This is only reset between different jobs.
-        eventPanel.resetSessionSupplied();
-        
-        eventPanel.setJobStartTime(System.currentTimeMillis());
-    }
-    
-    public void processEvent(EvioEvent evioEvent) {
-        eventPanel.updateEventCount();
-        eventPanel.updateAverageEventRate();
-    }
-
-    public void endJob() {
-        // Push final event counts to the GUI.
-        eventPanel.endJob();      
-    }
-
-    public void startRun(EvioEvent event) {
-        
-        // Get start of run data.
-        int[] data = event.getIntData();
-        int seconds = data[0];
-        int runNumber = data[1];        
-        final long millis = ((long) seconds) * 1000;
-        
-        // Update the GUI.
-        eventPanel.setRunNumber(runNumber);
-        eventPanel.setRunStartTime(millis);        
-    }
-
-    public void endRun(EvioEvent event) {
-        
-        // Get end run data.
-        int[] data = event.getIntData();
-        int seconds = data[0];
-        int eventCount = data[2];
-        final long millis = ((long) seconds) * 1000;
-        
-        // Update the GUI.
-        eventPanel.setRunEndTime(millis);
-        eventPanel.setRunEventCount(eventCount);
-    }
-    
-}

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
FieldPanel.java added at 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/FieldPanel.java	                        (rev 0)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/FieldPanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -0,0 +1,84 @@
+package org.hps.monitoring.gui;
+
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.border.Border;
+import javax.swing.border.TitledBorder;
+
+/**
+ * A panel with a label and a text field.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class FieldPanel extends JPanel {
+    
+    String fieldName;
+    String defaultValue;
+    JTextField field;
+    
+    static Border border = BorderFactory.createLoweredBevelBorder();
+    
+    FieldPanel(String fieldName, String defaultValue, int size, boolean editable) {
+
+        this.fieldName = fieldName;
+        this.defaultValue = defaultValue;
+        
+        TitledBorder title = BorderFactory.createTitledBorder(border, fieldName);
+        title.setTitleJustification(TitledBorder.LEFT);
+        
+        field = new JTextField(defaultValue, size);
+        field.setHorizontalAlignment(JTextField.RIGHT);
+        field.setEditable(editable);
+        field.setBorder(title);
+        add(field);
+    }
+    
+    void setValue(final String value) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                field.setText(value);
+            }
+        });
+    }
+    
+    void setValue(final int value) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                field.setText(new Integer(value).toString());
+            }
+        });
+    }
+    
+    void setValue(final double value) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                field.setText(new Double(value).toString());
+            }
+        });
+    }
+    
+    void setValue(final long value) {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                field.setText(new Long(value).toString());
+            }
+        });
+    }
+    
+    String getValue() {
+        return field.getText();
+    }
+    
+    Integer getIntegerValue() {
+        return Integer.parseInt(getValue());
+    }
+    
+    Double getDoubleValue() {
+        return Double.parseDouble(getValue());
+    }
+    
+    Long getLongValue() {
+        return Long.parseLong(getValue());
+    }
+}
\ No newline at end of file

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
JobPanel.java 719 -> 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobPanel.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobPanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -30,7 +30,6 @@
 class JobPanel extends FieldsPanel {
 
     private JTextField detectorNameField;
-    private JCheckBox disconnectWarningCheckBox;    
     private JCheckBox disconnectOnErrorCheckBox;
     private JTextField eventBuilderField;
     private JComboBox<?> steeringTypeComboBox;
@@ -77,7 +76,6 @@
 
         pauseModeCheckBox = addCheckBox("Pause mode", false, true);
         disconnectOnErrorCheckBox = addCheckBox("Disconnect on error", false, true);
-        disconnectWarningCheckBox = addCheckBox("Warn before disconnect", true, true);
         logLevelComboBox = addComboBox("Log Level", this.logLevels);
         logLevelComboBox.setActionCommand(MonitoringCommands.SET_LOG_LEVEL);
         steeringTypeComboBox = addComboBox("Steering Type", steeringTypes);  
@@ -335,16 +333,8 @@
     boolean disconnectOnError() {
         return disconnectOnErrorCheckBox.isSelected();
     }
-    
+        
     /**
-     * Get the warn on disconnect setting.
-     * @return The warn on disconnect setting.
-     */
-    boolean warnOnDisconnect() {
-        return disconnectWarningCheckBox.isSelected();
-    }
-    
-    /**
      * Get the log to file setting.
      * @return The log to file setting.
      */
@@ -387,20 +377,8 @@
             }
         });        
     }
-    
+        
     /**
-     * Set whether to warn before a disconnect occurs.
-     * @param b The warn before disconnect setting.
-     */
-    private void setWarnBeforeDisconnect(final boolean b) {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                disconnectWarningCheckBox.setSelected(b);
-            }
-        });            
-    }
-    
-    /**
      * Set the steering type.
      * @param t The steering type.
      */
@@ -515,7 +493,6 @@
         settings = new JobSettings();
         settings.pauseMode = pauseMode();
         settings.disconnectOnError = disconnectOnError();
-        settings.warnBeforeDisconnect = warnOnDisconnect();
         settings.logLevel = getLogLevel();
         settings.steeringType = getSteeringType();
         settings.steeringFile = getSteeringFile();
@@ -543,7 +520,6 @@
         this.settings = settings;
         enablePauseMode(settings.pauseMode);
         setDisconnectOnError(settings.disconnectOnError);
-        setWarnBeforeDisconnect(settings.warnBeforeDisconnect);
         setLogLevel(settings.logLevel);
         setSteeringType(settings.steeringType);
         setSteeringFile(settings.steeringFile);

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
JobSettings.java 719 -> 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobSettings.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobSettings.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -16,7 +16,6 @@
     // Default job settings.
     boolean pauseMode = false;
     boolean disconnectOnError = false;
-    boolean warnBeforeDisconnect = true;
     Level logLevel = Level.ALL;
     int steeringType = 0; // resource = 0; file = 1
     String steeringResource = "org/hps/steering/monitoring/TestRunMonitoring.lcsim";
@@ -41,7 +40,6 @@
         Properties prop = new Properties();
         prop.setProperty("pauseMode", Boolean.toString(pauseMode));
         prop.setProperty("disconnectOnError", Boolean.toString(disconnectOnError));
-        prop.setProperty("warnBeforeDisconnect", Boolean.toString(warnBeforeDisconnect));
         prop.setProperty("logLevel", logLevel.toString());
         prop.setProperty("steeringType", Integer.toString(steeringType));
         prop.setProperty("steeringFile", steeringFile);
@@ -62,7 +60,6 @@
         prop.load(new FileInputStream(file));
         pauseMode = Boolean.parseBoolean(prop.getProperty("pauseMode"));
         disconnectOnError = Boolean.parseBoolean(prop.getProperty("disconnectOnError"));
-        warnBeforeDisconnect = Boolean.parseBoolean(prop.getProperty("warnBeforeDisconnect"));
         logLevel = Level.parse(prop.getProperty("logLevel"));
         steeringType = Integer.parseInt(prop.getProperty("steeringType"));
         steeringFile = prop.getProperty("steeringFile");

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
MonitoringApplication.java 719 -> 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -20,11 +20,11 @@
 import static org.hps.monitoring.gui.MonitoringCommands.SAVE_LOG_TABLE;
 import static org.hps.monitoring.gui.MonitoringCommands.SAVE_PLOTS;
 import static org.hps.monitoring.gui.MonitoringCommands.SCREENSHOT;
-import static org.hps.monitoring.gui.MonitoringCommands.SHOW_SETTINGS;
 import static org.hps.monitoring.gui.MonitoringCommands.SET_EVENT_BUILDER;
 import static org.hps.monitoring.gui.MonitoringCommands.SET_LOG_LEVEL;
 import static org.hps.monitoring.gui.MonitoringCommands.SET_STEERING_FILE;
 import static org.hps.monitoring.gui.MonitoringCommands.SET_STEERING_RESOURCE;
+import static org.hps.monitoring.gui.MonitoringCommands.SHOW_SETTINGS;
 
 import java.awt.AWTException;
 import java.awt.BorderLayout;
@@ -105,15 +105,12 @@
     private JPanel mainPanel;
     private JPanel leftPanel;
     private JPanel rightPanel;
-    private JTabbedPane plotPane;
-    private JTabbedPane tabs;
+    private EventButtonsPanel buttonsPanel;
     private ConnectionStatusPanel connectionStatusPanel;
-    private EventPanel eventPanel;
+    private RunPanel runPanel;
+    private JTabbedPane plotPane;
     private JMenuBar menuBar;
-    private EventButtonsPanel buttonsPanel;
-    
-    // Modal dialog for editing job and connection settings.
-    private SettingsFrame settingsFrame;
+    private SettingsDialog settingsDialog;
 
     // References to menu items that will be enabled/disabled depending on application state.
     private JMenuItem connectItem;
@@ -141,15 +138,9 @@
     // Event processing objects.
     private JobControlManager jobManager;
     private LCSimEventBuilder eventBuilder;
-    private EventProcessingThread eventProcessingThread;
-    
+    private EventProcessingThread eventProcessingThread;    
     private Thread sessionThread;
 
-    // Job timing.
-    private Timer timer;
-    private TimerTask updateTimeTask;
-    private long jobStartTime;
-
     // Logging objects.
     private static Logger logger;
     private Handler logHandler;
@@ -206,7 +197,7 @@
         configFrame();
         
         // Configuration of settings window.
-        settingsFrame = new SettingsFrame();
+        settingsDialog = new SettingsDialog();
         getJobPanel().addActionListener(this);
         
         // Log that the application started successfully.
@@ -239,9 +230,6 @@
 
         // 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));
         leftPanel.setLayout(new GridBagLayout());
 
@@ -258,29 +246,25 @@
         leftPanel.add(buttonsPanel, c);
 
         // Connection status panel.
+        c = new GridBagConstraints();
         c.gridx = 0;
         c.gridy = 1;
         c.anchor = GridBagConstraints.NORTH;
         c.fill = GridBagConstraints.HORIZONTAL;
-        c.weightx = c.weighty = 1.0;
         c.insets = new Insets(10, 0, 5, 0);
         connectionStatusPanel = new ConnectionStatusPanel();
         connectionStatusPanel.setMinimumSize(new Dimension(connectionStatusPanelWidth, connectionStatusPanelHeight));
         leftPanel.add(connectionStatusPanel, c);
 
-        // Contents of the tabs panel.
-        eventPanel = new EventPanel();
-                
-        // Tab panels.
+        // Run status panel.
+        runPanel = new RunPanel();
         c = new GridBagConstraints();
+        c.insets = new Insets(5, 0, 5, 0);
         c.fill = GridBagConstraints.BOTH;
-        c.weightx = c.weighty = 1.0;
         c.gridx = 0;
         c.gridy = 2;
-        tabs = new JTabbedPane();
-        tabs.addTab("Event Monitor", eventPanel);
-        leftPanel.add(tabs, c);
-                
+        leftPanel.add(runPanel, c);
+                        
         // Layout attributes for the entire left panel.
         c = new GridBagConstraints();
         c.gridx = 0;
@@ -341,34 +325,15 @@
         resetConnectionItem = addMenuItem("Reset Connection Settings", KeyEvent.VK_R, RESET_CONNECTION_SETTINGS, true, "Reset connection settings to defaults.", connectionMenu);
         connectionLoadItem = addMenuItem("Load Connection...", KeyEvent.VK_L, LOAD_CONNECTION, true, "Load connection settings from a saved properties file.", connectionMenu);
         addMenuItem("Save Connection...", KeyEvent.VK_S, SAVE_CONNECTION, true, "Save connection settings to a properties file.", connectionMenu);
-        addMenuItem("Exit", KeyEvent.VK_X, EXIT, true, "Exit from the application.", connectionMenu);
-
-        JMenu eventMenu = new JMenu("Event");
-        eventMenu.setMnemonic(KeyEvent.VK_E);
-        menuBar.add(eventMenu);
-
-        /**
-         * 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(EDIT_EVENT_REFRESH);
-        eventRefreshItem.addActionListener(this);
-        eventRefreshItem.setToolTipText("Set the number of events between GUI updates.");
-        eventMenu.add(eventRefreshItem);
-
+        
         JMenu jobMenu = new JMenu("Job");
         jobMenu.setMnemonic(KeyEvent.VK_J);
         menuBar.add(jobMenu);
 
-        saveJobSettingsItem = new JMenuItem("Save Job Settings...");
-        saveJobSettingsItem.setMnemonic(KeyEvent.VK_J);
-        saveJobSettingsItem.setActionCommand(SAVE_JOB_SETTINGS);
-        saveJobSettingsItem.addActionListener(this);
-        saveJobSettingsItem.setToolTipText("Save Job Settings configuration to a properties file.");
-        jobMenu.add(saveJobSettingsItem);
+        addMenuItem("Save Job Settings...", KeyEvent.VK_J, SAVE_JOB_SETTINGS, true, "Save Job Settings configuration to a properties file.", jobMenu);
 
+        // FIXME: Rest of these should be converted to use the addMenuItem() helper method ...
+        
         loadJobSettingsItem = new JMenuItem("Load Job Settings...");
         loadJobSettingsItem.setMnemonic(KeyEvent.VK_L);
         loadJobSettingsItem.setActionCommand(LOAD_JOB_SETTINGS);
@@ -438,7 +403,7 @@
         saveLogItem.addActionListener(this);
         saveLogItem.setToolTipText("Save the log records to a tab delimited text file.");
         logMenu.add(saveLogItem);
-
+        
         addMenuItem("Clear log", KeyEvent.VK_C, CLEAR_LOG_TABLE, true, "Clear the log table of all messages.", logMenu);
     }
 
@@ -450,7 +415,7 @@
      * @param enabled Whether it is enabled.
      * @param tooltip The tooltip text.
      * @param menu The menu to which it should be added.
-     * @return
+     * @return The created menu item.
      */
     private JMenuItem addMenuItem(String label, int mnemonic, String cmd, boolean enabled, String tooltip, JMenu menu) {
         JMenuItem item = new JMenuItem(label);
@@ -546,9 +511,7 @@
 
     /**
      * Action handler method for the app.
-     * 
-     * @param e
-     *            The event to handle.
+     * @param e The event to handle.
      */
     public void actionPerformed(ActionEvent e) {
         String cmd = e.getActionCommand();
@@ -556,8 +519,6 @@
             startSession();
         } else if (DISCONNECT.equals(cmd)) {
             stopSession();
-        } else if (EDIT_EVENT_REFRESH.equals(cmd)) {
-            setEventRefresh();
         } else if (SAVE_PLOTS.equals(cmd)) {
             savePlots();
         } else if (LOG_TO_FILE.equals(cmd)) {
@@ -569,7 +530,7 @@
         } else if (EXIT.equals(cmd)) {
             exit();
         } else if (SAVE_CONNECTION.equals(cmd)) {
-            getConnectionPanel().save();
+            saveConnection();
         } else if (LOAD_CONNECTION.equals(cmd)) {
             getConnectionPanel().load();
         } else if (RESET_CONNECTION_SETTINGS.equals(cmd)) {
@@ -609,7 +570,7 @@
      * Show the settings window.
      */
     private void showSettingsWindow() {
-        settingsFrame.setVisible(true);
+        settingsDialog.setVisible(true);
     }
 
     /**
@@ -654,14 +615,25 @@
             File f = fc.getSelectedFile();
             try {
                 getJobPanel().setJobSettings(new JobSettings(f));
-                log(Level.INFO, "Loaded Job Settings from properties file <" + f.getPath() + ">.");
+                log(Level.INFO, "Loaded Job Settings from properties file <" + f.getPath() + ">");
             } catch (IOException e) {
                 e.printStackTrace();
-                log(Level.SEVERE, "Error loading Job Settings from properties file <" + f.getPath() + ">.");
+                log(Level.SEVERE, "Error loading Job Settings from properties file <" + f.getPath() + ">");
                 showDialog("Error loading Job Settings from properties file.");
             }
         }
     }
+    
+    void saveConnection() {
+        JFileChooser fc = new JFileChooser();
+        fc.setCurrentDirectory(new File("."));
+        int r = fc.showSaveDialog(this);
+        if (r == JFileChooser.APPROVE_OPTION) {
+            File file = fc.getSelectedFile();
+            getConnectionPanel().writePropertiesFile(file);
+            log(Level.INFO, "Saved connection properties to <" + file.getPath() + ">");
+        }
+    }
 
     /**
      * Reset the job settings to the defaults.
@@ -678,11 +650,7 @@
     private void setLogLevel() {
         Level newLevel = getJobPanel().getLogLevel();
         logger.setLevel(newLevel);
-        //if (eventProcessor != null) {
-        //    eventProcessor.setLogLevel(newLevel);
-        //}
-
-        log(Level.INFO, "Log Level was changed to <" + getJobPanel().getLogLevel().toString() + ">.");
+        log(Level.INFO, "Log Level was changed to <" + getJobPanel().getLogLevel().toString() + ">");
     }
 
     /**
@@ -692,7 +660,7 @@
     private void setConnectionStatus(int status) {
         connectionStatus = status;
         connectionStatusPanel.setStatus(status);
-        log(Level.FINE, "Connection status changed to <" + ConnectionStatus.toString(status) + ">.");
+        log(Level.FINE, "Connection status changed to <" + ConnectionStatus.toString(status) + ">");
         logHandler.flush();
     }
 
@@ -737,7 +705,7 @@
             File fileName = fc.getSelectedFile();
             try {
                 AIDA.defaultInstance().saveAs(fileName);
-                logger.log(Level.INFO, "Plots saved to <" + fileName + ">.");
+                logger.log(Level.INFO, "Plots saved to <" + fileName + ">");
             } catch (IOException e) {
                 e.printStackTrace();
             }
@@ -756,10 +724,10 @@
                 (new JobControlManager()).setup(fileName);
                 getJobPanel().setSteeringFile(fileName.getPath());
                 getJobPanel().setSteeringType(getJobPanel().FILE);
-                log("Steering file set to <" + fileName.getPath() + ">.");
+                log("Steering file set to <" + fileName.getPath() + ">");
             } catch (Exception e) {
                 e.printStackTrace();
-                log(Level.SEVERE, "Failed to read steering file <" + fileName.getPath() + ">.");
+                log(Level.SEVERE, "Failed to read steering file <" + fileName.getPath() + ">");
                 showDialog("Failed to read the LCSim XML file.");
             }
         }
@@ -828,10 +796,10 @@
                         }
                     });
 
-                    log("Redirected System output to file <" + logFile.getPath() + ">.");
+                    log("Redirected System output to file <" + logFile.getPath() + ">");
                 } catch (IOException e) {
                     e.printStackTrace();
-                    log(Level.SEVERE, "Error redirecting System output to file <" + logFile.getPath() + ">.");
+                    log(Level.SEVERE, "Error redirecting System output to file <" + logFile.getPath() + ">");
                     showDialog("Error redirecting System output to log file.");
                 }
             }
@@ -870,25 +838,6 @@
     }
 
     /**
-     * Set the event refresh rate using a modal dialog.
-     */
-    private void setEventRefresh() {
-        String inputValue = JOptionPane.showInputDialog("Event Refresh Rate:", eventPanel.getEventRefresh());
-        try {
-            int newEventRefresh = Integer.parseInt(inputValue);
-            if (newEventRefresh < 1) {
-                throw new RuntimeException("Event Refresh must be > 0.");
-            }
-            eventPanel.setEventRefresh(newEventRefresh);
-            log("Event refresh set to <" + newEventRefresh + ">.");
-        } catch (Exception e) {
-            e.printStackTrace();
-            log(Level.WARNING, "Ignored invalid event refresh setting.");
-            showDialog("The value " + inputValue + " is not valid for Event Refresh Rate.");
-        }
-    }
-
-    /**
      * Set the GUI state to disconnected, which will enable/disable applicable GUI components and
      * menu items.
      */
@@ -936,7 +885,6 @@
         resetConnectionItem.setEnabled(false);
         connectionLoadItem.setEnabled(false);
         savePlotsItem.setEnabled(true);
-        //resetDriversItem.setEnabled(true);
         logItem.setEnabled(false);
         terminalItem.setEnabled(false);
         steeringItem.setEnabled(false);
@@ -974,7 +922,7 @@
                 fileName = fileName + "." + screenshotFormat;
             }
             takeScreenshot(fileName);
-            log("Screenshot saved to <" + fileName + ">.");
+            log("Screenshot saved to <" + fileName + ">");
         }
     }
 
@@ -1043,10 +991,7 @@
             // Start thread which will trigger disconnect if event processing thread finishes.
             sessionThread = new SessionThread();
             sessionThread.start();
-            
-            // Start the session timer.
-            startSessionTimer();
-           
+                       
             log(Level.INFO, "Successfully started the monitoring session.");
             
         } catch (Exception e) {
@@ -1103,22 +1048,14 @@
     }
     
     private ConnectionPanel getConnectionPanel() {
-        return settingsFrame.getSettingsPanel().getConnectionPanel();
+        return settingsDialog.getSettingsPanel().getConnectionPanel();
     }
     
     private JobPanel getJobPanel() {
-        return settingsFrame.getSettingsPanel().getJobPanel();
+        return settingsDialog.getSettingsPanel().getJobPanel();
     }
 
     /**
-     * Get whether a warning dialog will open before disconnect.
-     * @return True if warning will occur before disconnect; false if no.
-     */
-    private boolean warnOnDisconnect() {
-        return getJobPanel().warnOnDisconnect();
-    }
-
-    /**
      * Get whether errors in event processing will cause automatic disconnect.
      * @return True if disconnect on event processing error; false to continue.
      */
@@ -1155,36 +1092,6 @@
     }
 
     /**
-     * This is a thread for cleaning up the ET connection. 
-     * It 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 {
-
-        boolean succeeded;
-
-        EtCleanupThread() {
-            super("ET Cleanup Thread");
-        }
-
-        public void run() {
-            connection.cleanup();
-            connection = null;
-            succeeded = true;
-        }
-
-        public boolean succeeded() {
-            return succeeded;
-        }
-
-        public void stopCleanup() {
-            Thread.yield();
-        }
-    }
-    */
-
-    /**
      * Cleanup the ET connection.
      */
     private void cleanupEtConnection() {
@@ -1193,38 +1100,6 @@
             connection.cleanup();
             connection = null;
         }
-        
-        /*
-        if (connection != null) {
-           
-            // Execute the connection cleanup thread.
-            EtCleanupThread cleanupThread = new EtCleanupThread();
-            log(Level.FINE, "Starting EtCleanupThread to disconnect from ET system.");
-            logHandler.flush();
-            cleanupThread.start();
-            try {
-                // Wait X seconds for cleanup thread to finish.
-                cleanupThread.join(this.maxCleanupTime);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-
-            if (cleanupThread.succeeded()) {
-                log(Level.FINE, "EtCleanupThread succeeded in disconnecting from ET system.");
-            } else {
-                //log(Level.SEVERE, "EtCleanupThread failed to disconnect.  Your station <" + this.connection.getEtStation().getName() + "> is zombified!");
-                // Make the cleanup thread yield.
-                cleanupThread.stopCleanup();
-                // Stop the cleanup thread.
-                // FIXME: Should call yield() instead?
-                cleanupThread.stop();
-                // Join to cleanup thread until it dies.                
-                log(Level.FINEST, "EtCleanupThread was killed.");
-                // The ET connection is now unusable so set it to null.
-                this.connection = null;
-            }            
-        }
-        */
     }
 
     /**
@@ -1242,7 +1117,7 @@
         // Check if the LCSim steering file looks valid.
         if (getJobPanel().checkSteering() == false) {
             log(Level.SEVERE, "Steering file <" + steering + "> is not valid.");
-            throw new RuntimeException("Invalid LCSim steering file < " + steering + ">.");
+            throw new RuntimeException("Invalid LCSim steering file < " + steering + ">");
         }
 
         try {
@@ -1250,12 +1125,12 @@
             jobManager = new JobControlManager();
             jobManager.setPerformDryRun(true);
             if (steeringType == getJobPanel().RESOURCE) {
-                log(Level.CONFIG, "Setting up steering resource <" + steering + ">.");
+                log(Level.CONFIG, "Setting up steering resource <" + steering + ">");
                 InputStream is = this.getClass().getClassLoader().getResourceAsStream(steering);
                 jobManager.setup(is);
                 is.close();
             } else if (getSteeringType() == getJobPanel().FILE) {
-                log(Level.CONFIG, "Setting up steering file <" + steering + ">.");
+                log(Level.CONFIG, "Setting up steering file <" + steering + ">");
                 jobManager.setup(new File(steering));
             }
 
@@ -1281,7 +1156,7 @@
         // Setup the EventBuilder class.
         String eventBuilderClassName = getEventBuilderClassName();
 
-        log(Level.CONFIG, "Initializing event builder <" + eventBuilderClassName + ">.");
+        log(Level.CONFIG, "Initializing event builder <" + eventBuilderClassName + ">");
 
         try {
             eventBuilder = (LCSimEventBuilder) Class.forName(eventBuilderClassName).newInstance();
@@ -1292,7 +1167,7 @@
         // Set the detector name on the event builder so it can find conditions data.
         eventBuilder.setDetectorName(getDetectorName());
 
-        log(Level.INFO, "Successfully initialized event builder <" + eventBuilderClassName + ">.");
+        log(Level.INFO, "Successfully initialized event builder <" + eventBuilderClassName + ">");
     }
    
     /**
@@ -1312,46 +1187,16 @@
             // Set status to connected as there is now a live ET connection.
             setConnectionStatus(ConnectionStatus.CONNECTED);
 
-            log(Level.CONFIG, "Created ET connection to <" + connectionParameters.getBufferName() + ">.");
+            log(Level.CONFIG, "Created ET connection to <" + connectionParameters.getBufferName() + ">");
         } else {
             // Some error occurred and the connection is not valid.
             setConnectionStatus(ConnectionStatus.ERROR);
-            log(Level.SEVERE, "Failed to create ET connection to <" + connectionParameters.getBufferName() + ">.");
+            log(Level.SEVERE, "Failed to create ET connection to <" + connectionParameters.getBufferName() + ">");
             throw new RuntimeException("Failed to create ET connection.");
         }
     }
-
-    /**
-     * Start the job timer.
-     */
-    private void startSessionTimer() {
-        timer = new Timer("UpdateTime");
-        jobStartTime = System.currentTimeMillis();
-        
-        updateTimeTask = new TimerTask() {                       
-            public void run() {
-                final long elapsedTime = (System.currentTimeMillis() - jobStartTime) / 1000;
-                eventPanel.setElapsedTime(elapsedTime);
-            }            
-        };        
-        timer.scheduleAtFixedRate(updateTimeTask, 0, 1000);
-        log(Level.FINE, "Job timer started.");
-    }
     
-    private void stopSessionTimer() {
-        updateTimeTask.cancel();
-        timer.purge();
-    }
-
     /**
-     * Update the elapsed time in the GUI.
-     */
-    private void updateTime() {
-        final long elapsedTime = (System.currentTimeMillis() - jobStartTime) / 1000;
-        eventPanel.setElapsedTime(elapsedTime);
-    }
-
-    /**
      * Save the accumulated log messages to a tab-delimited text file selected using a file
      * chooser.
      */
@@ -1377,7 +1222,7 @@
                     log("Saved log to file <" + logFile.getPath() + ">.");
                 } catch (IOException e) {
                     e.printStackTrace();
-                    log(Level.SEVERE, "Failed to save log to file <" + logFile.getPath() + ">.");
+                    log(Level.SEVERE, "Failed to save log to file <" + logFile.getPath() + ">");
                     showDialog("Failed to save log file.");
                 }
             }
@@ -1405,7 +1250,7 @@
      */
     private void nextEvent() {
         if (connected()) {
-            log(Level.FINER, "Notifying event processor to get next events.");
+            log(Level.FINEST, "Notifying event processor to get next events.");
 
             eventProcessing.next();
         } else {
@@ -1429,7 +1274,7 @@
             // Toggle job panel setting.
             getJobPanel().enablePauseMode(false);
 
-            log(Level.FINEST, "Disabled pause mode and will now process in real-time.");
+            log(Level.FINE, "Disabled pause mode and will now process in real-time.");
         }
     }
 
@@ -1445,7 +1290,7 @@
             buttonsPanel.setPauseModeState(true);
             getJobPanel().enablePauseMode(false);
             
-            log(Level.FINER, "Enabled pause mode.");
+            log(Level.FINE, "Enabled pause mode.");
         }
     }
 
@@ -1485,11 +1330,9 @@
         eventProcessing.setEventBuilder(this.eventBuilder);
         eventProcessing.setDetectorName(this.getDetectorName());
         eventProcessing.add(this.jobManager.getDriverExecList());
-        eventProcessing.add(new EventPanelUpdater(eventPanel));
-        
-        // TEST
+        //eventProcessing.add(new EventPanelUpdater(eventPanel));
+        eventProcessing.add(runPanel.new RunPanelUpdater());
         eventProcessing.add(new EtSystemStripCharts());
-        
         eventProcessing.setStopOnEndRun();
         if (!this.disconnectOnError())
             eventProcessing.setContinueOnErrors();
@@ -1513,7 +1356,7 @@
     /**
      * End the current job.
      */
-    private void endJob() {
+    private void saveAidaFile() {
         
         // Save final AIDA file if option is selected.
         if (getJobPanel().isAidaAutoSaveEnabled()) {
@@ -1539,14 +1382,12 @@
         // the session thread.
         killEventProcessing();
 
-        // Perform various end of job cleanup.
-        endJob();
+        // Save the AIDA file.
+        // FIXME: Should this be done with the AidaSaveDriver instead?
+        saveAidaFile();
 
         // Disconnect from the ET server.
         disconnect();
-
-        // Stop the session timer.
-        stopSessionTimer();
                      
         logger.log(Level.INFO, "Session was stopped.");
     }
@@ -1614,4 +1455,4 @@
             }
         }        
     }
-}
+}
\ No newline at end of file

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
RunPanel.java added at 720
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/RunPanel.java	                        (rev 0)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/RunPanel.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -0,0 +1,120 @@
+package org.hps.monitoring.gui;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.TitledBorder;
+
+import org.hps.monitoring.record.evio.EvioEventProcessor;
+import org.jlab.coda.jevio.EvioEvent;
+
+/**
+ * Dashboard for displaying information about the current run.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class RunPanel extends JPanel {
+
+    FieldPanel runNumberField = new FieldPanel("Run Number", "", 10, false);
+    DatePanel startDateField = new DatePanel("Run Start", "", 20, false); 
+    DatePanel endDateField = new DatePanel("Run End", "", 20, false);
+    FieldPanel lengthField = new FieldPanel("Run Length [sec]", "", 12, false);
+    FieldPanel totalEventsField = new FieldPanel("Total Events in Run", "", 14, false);
+    FieldPanel elapsedTimeField = new FieldPanel("Elapsed Time [sec]", "", 14, false);;
+    FieldPanel eventsReceivedField = new FieldPanel("Events Received", "", 14, false);
+    FieldPanel dataReceivedField = new FieldPanel("Data Received [bytes]", "", 14, false);
+          
+    RunPanel() {
+        setLayout(new FlowLayout(FlowLayout.LEFT));
+        TitledBorder titledBorder = BorderFactory.createTitledBorder(
+                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Run Summary");
+        setBorder(titledBorder);
+        add(runNumberField);
+        add(startDateField);
+        add(endDateField);
+        add(lengthField);
+        add(totalEventsField);
+        add(elapsedTimeField);
+        add(eventsReceivedField);
+        add(dataReceivedField);
+        this.setMinimumSize(new Dimension(0, 190));
+    }
+    
+    /**
+     * An <tt>EvioEventProcessor</tt> for updating the <tt>RunPanel</tt>
+     * by processing EVIO events.
+     */
+    class RunPanelUpdater extends EvioEventProcessor {
+    
+        long startMillis;
+        long endMillis;
+        int eventsReceived;
+        long totalBytes;
+        Timer timer;        
+        long jobStartMillis;
+        
+        public void startJob() {
+            eventsReceived = 0;
+            runNumberField.setValue("");
+            startDateField.setValue("");
+            endDateField.setValue("");
+            lengthField.setValue("");
+            totalEventsField.setValue("0");
+            
+            timer = new Timer("UpdateTime");
+            jobStartMillis = System.currentTimeMillis();   
+            TimerTask updateTimeTask = new TimerTask() {                       
+                public void run() {
+                    final long elapsedTime = (System.currentTimeMillis() - jobStartMillis) / 1000;
+                    elapsedTimeField.setValue(elapsedTime);
+                }            
+            };        
+            timer.scheduleAtFixedRate(updateTimeTask, 0, 1000);            
+        }
+        
+        public void processEvent(EvioEvent event) {
+            ++eventsReceived;
+            totalBytes += (long)event.getTotalBytes();
+            eventsReceivedField.setValue(eventsReceived);
+            dataReceivedField.setValue(totalBytes);
+        }
+        
+        public void startRun(EvioEvent event) {
+   
+            // Get start of run data.
+            int[] data = event.getIntData();
+            int seconds = data[0];
+            int runNumber = data[1];        
+            startMillis = ((long) seconds) * 1000;
+            
+            // Update the GUI.
+            runNumberField.setValue(runNumber);
+            startDateField.setValue(new Date(startMillis));
+        }
+
+        public void endRun(EvioEvent event) {
+
+            // Get end run data.
+            int[] data = event.getIntData();
+            int seconds = data[0];
+            int eventCount = data[2];
+            endMillis = ((long) seconds) * 1000;
+            long elapsedMillis = endMillis - startMillis;
+            long elapsedSeconds = (long)((double)elapsedMillis / 1000.);
+            
+            // Update the GUI.
+            endDateField.setValue(new Date(endMillis));
+            totalEventsField.setValue(eventCount);
+            lengthField.setValue(elapsedSeconds);
+        }
+        
+        public void endJob() {
+            timer.cancel();
+        }
+    }
+}
\ No newline at end of file

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
SettingsFrame.java removed after 719
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/SettingsFrame.java	2014-06-18 18:57:40 UTC (rev 719)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/SettingsFrame.java	2014-06-18 18:58:31 UTC (rev 720)
@@ -1,37 +0,0 @@
-package org.hps.monitoring.gui;
-
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JDialog;
-
-/**
- * The modal dialog for entering settings.
- * @author Jeremy McCormick <[log in to unmask]>
- */
-public class SettingsFrame extends JDialog {
-    
-    final SettingsPanel settingsPanel = new SettingsPanel(this);
-
-    SettingsFrame() {
-
-        setTitle("Settings");
-        setContentPane(settingsPanel);
-        setResizable(false);
-        setDefaultCloseOperation(HIDE_ON_CLOSE);
-        setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-        setModalityType(ModalityType.APPLICATION_MODAL);
-        pack();
-        
-        addWindowListener(new WindowAdapter() {
-            public void windowClosing(WindowEvent e) {
-                settingsPanel.revert();
-                setVisible(false);
-            }
-        });
-    }
-    
-    SettingsPanel getSettingsPanel() {
-        return settingsPanel;
-    }
-}
SVNspam 0.1