445 lines
24 KiB
Java
Executable File
445 lines
24 KiB
Java
Executable File
/*
|
|
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
|
|
*/
|
|
|
|
import ch.psi.pshell.plot.LinePlot;
|
|
import ch.psi.pshell.plot.LinePlotSeries;
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.utils.State;
|
|
import ch.psi.utils.swing.SwingUtils;
|
|
import java.awt.Color;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import javax.swing.JSpinner;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class BunchLength extends Panel {
|
|
|
|
public BunchLength() {
|
|
initComponents();
|
|
setPersistedComponents(SwingUtils.getComponentsByType(panelScanPars, JSpinner.class));
|
|
plot11.setStyle(LinePlot.Style.ErrorY);
|
|
plot12.setStyle(LinePlot.Style.Normal);
|
|
plot21.setStyle(LinePlot.Style.ErrorY);
|
|
plot22.setStyle(LinePlot.Style.Normal);
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
}
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
buttonAbort.setEnabled(state.isProcessing());
|
|
boolean enabled = (state == State.Ready);
|
|
buttonPrepare.setEnabled(enabled);
|
|
buttonSetPhase.setEnabled(enabled);
|
|
buttonStart.setEnabled(enabled);
|
|
spinnerStart.setEnabled(enabled);
|
|
spinnerStop.setEnabled(enabled);
|
|
spinnerStep.setEnabled(enabled);
|
|
spinnerSamples.setEnabled(enabled);
|
|
spinnerLatency.setEnabled(enabled);
|
|
spinnerThreshold.setEnabled(enabled);
|
|
spinnerStation.setEnabled(enabled);
|
|
spinnerBunch.setEnabled(enabled);
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
//Callback to perform update - in event thread
|
|
@Override
|
|
protected void doUpdate() {
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
panelScanPars = new javax.swing.JPanel();
|
|
labelStart = new javax.swing.JLabel();
|
|
labelStop = new javax.swing.JLabel();
|
|
spinnerStep = new javax.swing.JSpinner();
|
|
labelStep = new javax.swing.JLabel();
|
|
spinnerStart = new javax.swing.JSpinner();
|
|
labelSamples = new javax.swing.JLabel();
|
|
spinnerSamples = new javax.swing.JSpinner();
|
|
labelLatency = new javax.swing.JLabel();
|
|
spinnerLatency = new javax.swing.JSpinner();
|
|
spinnerStop = new javax.swing.JSpinner();
|
|
labelThreshold = new javax.swing.JLabel();
|
|
spinnerThreshold = new javax.swing.JSpinner();
|
|
labelStation = new javax.swing.JLabel();
|
|
spinnerStation = new javax.swing.JSpinner();
|
|
spinnerBunch = new javax.swing.JSpinner();
|
|
labelBunch = new javax.swing.JLabel();
|
|
plot11 = new ch.psi.pshell.plot.LinePlotJFree();
|
|
buttonStart = new javax.swing.JButton();
|
|
buttonAbort = new javax.swing.JButton();
|
|
buttonPrepare = new javax.swing.JButton();
|
|
buttonSetPhase = new javax.swing.JButton();
|
|
spinnerPhase = new javax.swing.JSpinner();
|
|
panelOutput = new javax.swing.JPanel();
|
|
jTextAreaOutput = new javax.swing.JTextArea();
|
|
plot21 = new ch.psi.pshell.plot.LinePlotJFree();
|
|
plot12 = new ch.psi.pshell.plot.LinePlotJFree();
|
|
plot22 = new ch.psi.pshell.plot.LinePlotJFree();
|
|
|
|
setPreferredSize(new java.awt.Dimension(737, 445));
|
|
|
|
panelScanPars.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Parameters"));
|
|
|
|
labelStart.setText("Start:");
|
|
|
|
labelStop.setText("Stop:");
|
|
|
|
spinnerStep.setModel(new javax.swing.SpinnerNumberModel(0.05d, 0.0d, 10.0d, 0.01d));
|
|
|
|
labelStep.setText("Step size:");
|
|
|
|
spinnerStart.setModel(new javax.swing.SpinnerNumberModel(-0.1d, -360.0d, 360.0d, 1.0d));
|
|
|
|
labelSamples.setText("Nb samples:");
|
|
|
|
spinnerSamples.setModel(new javax.swing.SpinnerNumberModel(10, 1, 100, 1));
|
|
|
|
labelLatency.setText("Latency:");
|
|
|
|
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.4d, 0.0d, 5.0d, 0.01d));
|
|
|
|
spinnerStop.setModel(new javax.swing.SpinnerNumberModel(0.1d, -360.0d, 360.0d, 1.0d));
|
|
|
|
labelThreshold.setText("Threshold:");
|
|
|
|
spinnerThreshold.setModel(new javax.swing.SpinnerNumberModel(7000, 0, 50000, 1));
|
|
|
|
labelStation.setText("TDS Station:");
|
|
|
|
spinnerStation.setModel(new javax.swing.SpinnerListModel(new String[] {"S30CB14", "SATMA02", "SINDI01"}));
|
|
|
|
spinnerBunch.setModel(new javax.swing.SpinnerListModel(new String[] {"Bunch1", "Bunch2"}));
|
|
|
|
labelBunch.setText("Bunch:");
|
|
|
|
javax.swing.GroupLayout panelScanParsLayout = new javax.swing.GroupLayout(panelScanPars);
|
|
panelScanPars.setLayout(panelScanParsLayout);
|
|
panelScanParsLayout.setHorizontalGroup(
|
|
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelScanParsLayout.createSequentialGroup()
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(labelStop, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(labelStart, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(labelSamples, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(labelStep, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelScanParsLayout.createSequentialGroup()
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(labelThreshold)
|
|
.addComponent(labelLatency))
|
|
.addGap(2, 2, 2)))
|
|
.addComponent(labelStation)
|
|
.addComponent(labelBunch, javax.swing.GroupLayout.Alignment.TRAILING))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(spinnerStart)
|
|
.addComponent(spinnerStation)
|
|
.addComponent(spinnerBunch)
|
|
.addComponent(spinnerThreshold)
|
|
.addComponent(spinnerLatency)
|
|
.addComponent(spinnerSamples)
|
|
.addComponent(spinnerStep)
|
|
.addComponent(spinnerStop))
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
panelScanParsLayout.setVerticalGroup(
|
|
panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelScanParsLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelStart))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerStop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelStop))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelStep))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerSamples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelSamples))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelLatency))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(labelThreshold)
|
|
.addComponent(spinnerThreshold, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerStation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelStation))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(panelScanParsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerBunch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelBunch)))
|
|
);
|
|
|
|
plot11.setTitle("");
|
|
|
|
buttonStart.setText("Start");
|
|
buttonStart.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonStartActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonAbort.setText("Abort");
|
|
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonAbortActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonPrepare.setText("Prepare");
|
|
buttonPrepare.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonPrepareActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonSetPhase.setText("Set Beam Phase");
|
|
buttonSetPhase.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonSetPhaseActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
spinnerPhase.setModel(new javax.swing.SpinnerNumberModel(0.0d, -360.0d, 360.0d, 1.0d));
|
|
|
|
panelOutput.setBorder(javax.swing.BorderFactory.createTitledBorder("Output"));
|
|
|
|
jTextAreaOutput.setColumns(20);
|
|
jTextAreaOutput.setFont(new java.awt.Font("Courier 10 Pitch", 0, 14)); // NOI18N
|
|
jTextAreaOutput.setRows(5);
|
|
|
|
javax.swing.GroupLayout panelOutputLayout = new javax.swing.GroupLayout(panelOutput);
|
|
panelOutput.setLayout(panelOutputLayout);
|
|
panelOutputLayout.setHorizontalGroup(
|
|
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelOutputLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(jTextAreaOutput)
|
|
.addContainerGap())
|
|
);
|
|
panelOutputLayout.setVerticalGroup(
|
|
panelOutputLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelOutputLayout.createSequentialGroup()
|
|
.addComponent(jTextAreaOutput, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
|
|
.addContainerGap())
|
|
);
|
|
|
|
plot21.setTitle("");
|
|
|
|
plot12.setTitle("");
|
|
|
|
plot22.setTitle("");
|
|
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
this.setLayout(layout);
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(panelOutput, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(buttonPrepare)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(buttonStart)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(buttonAbort))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(buttonSetPhase)
|
|
.addGap(0, 0, 0)
|
|
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE)
|
|
.addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
|
|
.addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addGap(28, 28, 28))
|
|
);
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(panelScanPars, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(buttonPrepare)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(buttonSetPhase)
|
|
.addComponent(spinnerPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(buttonStart)
|
|
.addComponent(buttonAbort)))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
|
.addComponent(plot11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(plot12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(plot22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(plot21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(panelOutput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addContainerGap(19, Short.MAX_VALUE))
|
|
);
|
|
|
|
panelScanPars.getAccessibleContext().setAccessibleDescription("");
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
|
ArrayList parameters = new ArrayList();
|
|
parameters.add(spinnerStart.getValue());
|
|
parameters.add(spinnerStop.getValue());
|
|
parameters.add(spinnerStep.getValue());
|
|
parameters.add(spinnerSamples.getValue());
|
|
parameters.add(spinnerLatency.getValue());
|
|
parameters.add(spinnerThreshold.getValue());
|
|
parameters.add(spinnerStation.getValue());
|
|
parameters.add(spinnerBunch.getValue());
|
|
parameters.add(plot11);
|
|
parameters.add(plot12);
|
|
parameters.add(plot21);
|
|
parameters.add(plot22);
|
|
try {
|
|
runAsync("Tools/BunchLengthScan", parameters).handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
String message = "Exception executing scan: " + ex;
|
|
getLogger().info(message);
|
|
showException((Exception) ex);
|
|
} else {
|
|
List ret_list = (List)ret;
|
|
try{
|
|
double bunch_length_rms_1 = ((Number)ret_list.get(0)).doubleValue();
|
|
double bunch_length_fw_1 = ((Number)ret_list.get(1)).doubleValue();
|
|
double bunch_length_fit_1 = ((Number)ret_list.get(2)).doubleValue();
|
|
double calibration_1 = ((Number)ret_list.get(3)).doubleValue();
|
|
double bunch_length_rms_2 = ((Number)ret_list.get(4)).doubleValue();
|
|
double bunch_length_fw_2 = ((Number)ret_list.get(5)).doubleValue();
|
|
double bunch_length_fit_2 = ((Number)ret_list.get(6)).doubleValue();
|
|
double calibration_2 = ((Number)ret_list.get(7)).doubleValue();
|
|
double bunch_length_rms = ((Number)ret_list.get(8)).doubleValue();
|
|
double bunch_length_fw = ((Number)ret_list.get(9)).doubleValue();
|
|
double bunch_length_fit = ((Number)ret_list.get(10)).doubleValue();
|
|
double calibration = ((Number)ret_list.get(11)).doubleValue();
|
|
jTextAreaOutput.setText(null);
|
|
jTextAreaOutput.append(String.format(" 0 deg 180 deg mean\n"));
|
|
jTextAreaOutput.append(String.format("Bunch length rms (fs): %12.1f%12.1f%12.1f\n",bunch_length_rms_1,bunch_length_rms_2,bunch_length_rms));
|
|
jTextAreaOutput.append(String.format("Bunch length fw (fs): %12.1f%12.1f%12.1f\n",bunch_length_fw_1,bunch_length_fw_2,bunch_length_fw));
|
|
jTextAreaOutput.append(String.format("Bunch length gauss fit rms (fs): %12.1f%12.1f%12.1f\n",bunch_length_fit_1,bunch_length_fit_2,bunch_length_fit));
|
|
jTextAreaOutput.append(String.format("Calibration (fs/um): %12.3f%12.3f%12.3f\n",calibration_1,calibration_2,calibration));
|
|
} catch (Exception e) {
|
|
showException(e);
|
|
}
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonStartActionPerformed
|
|
|
|
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
|
try {
|
|
abort();
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonAbortActionPerformed
|
|
|
|
private void buttonPrepareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPrepareActionPerformed
|
|
ArrayList parameters = new ArrayList();
|
|
parameters.add(spinnerStation.getValue());
|
|
try {
|
|
runAsync("Tools/BunchLengthPrep", parameters).handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
String message = "Exception executing scan: " + ex;
|
|
getLogger().info(message);
|
|
showException((Exception) ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonPrepareActionPerformed
|
|
|
|
private void buttonSetPhaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSetPhaseActionPerformed
|
|
ArrayList parameters = new ArrayList();
|
|
parameters.add(spinnerStation.getValue());
|
|
parameters.add(spinnerPhase.getValue());
|
|
try {
|
|
runAsync("Tools/SetTdsBeamPhase", parameters).handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
String message = "Exception executing scan: " + ex;
|
|
getLogger().info(message);
|
|
showException((Exception) ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonSetPhaseActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton buttonAbort;
|
|
private javax.swing.JButton buttonPrepare;
|
|
private javax.swing.JButton buttonSetPhase;
|
|
private javax.swing.JButton buttonStart;
|
|
private javax.swing.JTextArea jTextAreaOutput;
|
|
private javax.swing.JLabel labelBunch;
|
|
private javax.swing.JLabel labelLatency;
|
|
private javax.swing.JLabel labelSamples;
|
|
private javax.swing.JLabel labelStart;
|
|
private javax.swing.JLabel labelStation;
|
|
private javax.swing.JLabel labelStep;
|
|
private javax.swing.JLabel labelStop;
|
|
private javax.swing.JLabel labelThreshold;
|
|
private javax.swing.JPanel panelOutput;
|
|
private javax.swing.JPanel panelScanPars;
|
|
private ch.psi.pshell.plot.LinePlotJFree plot11;
|
|
private ch.psi.pshell.plot.LinePlotJFree plot12;
|
|
private ch.psi.pshell.plot.LinePlotJFree plot21;
|
|
private ch.psi.pshell.plot.LinePlotJFree plot22;
|
|
private javax.swing.JSpinner spinnerBunch;
|
|
private javax.swing.JSpinner spinnerLatency;
|
|
private javax.swing.JSpinner spinnerPhase;
|
|
private javax.swing.JSpinner spinnerSamples;
|
|
private javax.swing.JSpinner spinnerStart;
|
|
private javax.swing.JSpinner spinnerStation;
|
|
private javax.swing.JSpinner spinnerStep;
|
|
private javax.swing.JSpinner spinnerStop;
|
|
private javax.swing.JSpinner spinnerThreshold;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|