diff --git a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/NormalizationConfiguration.java b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/NormalizationConfiguration.java
index 55043c32..7d073885 100644
--- a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/NormalizationConfiguration.java
+++ b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/NormalizationConfiguration.java
@@ -20,6 +20,9 @@
* and open the template in the editor.
*/
+/* TODO: cleanup unused code for binding the Y-unit values to the integration
+ * Y-unit dropdown menu
+ */
package cfa.vo.sed.science.stacker;
import java.beans.PropertyChangeListener;
@@ -73,7 +76,14 @@ public void setIntegrate(boolean integrate) {
this.integrate = integrate;
propertyChangeSupport.firePropertyChange(PROP_INTEGRATE, oldIntegrate, integrate);
// disable Y value text box if not normalizing at a point and using "Value" for the statistic.
- setAtPointYTextEnabled(false);
+ if (this.integrate) {
+ setAtPointYTextEnabled(false);
+ if(this.stats.equals("Value")) {
+ setIntegrateYTextEnabled(true);
+ }
+ } else {
+ setIntegrateYTextEnabled(false);
+ }
}
private transient final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
@@ -166,6 +176,12 @@ public void setStats(String stats) {
String oldStats = this.stats;
this.stats = stats;
propertyChangeSupport.firePropertyChange(PROP_STATS, oldStats, stats);
+ // disable Y value text box if not normalizing at a point and using "Value" for the statistic.
+ if (this.stats.equals("Value") && this.integrate) {
+ setIntegrateYTextEnabled(true);
+ } else {
+ setIntegrateYTextEnabled(false);
+ }
}
private Double yValue = 1.0;
@@ -363,6 +379,7 @@ public void setAtPointStats(String atPointStats) {
// disable Y value text box if not normalizing at a point and using "Value" for the statistic.
if (atPointStats.equals("Value") && this.atPoint) {
setAtPointYTextEnabled(true);
+ setIntegrateYTextEnabled(false);
} else {
setAtPointYTextEnabled(false);
}
@@ -415,8 +432,11 @@ public void setAtPoint(boolean atPoint) {
this.atPoint = atPoint;
propertyChangeSupport.firePropertyChange(PROP_ATPOINT, oldAtPoint, atPoint);
// disable Y value text box if not normalizing at a point and using "Value" for the statistic.
- if (this.atPoint && this.atPointStats.equals("Value")) {
- setAtPointYTextEnabled(true);
+ if (this.atPoint) {
+ setIntegrateYTextEnabled(false);
+ if (this.atPointStats.equals("Value")) {
+ setAtPointYTextEnabled(true);
+ }
} else {
setAtPointYTextEnabled(false);
}
@@ -460,6 +480,21 @@ public void setAtPointYTextEnabled(boolean atPointYTextEnabled) {
this.atPointYTextEnabled = atPointYTextEnabled;
propertyChangeSupport.firePropertyChange(PROP_ATPOINTYTEXTENABLED, oldAtPointYTextEnabled, atPointYTextEnabled);
}
+
+ private boolean integrateYTextEnabled = true;
+
+ public static final String PROP_INTEGRATEYTEXTENABLED = "integrateYTextEnabled";
+
+ public boolean isIntegrateYTextEnabled() {
+ return integrateYTextEnabled;
+ }
+
+ // used to disable Y value text box if using Average or Median.
+ public void setIntegrateYTextEnabled(boolean integrateYTextEnabled) {
+ boolean oldIntegrateYTextEnabled = this.integrateYTextEnabled;
+ this.integrateYTextEnabled = integrateYTextEnabled;
+ propertyChangeSupport.firePropertyChange(PROP_ATPOINTYTEXTENABLED, oldIntegrateYTextEnabled, integrateYTextEnabled);
+ }
@Override
public int hashCode() {
diff --git a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.form b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.form
index 3c197099..b183af76 100644
--- a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.form
+++ b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.form
@@ -527,7 +527,7 @@
-
+
diff --git a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.java b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.java
index 772e44c7..3ee62952 100644
--- a/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.java
+++ b/sed-builder/src/main/java/cfa/vo/sed/science/stacker/SedStackerFrame.java
@@ -40,8 +40,6 @@
import cfa.vo.sedlib.common.SedException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
import java.text.NumberFormat;
import java.text.ParsePosition;
@@ -55,7 +53,6 @@
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTable;
-import javax.swing.ListModel;
import javax.swing.SwingUtilities;
import org.apache.commons.lang.StringUtils;
import org.astrogrid.samp.client.SampException;
@@ -91,18 +88,73 @@ public SedStackerFrame(IrisApplication app, IWorkspace ws) {
// normalization comboBoxes. Chooses the list of units available
// based on the normalization type chosen (Value, Median, or Average).
// Also disable Y value text box if using Average or Median.
+
+ //TODO: cleanup unused code.
integrationNormType.addActionListener( new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String normType = (String) integrationNormType.getSelectedItem();
- if (normType.equals("Value")) {
- integrationYUnit.setModel(new DefaultComboBoxModel(new String[] {"erg/s/cm2","Jy-Hz","Watt/m2","erg/s","Watt"}));
+ String [] model;
+
+ if (normType.equals("Value") && getSelectedConfig().getNormConfiguration().isIntegrate()) {
+ model = new String[] {"erg/s/cm2","Jy-Hz","Watt/m2","erg/s","Watt"};
+ integrationValueText.setEnabled(true);
+ } else {
+ model = loadEnum(SPVYUnit.class);
+ integrationValueText.setEnabled(false);
+ }
+
+ try {
+ Object yunit = integrationYUnit.getSelectedItem();
+ integrationYUnit.setModel(new DefaultComboBoxModel(model));
+ integrationYUnit.setSelectedItem(yunit);
+ } catch (IllegalArgumentException ex) {
+ integrationYUnit.setModel(new DefaultComboBoxModel(model));
+ } catch (Exception ex) {
+ integrationYUnit.setModel(new DefaultComboBoxModel(model));
+ }
+
+ }
+ });
+// atPointYType.addActionListener( new ActionListener() {
+// @Override
+// public void actionPerformed(ActionEvent e) {
+//
+// String normType = (String) atPointYType.getSelectedItem();
+// if (normType.equals("Value")) {
+// atPointYText.setEnabled(true);
+// } else {
+// atPointYText.setEnabled(false);
+// }
+//
+// }
+// });
+ jRadioButton1.addActionListener( new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ boolean selected = jRadioButton1.isSelected();
+ if (selected && integrationNormType.getSelectedItem().equals("Value")) {
integrationValueText.setEnabled(true);
} else {
- integrationYUnit.setModel(new DefaultComboBoxModel(loadEnum(SPVYUnit.class)));
integrationValueText.setEnabled(false);
}
+
+ atPointYText.setEnabled(false);
+ }
+ });
+ jRadioButton2.addActionListener( new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ boolean selected = jRadioButton2.isSelected();
+ if (selected && atPointYType.getSelectedItem().equals("Value")) {
+ atPointYText.setEnabled(true);
+ } else {
+ atPointYText.setEnabled(false);
+ }
+ integrationValueText.setEnabled(false); // good - keep!
}
});
@@ -427,7 +479,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${selectedConfig.normConfiguration.YValue}"), integrationValueText, org.jdesktop.beansbinding.BeanProperty.create("text"));
bindingGroup.addBinding(binding);
- binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, jRadioButton1, org.jdesktop.beansbinding.ELProperty.create("${selected}"), integrationValueText, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
+ binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${selectedConfig.normConfiguration.integrateYTextEnabled}"), integrationValueText, org.jdesktop.beansbinding.BeanProperty.create("enabled"));
bindingGroup.addBinding(binding);
integrationNormType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Value", "Average", "Median" }));