Commit in java/trunk/monitoring-app/src/main on MAIN
java/org/hps/monitoring/gui/Commands.java+1922 -> 923
                           /JobSettingsPanel.java+65-61922 -> 923
                           /MonitoringApplication.java+4-2922 -> 923
java/org/hps/monitoring/gui/model/AbstractModel.java+1-1922 -> 923
                                 /ConfigurationModel.java+13-1922 -> 923
                                 /HasConfigurationModel.java+1922 -> 923
resources/org/hps/monitoring/config/default_config.prop+2-1922 -> 923
+87-66
7 modified files
Resolve HPSJAVA-169 by adding job setting option for disconnecting when end run events are received.  Other types of exceptions may still cause disconnects at the end of the run such as EOF etc.

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
Commands.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/Commands.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/Commands.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -7,6 +7,7 @@
 final class Commands {
            
     static final String DISCONNECT_ON_ERROR_CHANGED = "disconnectOnErrorChanged";
+    static final String DISCONNECT_ON_END_RUN_CHANGED = "disconnectOnEndRunChanged";
     static final String STEERING_TYPE_CHANGED = "steeringTypeChanged";
     static final String STEERING_RESOURCE_CHANGED = "steeringResourceChanged";
     static final String LOG_TO_FILE_CHANGED = "logToFileChanged";

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
JobSettingsPanel.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobSettingsPanel.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/JobSettingsPanel.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -37,17 +37,16 @@
  * This is the GUI panel for setting job parameters.  It is connected to the global configuration via 
  * a {@link org.hps.monitoring.model.ConfigurationModel} object.
  */
-// TODO: Add validity checks for event builder, lcsim steering files, etc. when edited and revert to old
-//       values if invalid.
+// TODO: Add validity checks for event builder, lcsim steering files, etc. 
+//       and revert to old values if new values are invalid.
 //       http://docs.oracle.com/javase/7/docs/api/javax/swing/JFormattedTextField.html
-// TODO: Remove default values in components.  These should all come from the default configuration.
-// TODO: Double check that all settings to and from the configuration are working properly.
 class JobSettingsPanel extends AbstractFieldsPanel {
 
     private JTextField aidaSaveFileNameField;
     private JCheckBox aidaAutoSaveCheckbox;
     private JTextField detectorNameField;
     private JCheckBox disconnectOnErrorCheckBox;
+    private JCheckBox disconnectOnEndRunCheckBox;
     private JTextField eventBuilderField;
     private JTextField logFileNameField;
     private JComboBox<?> logLevelComboBox;
@@ -62,7 +61,7 @@
     // FIXME: This should be in the default global config file rather than hard-coded here.
     static final String DEFAULT_EVENT_BUILDER_CLASS_NAME = "org.hps.evio.LCSimTestRunEventBuilder";
             
-    // This will connect this GUI component to the underlying global configuration.
+    // This will connect the GUI component to the underlying global configuration model.
     ConfigurationModel configurationModel;
                 
     // The available LogLevel settings as an array of strings.     
@@ -90,6 +89,10 @@
         disconnectOnErrorCheckBox.setActionCommand(DISCONNECT_ON_ERROR_CHANGED);
         disconnectOnErrorCheckBox.addActionListener(this);
         
+        disconnectOnEndRunCheckBox = addCheckBox("Disconnect on end run", false, true);
+        disconnectOnEndRunCheckBox.setActionCommand(DISCONNECT_ON_END_RUN_CHANGED);
+        disconnectOnEndRunCheckBox.addActionListener(this);
+        
         logLevelComboBox = addComboBox("Log Level", LOG_LEVELS);               
         logLevelComboBox.setActionCommand(Commands.LOG_LEVEL_CHANGED);
         logLevelComboBox.addActionListener(this);
@@ -227,55 +230,8 @@
             throw new IOException("Not an LCSim XML file.");
         }
     }
-         
+                                              
     /**
-     * Setup the event builder from the field setting.
-     * @return True if builder is setup successfully; false if not.
-     */
-    // FIXME: This method should throw an exception if an error occurs.
-    /*
-    void editEventBuilder() {
-        String eventBuilderClassName = eventBuilderField.getText();
-        boolean okay = true;
-        try {
-            // Test that the event builder can be created without throwing any exceptions.
-            Class<?> eventBuilderClass = Class.forName(eventBuilderClassName);
-            eventBuilderClass.newInstance();
-        } catch (Exception e) {
-            throw new RuntimeException("Error setting up event builder.", e);
-        }        
-        catch (ClassNotFoundException e) {
-            JOptionPane.showMessageDialog(this, "The event builder class does not exist.");
-            okay = false;
-        } 
-        catch (InstantiationException e) {
-            JOptionPane.showMessageDialog(this, "Failed to instantiate instance of event builder class.");
-            okay = false;
-        } 
-        catch (IllegalAccessException e) {
-            JOptionPane.showMessageDialog(this, "Couldn't access event builder class.");
-            okay = false;
-        }
-        
-        if (!okay)
-            resetEventBuilder();
-    }    
-
-    /**
-     * Reset the event builder to the default.
-     */
-    /*
-    // FIXME: Handle this with property change listener and use old value if new one is invalid.    
-    private void resetEventBuilder() {
-        SwingUtilities.invokeLater(new Runnable() {
-            public void run() {
-                eventBuilderField.setText(DEFAULT_EVENT_BUILDER_CLASS_NAME);
-            }
-        });
-    }
-    */
-                                     
-    /**
      * Get the files with extension "lcsim" from all loaded jar files.
      * @return A list of embedded steering file resources.
      */
