Closedown

This commit is contained in:
gac-x03da
2022-08-04 16:32:06 +02:00
parent b3af6aa114
commit 134b0e7674
10 changed files with 222 additions and 101 deletions

View File

@@ -1,15 +1,17 @@
import ch.psi.pshell.ui.Panel;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JSpinner;
/**
*
*/
public class OTF extends Panel {
public class OTF extends ScriptProcessor {
public OTF() {
initComponents();
@@ -48,17 +50,19 @@ public class OTF extends Panel {
}
@Override
protected void onUnloaded() {
}
//Invoked by 'update()' to update components in the event thread
@Override
protected void doUpdate() {
}
}
void startScan() throws Exception {
@Override
public String getScript() {
return "otf";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
/*
ArrayList<String> sensors = new ArrayList();
@@ -74,9 +78,10 @@ public class OTF extends Panel {
args.put("E2", spinnerE2.getValue());
args.put("TIME", spinnerTime.getValue());
args.put("MODULO", spinnerModulo.getValue());
args.put("ENDSCAN", checkEndScan.isSelected());
runAsync("otf", args);
}
args.put("ENDSCAN", checkEndScan.isSelected());
return args;
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
@@ -98,6 +103,7 @@ public class OTF extends Panel {
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
checkEndScan = new javax.swing.JCheckBox();
buttonQueue = new javax.swing.JButton();
panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
@@ -222,6 +228,13 @@ public class OTF extends Panel {
checkEndScan.setText("Turn off beam at end");
buttonQueue.setText("Queue");
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonQueueActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
@@ -233,7 +246,8 @@ public class OTF extends Panel {
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addComponent(checkEndScan)
.addGap(0, 62, Short.MAX_VALUE)))
.addGap(0, 62, Short.MAX_VALUE))
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel3Layout.setVerticalGroup(
@@ -243,6 +257,8 @@ public class OTF extends Panel {
.addComponent(buttonStart)
.addGap(18, 18, 18)
.addComponent(buttonAbort)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(checkEndScan)
.addGap(26, 26, 26))
@@ -278,7 +294,7 @@ public class OTF extends Panel {
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
try {
startScan();
execute();
} catch (Exception ex) {
showException(ex);
}
@@ -292,8 +308,17 @@ public class OTF extends Panel {
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonQueue;
private javax.swing.JButton buttonStart;
private javax.swing.JCheckBox checkCur1;
private javax.swing.JCheckBox checkCur2;