Author: [log in to unmask]
Date: Thu Apr 16 14:46:25 2015
New Revision: 2722
Log:
Use SteeringType instead of string as object for steering type combo box.
Modified:
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java
java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/JobSettingsPanel.java
Modified: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java
=============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java (original)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/application/AbstractFieldsPanel.java Thu Apr 16 14:46:25 2015
@@ -29,7 +29,7 @@
*/
@SuppressWarnings("serial")
abstract class AbstractFieldsPanel extends JPanel implements PropertyChangeListener, HasConfigurationModel,
- ActionListener, AddActionListener {
+ActionListener, AddActionListener {
/**
* Default button height in pixels.
@@ -176,8 +176,8 @@
* @param values the set of values for the combo box
* @return the JComboBox component
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
- protected final JComboBox addComboBox(final String name, final String[] values) {
+ @SuppressWarnings({"rawtypes", "unchecked"})
+ protected final JComboBox addComboBox(final String name, final Object[] values) {
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
@@ -209,7 +209,7 @@
* @param values the values for the combo box
* @return the <code>JComboBox</code> component
*/
- @SuppressWarnings({ "rawtypes", "unchecked" })
+ @SuppressWarnings({"rawtypes", "unchecked"})
protected final JComboBox addComboBoxMultiline(final String name, final String[] values) {
GridBagConstraints c = new GridBagConstraints();
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 Thu Apr 16 14:46:25 2015
@@ -102,7 +102,7 @@
} else if (property.equals(ConfigurationModel.LOG_TO_FILE_PROPERTY)) {
JobSettingsPanel.this.logToFileCheckbox.setSelected((Boolean) value);
} else if (property.equals(ConfigurationModel.STEERING_TYPE_PROPERTY)) {
- JobSettingsPanel.this.steeringTypeComboBox.setSelectedIndex(((SteeringType) value).ordinal());
+ JobSettingsPanel.this.steeringTypeComboBox.setSelectedItem(value);
} else if (property.equals(ConfigurationModel.STEERING_FILE_PROPERTY)) {
if (value != null) {
JobSettingsPanel.this.steeringFileField.setText((String) evt.getNewValue());
@@ -228,7 +228,7 @@
/**
* Combo box for selecting between current file or resource for XML steering.
*/
- private final JComboBox<?> steeringTypeComboBox;
+ private final JComboBox<SteeringType> steeringTypeComboBox;
/**
* Field for setting a user run number for conditions system activation.
@@ -265,8 +265,7 @@
steeringFileButton.setActionCommand(Commands.CHOOSE_STEERING_FILE);
steeringFileButton.addActionListener(this);
- this.steeringTypeComboBox = this.addComboBox("Steering Type", new String[] {SteeringType.RESOURCE.name(),
- SteeringType.FILE.name()});
+ this.steeringTypeComboBox = this.addComboBox("Steering Type", SteeringType.values());
this.steeringTypeComboBox.setActionCommand(Commands.STEERING_TYPE_CHANGED);
this.steeringTypeComboBox.addActionListener(this);
@@ -357,8 +356,8 @@
} 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.valueOf((String) this.steeringTypeComboBox.getSelectedItem()));
+ this.getConfigurationModel()
+ .setSteeringType((SteeringType) this.steeringTypeComboBox.getSelectedItem());
} else if (Commands.STEERING_RESOURCE_CHANGED.equals(command)) {
this.getConfigurationModel().setSteeringResource(
(String) this.steeringResourcesComboBox.getSelectedItem());
|