diff --git a/plugins/HoloScan.form b/plugins/HoloScan.form
index 217c4fc5..b7c0c70d 100644
--- a/plugins/HoloScan.form
+++ b/plugins/HoloScan.form
@@ -255,7 +255,7 @@
-
+
@@ -293,7 +293,7 @@
-
+
diff --git a/plugins/HoloScan.java b/plugins/HoloScan.java
index 78939667..3e82d3de 100644
--- a/plugins/HoloScan.java
+++ b/plugins/HoloScan.java
@@ -38,10 +38,20 @@ public class HoloScan extends Panel {
Motor theta = (Motor) getDevice("ManipulatorTheta");
motorPanelPhi.setDevice(phi);
motorPanelTheta.setDevice(theta);
- spinnerFromPhi.setModel(new SpinnerNumberModel(phi.getMinValue(), phi.getMinValue(), phi.getMaxValue(), 1.0));
- spinnerToPhi.setModel(new SpinnerNumberModel(phi.getMaxValue(), phi.getMinValue(), phi.getMaxValue(), 1.0));
- spinnerFromTheta.setModel(new SpinnerNumberModel(theta.getMinValue(), theta.getMinValue(), theta.getMaxValue(), 1.0));
- spinnerToTheta.setModel(new SpinnerNumberModel(theta.getMaxValue(), theta.getMinValue(), theta.getMaxValue(), 1.0));
+ try{
+ spinnerFromPhi.setModel(new SpinnerNumberModel(Math.max(phi.getMinValue(),(Double)spinnerFromPhi.getValue()), phi.getMinValue(), phi.getMaxValue(), 1.0));
+ spinnerToPhi.setModel(new SpinnerNumberModel(Math.min(phi.getMaxValue(),(Double)spinnerToPhi.getValue()), phi.getMinValue(), phi.getMaxValue(), 1.0));
+ } catch (Exception ex){
+ spinnerFromPhi.setModel(new SpinnerNumberModel(phi.getMinValue(), phi.getMinValue(), phi.getMaxValue(), 1.0));
+ spinnerToPhi.setModel(new SpinnerNumberModel(phi.getMaxValue(), phi.getMinValue(), phi.getMaxValue(), 1.0));
+ }
+ try{
+ spinnerFromTheta.setModel(new SpinnerNumberModel(Math.max(theta.getMinValue(),(Double)spinnerFromTheta.getValue()), theta.getMinValue(), theta.getMaxValue(), 1.0));
+ spinnerToTheta.setModel(new SpinnerNumberModel(Math.min(theta.getMaxValue(),(Double)spinnerFromTheta.getValue()), theta.getMinValue(), theta.getMaxValue(), 1.0));
+ } catch (Exception ex){
+ spinnerFromTheta.setModel(new SpinnerNumberModel(theta.getMinValue(), theta.getMinValue(), theta.getMaxValue(), 1.0));
+ spinnerToTheta.setModel(new SpinnerNumberModel(theta.getMaxValue(), theta.getMinValue(), theta.getMaxValue(), 1.0));
+ }
}
@Override
@@ -192,7 +202,7 @@ public class HoloScan extends Panel {
jLabel5.setText("Phi To:");
- spinnerToPhi.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
+ spinnerToPhi.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 10.0d, 1.0d));
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Phi:");
@@ -206,7 +216,7 @@ public class HoloScan extends Panel {
spinnerFromTheta.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
- spinnerToTheta.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
+ spinnerToTheta.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 10.0d, 1.0d));
jLabel11.setText("Phi:");
diff --git a/plugins/ManipulatorScan.java b/plugins/ManipulatorScan.java
index a7dc578e..6a70f6a3 100644
--- a/plugins/ManipulatorScan.java
+++ b/plugins/ManipulatorScan.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
import javax.swing.SpinnerNumberModel;
@@ -25,9 +26,10 @@ public class ManipulatorScan extends Panel {
initComponents();
//Component persistence
- ArrayList persistedComponents = new ArrayList<>();
+ ArrayList persistedComponents = new ArrayList<>();
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JToggleButton.class)));
- persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JSpinner.class)));
+ persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JSpinner.class)));
+ persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JComboBox.class)));
setPersistedComponents(persistedComponents.toArray(new Component[0]));
}
@@ -572,12 +574,19 @@ public class ManipulatorScan extends Panel {
try {
Motor motor = (Motor) getDevice(comboMotor.getSelectedItem().toString());
motorPanel.setDevice(motor);
- spinnerFrom.setModel(new SpinnerNumberModel(motor.getMinValue(), motor.getMinValue(), motor.getMaxValue(), 1.0));
- spinnerTo.setModel(new SpinnerNumberModel(motor.getMaxValue(), motor.getMinValue(), motor.getMaxValue(), 1.0));
- txtSize.setText("Size (" + motor.getUnit() +")");
- //spinnerFrom.setModel(new javax.swing.SpinnerNumberModel(3.0, 0.001, 100.0, 1.0));
- //spinnerTo.setModel(new javax.swing.SpinnerNumberModel(2.0, 0.001, 100.0, 1.0));
+ if (motor!=null){
+ //Try to reload existing values
+ try{
+ spinnerFrom.setModel(new SpinnerNumberModel(Math.max(motor.getMinValue(),(Double)spinnerFrom.getValue()), motor.getMinValue(), motor.getMaxValue(), 1.0));
+ spinnerTo.setModel(new SpinnerNumberModel(Math.min(motor.getMaxValue(),(Double)spinnerTo.getValue()), motor.getMinValue(), motor.getMaxValue(), 1.0));
+ } catch (Exception ex){
+ spinnerFrom.setModel(new SpinnerNumberModel(motor.getMinValue(), motor.getMinValue(), motor.getMaxValue(), 1.0));
+ spinnerTo.setModel(new SpinnerNumberModel(motor.getMaxValue(), motor.getMinValue(), motor.getMaxValue(), 1.0));
+ }
+ txtSize.setText("Size (" + motor.getUnit() +")");
+ }
} catch (Exception ex) {
+ ex.printStackTrace();
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_comboMotorActionPerformed
diff --git a/plugins/XPSSpectrum.java b/plugins/XPSSpectrum.java
index 0e2df6b6..d6171b7a 100644
--- a/plugins/XPSSpectrum.java
+++ b/plugins/XPSSpectrum.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
@@ -73,7 +74,8 @@ public class XPSSpectrum extends Panel {
//Component persistence
ArrayList persistedComponents = new ArrayList<>();
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JToggleButton.class)));
- persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, ValueSelection.class)));
+ persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, ValueSelection.class)));
+ persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JComboBox.class)));
setPersistedComponents(persistedComponents.toArray(new Component[0]));
}