515 lines
26 KiB
Java
515 lines
26 KiB
Java
/*
|
|
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
|
*/
|
|
|
|
import ch.psi.pshell.device.Motor;
|
|
import ch.psi.pshell.epics.AreaDetector;
|
|
import ch.psi.pshell.ui.ScriptProcessor;
|
|
import ch.psi.utils.State;
|
|
import ch.psi.utils.swing.SwingUtils;
|
|
import java.awt.Component;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import javax.swing.JCheckBox;
|
|
import javax.swing.JComboBox;
|
|
import javax.swing.JSpinner;
|
|
import javax.swing.JToggleButton;
|
|
import javax.swing.SpinnerNumberModel;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class Scan1D extends ScriptProcessor {
|
|
|
|
public Scan1D() {
|
|
initComponents();
|
|
|
|
//Component persistence
|
|
ArrayList<Component> 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, JComboBox.class)));
|
|
setPersistedComponents(persistedComponents.toArray(new Component[0]));
|
|
startTimer(1000);
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
comboMotorActionPerformed(null);
|
|
AreaDetector ccd = (AreaDetector) getDevice("ccd");
|
|
}
|
|
|
|
@Override
|
|
protected void onTimer(){
|
|
}
|
|
|
|
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
setEnabled(isEnabled());
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
@Override
|
|
public void setEnabled(boolean value) {
|
|
super.setEnabled(value);
|
|
buttonAbort.setEnabled(value && getState().isInitialized());
|
|
|
|
boolean enableControls = (value && (getState() == State.Ready));
|
|
for (Component c : panelSensors.getComponents()) {
|
|
c.setEnabled(enableControls);
|
|
}
|
|
for (Component c : panelPositioner.getComponents()) {
|
|
c.setEnabled(enableControls);
|
|
}
|
|
buttonStart.setEnabled(enableControls);
|
|
spinnerStepSize.setEnabled(enableControls && radioStepSize.isSelected());
|
|
spinnerSteps.setEnabled(enableControls && radioSteps.isSelected());
|
|
|
|
spinnerFrom.setEnabled(enableControls && radioAbsolute.isSelected());
|
|
spinnerTo.setEnabled(enableControls && radioAbsolute.isSelected());
|
|
spinnerRange.setEnabled(enableControls && !radioAbsolute.isSelected());
|
|
}
|
|
|
|
@Override
|
|
public String getScript() {
|
|
return "templates/Scan1D";
|
|
}
|
|
|
|
@Override
|
|
public Map<String, Object> getArgs() {
|
|
HashMap<String, Object> args = new HashMap<>();
|
|
args.put("MOTOR", comboMotor.getSelectedItem().toString());
|
|
ArrayList<String> sensors = new ArrayList();
|
|
for (Component c : panelSensors.getComponents()) {
|
|
if ((c instanceof JCheckBox) && ((JCheckBox) c).isSelected()) {
|
|
sensors.add(c.getName());
|
|
}
|
|
}
|
|
args.put("SENSORS", sensors);
|
|
if (radioRelative.isSelected()) {
|
|
args.put("RANGE", new Double[]{-(Double) spinnerRange.getValue() / 2, (Double) spinnerRange.getValue() / 2});
|
|
} else {
|
|
args.put("RANGE", new Double[]{(Double) spinnerFrom.getValue(), (Double) spinnerTo.getValue()});
|
|
}
|
|
if (radioStepSize.isSelected()) {
|
|
ArrayList<Double> steps = new ArrayList();
|
|
steps.add((Double) spinnerStepSize.getValue());
|
|
args.put("STEPS", steps);
|
|
} else {
|
|
args.put("STEPS", (Integer) spinnerSteps.getValue());
|
|
}
|
|
args.put("LATENCY", (Double) spinnerLatency.getValue());
|
|
args.put("RELATIVE", radioRelative.isSelected());
|
|
return args;
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
buttonGroup1 = new javax.swing.ButtonGroup();
|
|
buttonGroup2 = new javax.swing.ButtonGroup();
|
|
panelPositioner = new javax.swing.JPanel();
|
|
jLabel1 = new javax.swing.JLabel();
|
|
comboMotor = new javax.swing.JComboBox();
|
|
motorPanel = new ch.psi.pshell.swing.MotorReadoutPanel();
|
|
txtSize = new javax.swing.JLabel();
|
|
spinnerRange = new javax.swing.JSpinner();
|
|
radioStepSize = new javax.swing.JRadioButton();
|
|
radioSteps = new javax.swing.JRadioButton();
|
|
spinnerStepSize = new javax.swing.JSpinner();
|
|
spinnerSteps = new javax.swing.JSpinner();
|
|
jLabel3 = new javax.swing.JLabel();
|
|
spinnerLatency = new javax.swing.JSpinner();
|
|
radioAbsolute = new javax.swing.JRadioButton();
|
|
spinnerFrom = new javax.swing.JSpinner();
|
|
jLabel4 = new javax.swing.JLabel();
|
|
jLabel5 = new javax.swing.JLabel();
|
|
spinnerTo = new javax.swing.JSpinner();
|
|
radioRelative = new javax.swing.JRadioButton();
|
|
jLabel6 = new javax.swing.JLabel();
|
|
jLabel7 = new javax.swing.JLabel();
|
|
jLabel8 = new javax.swing.JLabel();
|
|
panelSensors = new javax.swing.JPanel();
|
|
checkImage = new javax.swing.JCheckBox();
|
|
checkCurrent = new javax.swing.JCheckBox();
|
|
jPanel3 = new javax.swing.JPanel();
|
|
buttonStart = new javax.swing.JButton();
|
|
buttonAbort = new javax.swing.JButton();
|
|
buttonQueue = new javax.swing.JButton();
|
|
|
|
setPreferredSize(new java.awt.Dimension(792, 567));
|
|
|
|
panelPositioner.setBorder(javax.swing.BorderFactory.createTitledBorder("Positioner"));
|
|
|
|
jLabel1.setText("Motor:");
|
|
|
|
comboMotor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "dummy_x", "sample_x", "sample_y", "sample_x" }));
|
|
comboMotor.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
comboMotorActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
txtSize.setText("Size:");
|
|
|
|
spinnerRange.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 100.0d, 1.0d));
|
|
spinnerRange.setEnabled(false);
|
|
|
|
buttonGroup1.add(radioStepSize);
|
|
radioStepSize.setSelected(true);
|
|
radioStepSize.setText("Step Size");
|
|
radioStepSize.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioStepSizeActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonGroup1.add(radioSteps);
|
|
radioSteps.setText("Number of Steps");
|
|
radioSteps.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioStepSizeActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
spinnerStepSize.setModel(new javax.swing.SpinnerNumberModel(0.1d, 0.001d, 1000.0d, 0.1d));
|
|
|
|
spinnerSteps.setModel(new javax.swing.SpinnerNumberModel(10, 1, 1000, 1));
|
|
spinnerSteps.setEnabled(false);
|
|
|
|
jLabel3.setText("Latency(s):");
|
|
|
|
spinnerLatency.setModel(new javax.swing.SpinnerNumberModel(0.0d, 0.0d, 10.0d, 0.1d));
|
|
|
|
buttonGroup2.add(radioAbsolute);
|
|
radioAbsolute.setSelected(true);
|
|
radioAbsolute.setText("Absolute Scan");
|
|
radioAbsolute.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioAbsoluteActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
spinnerFrom.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
|
|
|
|
jLabel4.setText("From:");
|
|
|
|
jLabel5.setText("To:");
|
|
|
|
spinnerTo.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
|
|
|
|
buttonGroup2.add(radioRelative);
|
|
radioRelative.setText("Relative Scan");
|
|
radioRelative.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
radioAbsoluteActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel6.setText("Position:");
|
|
|
|
jLabel7.setText("Range:");
|
|
|
|
jLabel8.setText("Steps:");
|
|
|
|
javax.swing.GroupLayout panelPositionerLayout = new javax.swing.GroupLayout(panelPositioner);
|
|
panelPositioner.setLayout(panelPositionerLayout);
|
|
panelPositionerLayout.setHorizontalGroup(
|
|
panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelPositionerLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(radioSteps, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(panelPositionerLayout.createSequentialGroup()
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jLabel6)
|
|
.addComponent(jLabel1))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(motorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboMotor, 0, 159, Short.MAX_VALUE)))
|
|
.addGroup(panelPositionerLayout.createSequentialGroup()
|
|
.addComponent(jLabel3)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup()
|
|
.addGap(0, 0, Short.MAX_VALUE)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup()
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(jLabel4)
|
|
.addComponent(jLabel5)
|
|
.addComponent(jLabel7))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(spinnerFrom, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(spinnerRange, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(spinnerTo, javax.swing.GroupLayout.Alignment.TRAILING)))
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup()
|
|
.addComponent(jLabel8)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(spinnerSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup()
|
|
.addComponent(txtSize)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(spinnerStepSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
|
.addGroup(panelPositionerLayout.createSequentialGroup()
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(radioStepSize)
|
|
.addComponent(radioAbsolute)
|
|
.addComponent(radioRelative))
|
|
.addGap(0, 0, Short.MAX_VALUE)))
|
|
.addContainerGap())
|
|
);
|
|
|
|
panelPositionerLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerLatency, spinnerRange, spinnerStepSize, spinnerSteps});
|
|
|
|
panelPositionerLayout.setVerticalGroup(
|
|
panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelPositionerLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel1)
|
|
.addComponent(comboMotor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(18, 18, 18)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel6)
|
|
.addComponent(motorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(18, 18, 18)
|
|
.addComponent(radioAbsolute)
|
|
.addGap(3, 3, 3)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel4))
|
|
.addGap(3, 3, 3)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel5))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(radioRelative)
|
|
.addGap(1, 1, 1)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel7))
|
|
.addGap(18, 18, 18)
|
|
.addComponent(radioStepSize)
|
|
.addGap(0, 0, 0)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerStepSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(txtSize))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(radioSteps)
|
|
.addGap(0, 0, 0)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerSteps, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel8))
|
|
.addGap(18, 18, 18)
|
|
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel3)
|
|
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addContainerGap(159, Short.MAX_VALUE))
|
|
);
|
|
|
|
panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
|
|
|
|
checkImage.setSelected(true);
|
|
checkImage.setText("CCD Image");
|
|
checkImage.setToolTipText("");
|
|
checkImage.setContentAreaFilled(false);
|
|
checkImage.setName("ccd.dataMatrix"); // NOI18N
|
|
|
|
checkCurrent.setText("Machine Current");
|
|
checkCurrent.setName("current"); // NOI18N
|
|
|
|
javax.swing.GroupLayout panelSensorsLayout = new javax.swing.GroupLayout(panelSensors);
|
|
panelSensors.setLayout(panelSensorsLayout);
|
|
panelSensorsLayout.setHorizontalGroup(
|
|
panelSensorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelSensorsLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(panelSensorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(checkImage)
|
|
.addComponent(checkCurrent))
|
|
.addContainerGap(108, Short.MAX_VALUE))
|
|
);
|
|
panelSensorsLayout.setVerticalGroup(
|
|
panelSensorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(panelSensorsLayout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(checkImage)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(checkCurrent)
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
|
|
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
|
|
|
|
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);
|
|
}
|
|
});
|
|
|
|
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(
|
|
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonStart, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonAbort, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE))
|
|
.addContainerGap())
|
|
);
|
|
jPanel3Layout.setVerticalGroup(
|
|
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(buttonStart)
|
|
.addGap(18, 18, 18)
|
|
.addComponent(buttonAbort)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonQueue)
|
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
);
|
|
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
|
this.setLayout(layout);
|
|
layout.setHorizontalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addComponent(panelSensors, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(panelPositioner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addContainerGap())
|
|
);
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jPanel3, panelPositioner, panelSensors});
|
|
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(panelPositioner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(panelSensors, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap())
|
|
);
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
|
try {
|
|
execute();
|
|
} catch (Exception ex) {
|
|
SwingUtils.showException(this, ex);
|
|
}
|
|
}//GEN-LAST:event_buttonStartActionPerformed
|
|
|
|
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
|
try {
|
|
abort();
|
|
((AreaDetector) getDevice("ccd")).stop();
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonAbortActionPerformed
|
|
|
|
private void radioStepSizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioStepSizeActionPerformed
|
|
setEnabled(isEnabled());
|
|
}//GEN-LAST:event_radioStepSizeActionPerformed
|
|
|
|
private void comboMotorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboMotorActionPerformed
|
|
try {
|
|
Motor motor = (Motor) getDevice(comboMotor.getSelectedItem().toString());
|
|
motorPanel.setDevice(motor);
|
|
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
|
|
|
|
private void radioAbsoluteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioAbsoluteActionPerformed
|
|
setEnabled(isEnabled());
|
|
}//GEN-LAST:event_radioAbsoluteActionPerformed
|
|
|
|
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.ButtonGroup buttonGroup1;
|
|
private javax.swing.ButtonGroup buttonGroup2;
|
|
private javax.swing.JButton buttonQueue;
|
|
private javax.swing.JButton buttonStart;
|
|
private javax.swing.JCheckBox checkCurrent;
|
|
private javax.swing.JCheckBox checkImage;
|
|
private javax.swing.JComboBox comboMotor;
|
|
private javax.swing.JLabel jLabel1;
|
|
private javax.swing.JLabel jLabel3;
|
|
private javax.swing.JLabel jLabel4;
|
|
private javax.swing.JLabel jLabel5;
|
|
private javax.swing.JLabel jLabel6;
|
|
private javax.swing.JLabel jLabel7;
|
|
private javax.swing.JLabel jLabel8;
|
|
private javax.swing.JPanel jPanel3;
|
|
private ch.psi.pshell.swing.MotorReadoutPanel motorPanel;
|
|
private javax.swing.JPanel panelPositioner;
|
|
private javax.swing.JPanel panelSensors;
|
|
private javax.swing.JRadioButton radioAbsolute;
|
|
private javax.swing.JRadioButton radioRelative;
|
|
private javax.swing.JRadioButton radioStepSize;
|
|
private javax.swing.JRadioButton radioSteps;
|
|
private javax.swing.JSpinner spinnerFrom;
|
|
private javax.swing.JSpinner spinnerLatency;
|
|
private javax.swing.JSpinner spinnerRange;
|
|
private javax.swing.JSpinner spinnerStepSize;
|
|
private javax.swing.JSpinner spinnerSteps;
|
|
private javax.swing.JSpinner spinnerTo;
|
|
private javax.swing.JLabel txtSize;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|