Print

Print


Author: [log in to unmask]
Date: Fri Apr 17 13:18:28 2015
New Revision: 2740

Log:
Fix enum based property settings which were not being handled correctly.

Modified:
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/ConnectionSettingsPanel.java	Fri Apr 17 13:18:28 2015
@@ -189,7 +189,7 @@
     @Override
     public void actionPerformed(final ActionEvent e) {
         if (Commands.WAIT_MODE_CHANGED.equals(e.getActionCommand())) {
-            this.getConfigurationModel().setWaitMode(Mode.valueOf((String) this.waitModeComboBox.getSelectedItem()));
+            this.getConfigurationModel().setWaitMode(this.waitModeComboBox.getSelectedItem().toString());
         } else if (Commands.BLOCKING_CHANGED.equals(e.getActionCommand())) {
             this.getConfigurationModel().setBlocking(this.blockingCheckBox.isSelected());
         } else if (Commands.VERBOSE_CHANGED.equals(e.getActionCommand())) {

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java	Fri Apr 17 13:18:28 2015
@@ -356,11 +356,10 @@
             } else if (Commands.DISCONNECT_ON_END_RUN_CHANGED.equals(command)) {
                 this.getConfigurationModel().setDisconnectOnEndRun(this.disconnectOnEndRunCheckBox.isSelected());
             } else if (Commands.STEERING_TYPE_CHANGED.equals(command)) {
-                this.getConfigurationModel()
-                .setSteeringType((SteeringType) this.steeringTypeComboBox.getSelectedItem());
+                this.getConfigurationModel().setSteeringType(this.steeringTypeComboBox.getSelectedItem().toString());
             } else if (Commands.STEERING_RESOURCE_CHANGED.equals(command)) {
                 this.getConfigurationModel().setSteeringResource(
-                        (String) this.steeringResourcesComboBox.getSelectedItem());
+                        this.steeringResourcesComboBox.getSelectedItem().toString());
             } else if (Commands.LOG_LEVEL_CHANGED.equals(command)) {
                 this.getConfigurationModel().setLogLevel(Level.parse((String) this.logLevelComboBox.getSelectedItem()));
             } else if (Commands.EVENT_BUILDER_CHANGED.equals(command)) {
@@ -386,7 +385,7 @@
                 this.getConfigurationModel().setConditionsTag((String) this.conditionsTagComboBox.getSelectedItem());
             } else if (Commands.PROCESSING_STAGE_CHANGED.equals(command)) {
                 this.getConfigurationModel().setProcessingStage(
-                        (ProcessingStage) this.processingStageComboBox.getSelectedItem());
+                        this.processingStageComboBox.getSelectedItem().toString());
             }
         } finally {
             this.getConfigurationModel().addPropertyChangeListener(this);
@@ -448,7 +447,7 @@
             try {
                 this.checkSteeringFile(file);
                 this.getConfigurationModel().setSteeringFile(file.getCanonicalPath());
-                this.getConfigurationModel().setSteeringType(SteeringType.FILE);
+                this.getConfigurationModel().setSteeringType(SteeringType.FILE.toString());
             } catch (IOException | JDOMException e) {
                 throw new RuntimeException("Error parsing the selected steering file.", e);
             }

Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java	(original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/model/ConfigurationModel.java	Fri Apr 17 13:18:28 2015
@@ -490,6 +490,11 @@
         return CONFIG_PROPERTIES;
     }
 
+    /**
+     * Get the ET queue size.
+     *
+     * @return the ET queue size
+     */
     public Integer getQueueSize() {
         return this.configuration.getInteger(QUEUE_SIZE_PROPERTY);
     }
@@ -920,9 +925,9 @@
      *
      * @param processingStage the processing stage to execute
      */
-    public void setProcessingStage(final ProcessingStage processingStage) {
+    public void setProcessingStage(final String processingStage) {
         final ProcessingStage oldValue = this.getProcessingStage();
-        this.configuration.set(PROCESSING_STAGE_PROPERTY, processingStage);
+        this.configuration.set(PROCESSING_STAGE_PROPERTY, ProcessingStage.valueOf(processingStage));
         this.firePropertyChange(PROCESSING_STAGE_PROPERTY, oldValue, this.getProcessingStage());
     }
 
@@ -1017,9 +1022,9 @@
      * @param steeringType the steering type
      * @see SteeringType
      */
-    public void setSteeringType(final SteeringType steeringType) {
+    public void setSteeringType(final String steeringType) {
         final SteeringType oldValue = this.getSteeringType();
-        this.configuration.set(STEERING_TYPE_PROPERTY, steeringType.name());
+        this.configuration.set(STEERING_TYPE_PROPERTY, SteeringType.valueOf(steeringType));
         this.firePropertyChange(STEERING_TYPE_PROPERTY, oldValue, this.getSteeringType());
     }
 
@@ -1056,9 +1061,9 @@
      *
      * @param waitMode the ET wait mode
      */
-    public void setWaitMode(final Mode waitMode) {
+    public void setWaitMode(final String waitMode) {
         final Mode oldValue = this.getWaitMode();
-        this.configuration.set(WAIT_MODE_PROPERTY, waitMode.name());
+        this.configuration.set(WAIT_MODE_PROPERTY, Mode.valueOf(waitMode));
         this.firePropertyChange(WAIT_MODE_PROPERTY, oldValue, this.getWaitMode());
     }