Closedown
This commit is contained in:
@@ -15,6 +15,7 @@ import ch.psi.utils.Serializer;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.pshell.swing.ValueSelection;
|
||||
import ch.psi.pshell.swing.ValueSelection.ValueSelectionListener;
|
||||
import java.awt.Component;
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
@@ -76,6 +77,34 @@ public class XPSSpectrum extends Panel {
|
||||
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, ValueSelection.class)));
|
||||
persistedComponents.addAll(Arrays.asList(SwingUtils.getComponentsByType(this, JComboBox.class)));
|
||||
setPersistedComponents(persistedComponents.toArray(new Component[0]));
|
||||
|
||||
ValueSelectionListener listener = new ValueSelectionListener() {
|
||||
@Override
|
||||
public void onValueChanged(ValueSelection origin, double value, boolean editing) {
|
||||
try{
|
||||
if (editing){
|
||||
scienta = (Scienta) getDevice("Scienta");
|
||||
if (origin == valueLow){
|
||||
scienta.getLowEnergy().write(value);
|
||||
} else if (origin == valueHigh){
|
||||
scienta.getHighEnergy().write(value);
|
||||
} else if (origin == valueTime){
|
||||
scienta.getStepTime().write(value);
|
||||
} else if (origin == valueSize){
|
||||
scienta.getStepSize().write(value);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex){
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
valueLow.addListener(listener);
|
||||
valueHigh.addListener(listener);
|
||||
valueTime.addListener(listener);
|
||||
valueSize.addListener(listener);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,8 +113,10 @@ public class XPSSpectrum extends Panel {
|
||||
scienta.getTotalChannels().addListener(progressListener);
|
||||
scienta.getCurrentChannel().addListener(progressListener);
|
||||
dvpAcqTime.setDevice(scienta.getAcquisitionTime());
|
||||
startTimer(500, 100);
|
||||
startTimer(500, 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
@@ -300,6 +331,11 @@ public class XPSSpectrum extends Panel {
|
||||
comboPass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "5", "10", "20", "50", "100", "200" }));
|
||||
comboPass.setSelectedIndex(4);
|
||||
comboPass.setToolTipText("");
|
||||
comboPass.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
comboPassActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
valueSize.setDecimals(3);
|
||||
valueSize.setMaxValue(1000.0);
|
||||
@@ -677,6 +713,18 @@ public class XPSSpectrum extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_buttonScientaSetupActionPerformed
|
||||
|
||||
private void comboPassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboPassActionPerformed
|
||||
try {
|
||||
scienta = (Scienta) getDevice("Scienta");
|
||||
int energy = Integer.valueOf(comboPass.getSelectedItem().toString());
|
||||
if (energy != scienta.getPassEnergy()){
|
||||
scienta.setPassEnergy(energy);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
}
|
||||
}//GEN-LAST:event_comboPassActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btLoad;
|
||||
private javax.swing.JButton btSave;
|
||||
|
||||
Reference in New Issue
Block a user