Closedown

This commit is contained in:
x03daop
2016-07-28 14:33:05 +02:00
parent 9ab9ecfbb7
commit e8b918258a
2 changed files with 16 additions and 20 deletions

View File

@@ -14,7 +14,6 @@ import ch.psi.utils.IO;
import ch.psi.utils.Serializer;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.psaf.Task;
import ch.psi.pshell.swing.ValueSelection;
import java.awt.Component;
import java.io.File;
@@ -22,10 +21,9 @@ import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import javax.swing.JCheckBox;
import java.util.logging.Level;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;
import javax.swing.event.TableModelEvent;
@@ -92,8 +90,7 @@ public class XPSSpectrum extends Panel {
if (!state.isProcessing()){
buttonSkip.setVisible(false);
if (running){
monitoringTask.stop();
monitoringTask.stopScheduler();
stopTimer();
running = false;
getView().getStatusBar().setProgress(-1);
}
@@ -167,10 +164,10 @@ public class XPSSpectrum extends Panel {
public final String CURRERNT_ITERATION_VAR = "cur_iteration";
int currentScanIndex ;
RangeSelection[] scanRanges;
Task monitoringTask = new Task() {
@Override
protected Object execute() throws Exception {
@Override
protected void onTimer() {
try{
Object index = XPSSpectrum.this.eval(CURRERNT_RANGE_VAR, true);
if ((index!=null) && (index instanceof Integer) && ((Integer)index >= 0)){
int scanIndex = (Integer)index;
@@ -178,12 +175,12 @@ public class XPSSpectrum extends Panel {
buttonSkip.setEnabled(true);
}
currentScanIndex = scanIndex;
int current_iteration = (Integer) XPSSpectrum.this.eval(CURRERNT_ITERATION_VAR, true);
int iterations = (Integer)scanRanges[currentScanIndex].getVars()[2];
buttonSkip.setVisible((iterations>1) && (current_iteration < (iterations-1)));
if (detailedScan){
RangeSelection range = rangeSelectionPanel.getRangesOrdered()[scanIndex];
for (int row = 0; row< rangeSelectionPanel.getTable().getRowCount(); row++){
@@ -199,21 +196,20 @@ public class XPSSpectrum extends Panel {
} else {
rangeSelectionPanel.getTable().clearSelection();
}
return true;
} catch (Exception ex){
getLogger().log(Level.FINE, null, ex);
}
};
}
void start() throws Controller.ControllerStateException{
HashMap<String, Object> args = new HashMap<>();
args.put("ranges", scanRanges);
args.put("pass_energy", Integer.valueOf(comboPass.getSelectedItem().toString()));
args.put("save_scienta_image", checkSaveImage.isSelected());
args.put("ENDSCAN", checkEndScan.isSelected());
args.put("ENDSCAN", checkEndScan.isSelected());
currentScanIndex = -1;
runAsync("XPSSpectrum", args);
monitoringTask.schedule(100, 500);
startTimer(500);
running = true;
}