@@ -315,6 +271,8 @@
             this.chooseSteeringFile();
         } else if (DISCONNECT_ON_ERROR_CHANGED.equals(e.getActionCommand())) {
             configurationModel.setDisconnectOnError(disconnectOnErrorCheckBox.isSelected());
+        } else if (DISCONNECT_ON_END_RUN_CHANGED.equals(e.getActionCommand())) { 
+            configurationModel.setDisconnectOnEndRun(disconnectOnEndRunCheckBox.isSelected());
         } else if (STEERING_TYPE_CHANGED.equals(e.getActionCommand())) {
             configurationModel.setSteeringType(SteeringType.valueOf((String) steeringTypeComboBox.getSelectedItem())); 
         } else if (STEERING_RESOURCE_CHANGED.equals(e.getActionCommand())) {
@@ -351,7 +309,7 @@
             configurationModel.setLogFileName(logFileNameField.getText());
         } else if (source == aidaSaveFileNameField) {
             configurationModel.setAidaFileName(aidaSaveFileNameField.getText());
-        } /* TODO */ else if (source == aidaAutoSaveCheckbox) {
+        } else if (source == aidaAutoSaveCheckbox) {
             configurationModel.setAidaAutoSave(aidaAutoSaveCheckbox.isSelected());
         }
     }
@@ -365,15 +323,10 @@
         @Override
         public void propertyChange(PropertyChangeEvent evt) {
             
+            // FIXME: Anyway to make sure this is not needed?
             if (evt.getPropertyName().equals("ancestor"))
                 return;
-            
-            //System.out.println("JobSettingsChangeListener.propertyChange");
-            //System.out.println("  prop name: " + evt.getPropertyName());
-            //System.out.println("  new val: " + evt.getNewValue());
-            //System.out.println("  old val: " + evt.getOldValue());
-            //System.out.println("  src: " + evt.getSource().getClass().getCanonicalName());
-                        
+                                              
             Object value = evt.getNewValue();
             
             if (evt.getPropertyName().equals(DETECTOR_NAME_PROPERTY)) {
@@ -384,6 +337,8 @@
                 aidaSaveFileNameField.setText((String) value);
             } if (evt.getPropertyName().equals(DISCONNECT_ON_ERROR_PROPERTY)) {
                 disconnectOnErrorCheckBox.setSelected((Boolean) value);
+            } if (evt.getPropertyName().equals(DISCONNECT_ON_END_RUN_PROPERTY)) {
+                disconnectOnEndRunCheckBox.setSelected((Boolean) value);
             } if (evt.getPropertyName().equals(EVENT_BUILDER_PROPERTY)) {
                 eventBuilderField.setText((String) value);                
             } if (evt.getPropertyName().equals(LOG_FILE_NAME_PROPERTY)) {
@@ -401,4 +356,53 @@
             }                                          
         }
     }   
+    
+    /**
+     * Setup the event builder from the field setting.
+     * @return True if builder is setup successfully; false if not.
+     */
+    // FIXME: This method should throw an exception if an error occurs.
+    /*
+    void editEventBuilder() {
+        String eventBuilderClassName = eventBuilderField.getText();
+        boolean okay = true;
+        try {
+            // Test that the event builder can be created without throwing any exceptions.
+            Class<?> eventBuilderClass = Class.forName(eventBuilderClassName);
+            eventBuilderClass.newInstance();
+        } catch (Exception e) {
+            throw new RuntimeException("Error setting up event builder.", e);
+        }        
+        catch (ClassNotFoundException e) {
+            JOptionPane.showMessageDialog(this, "The event builder class does not exist.");
+            okay = false;
+        } 
+        catch (InstantiationException e) {
+            JOptionPane.showMessageDialog(this, "Failed to instantiate instance of event builder class.");
+            okay = false;
+        } 
+        catch (IllegalAccessException e) {
+            JOptionPane.showMessageDialog(this, "Couldn't access event builder class.");
+            okay = false;
+        }
+        
+        if (!okay)
+            resetEventBuilder();
+    }    
+
+    /**
+     * Reset the event builder to the default.
+     */
+    /*
+    // FIXME: Handle this with property change listener and use old value if new one is invalid.    
+    private void resetEventBuilder() {
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                eventBuilderField.setText(DEFAULT_EVENT_BUILDER_CLASS_NAME);
+            }
+        });
+    }
+    */
+
+    
 }
\ No newline at end of file

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui
MonitoringApplication.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/MonitoringApplication.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -1161,13 +1161,15 @@
         
         EventProcessingConfiguration configuration = new EventProcessingConfiguration();
         
-        configuration.setStopOnEndRun(true);
+        configuration.setStopOnEndRun(configurationModel.getDisconnectOnEndRun());        
+        // FIXME: This doesn't work properly in the event processing chain right now so hard code to true
+        //        until that is fixed.  (Need to talk with Dima about it.)
+        //configurationModel.getDisconnectOnError();
         configuration.setStopOnErrors(true);
          
         configuration.setDataSourceType(configurationModel.getDataSourceType());
         configuration.setEtConnection(connection);        
         configuration.setFilePath(configurationModel.getDataSourcePath());
-        System.out.println("dataSourcePath: " + configurationModel.getDataSourcePath());
         configuration.setLCSimEventBuild(eventBuilder);
         configuration.setDetectorName(configurationModel.getDetectorName());                
                

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model
AbstractModel.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/AbstractModel.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/AbstractModel.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -51,7 +51,7 @@
                 if (value != null) {
                     firePropertyChange(property, value, value);                    
                     for (PropertyChangeListener listener : propertyChangeSupport.getPropertyChangeListeners()) {
-                        // FIXME: For some reason calling the propertyChangeSupport methods directly here doesn't work!!!                        
+                        // FIXME: For some reason calling the propertyChangeSupport methods directly here doesn't work!!!
                         listener.propertyChange(new PropertyChangeEvent(this, property, value, value));
                     }
                 }

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model
ConfigurationModel.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/ConfigurationModel.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/ConfigurationModel.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -24,6 +24,7 @@
     public static final String AIDA_FILE_NAME_PROPERTY = "AidaFileName";   
     public static final String DETECTOR_NAME_PROPERTY = "DetectorName";
     public static final String DISCONNECT_ON_ERROR_PROPERTY = "DisconnectOnError";
+    public static final String DISCONNECT_ON_END_RUN_PROPERTY = "DisconnectOnEndRun";    
     public static final String EVENT_BUILDER_PROPERTY = "EventBuilderClassName";
     public static final String LOG_FILE_NAME_PROPERTY = "LogFileName";
     public static final String LOG_LEVEL_PROPERTY = "LogLevel";
@@ -57,6 +58,7 @@
             AIDA_FILE_NAME_PROPERTY,
             DETECTOR_NAME_PROPERTY,
             DISCONNECT_ON_ERROR_PROPERTY,
+            DISCONNECT_ON_END_RUN_PROPERTY,
             EVENT_BUILDER_PROPERTY,
             LOG_FILE_NAME_PROPERTY,
             LOG_LEVEL_PROPERTY,
@@ -210,7 +212,17 @@
         boolean oldValue = getDisconnectOnError();
         config.set(DISCONNECT_ON_ERROR_PROPERTY, disconnectOnError);
         firePropertyChange(DISCONNECT_ON_ERROR_PROPERTY, oldValue, getDisconnectOnError());
-    }        
+    }     
+    
+    public boolean getDisconnectOnEndRun() {
+        return config.getBoolean(DISCONNECT_ON_END_RUN_PROPERTY);
+    }
+    
+    public void setDisconnectOnEndRun(boolean disconnectOnEndRun) {
+        boolean oldValue = getDisconnectOnEndRun();
+        config.set(DISCONNECT_ON_END_RUN_PROPERTY, disconnectOnEndRun);
+        firePropertyChange(DISCONNECT_ON_END_RUN_PROPERTY, oldValue, getDisconnectOnEndRun());
+    }
           
     public DataSourceType getDataSourceType() {
         return DataSourceType.valueOf(config.get(DATA_SOURCE_TYPE_PROPERTY));

java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model
HasConfigurationModel.java 922 -> 923
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/HasConfigurationModel.java	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/gui/model/HasConfigurationModel.java	2014-08-28 23:25:26 UTC (rev 923)
@@ -4,6 +4,7 @@
  * Mixin interface for classes that have an associated {@link ConfigurationModel}.
  */
 public interface HasConfigurationModel {    
+    
     /**
      * Set the ConfigurationModel of the object.
      * @param configurationModel The ConfigurationModel.

java/trunk/monitoring-app/src/main/resources/org/hps/monitoring/config
default_config.prop 922 -> 923
--- java/trunk/monitoring-app/src/main/resources/org/hps/monitoring/config/default_config.prop	2014-08-28 21:00:37 UTC (rev 922)
+++ java/trunk/monitoring-app/src/main/resources/org/hps/monitoring/config/default_config.prop	2014-08-28 23:25:26 UTC (rev 923)
@@ -5,7 +5,8 @@
 AutoSaveAida=true
 AidaFileName=monitoringPlots.aida
 DetectorName=HPS-TestRun-v5
-DisconnectOnError=true
+DisconnectOnError=false
+DisconnectOnEndRun=true
 EventBuilderClassName=org.hps.evio.LCSimTestRunEventBuilder
 #LogFileName=
 LogLevel=ALL
SVNspam 0.1