This commit is contained in:
gac-x09lb
2022-10-03 11:00:17 +02:00
parent e852f3d403
commit ab00bd933c
2 changed files with 1025 additions and 0 deletions
+476
View File
@@ -0,0 +1,476 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="buttonGroup1">
</Component>
<Component class="javax.swing.ButtonGroup" name="buttonGroup2">
</Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="panelSensors" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPositioners" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelScan" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="panelPositioners" max="32767" attributes="0"/>
<Component id="panelSensors" max="32767" attributes="0"/>
<Component id="panelScan" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panelPositioners">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Positioners"/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[248, 543]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel6" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="motorPanelX" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="58" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerFromX" alignment="1" pref="91" max="32767" attributes="0"/>
<Component id="spinnerToX" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerFromY" alignment="1" max="32767" attributes="0"/>
<Component id="spinnerToY" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel11" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepSizeX" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel12" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinnerStepSizeY" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel14" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerStepsX" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="spinnerStepsY" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel7" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="motorPanelY" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="ckDummy" min="-2" max="-2" attributes="0"/>
<Component id="radioSteps" linkSize="3" min="-2" max="-2" attributes="0"/>
<Component id="radioStepSize" linkSize="3" min="-2" max="-2" attributes="0"/>
<Component id="checkZigzag" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="71" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel6" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="motorPanelX" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel7" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="motorPanelY" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerFromX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerToX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerFromY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel9" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerToY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="radioStepSize" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStepSizeX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel11" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStepSizeY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel12" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="radioSteps" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStepsX" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel13" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerStepsY" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel14" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="checkZigzag" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="ckDummy" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="146" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.MotorReadoutPanel" name="motorPanelX">
</Component>
<Component class="javax.swing.JRadioButton" name="radioStepSize">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Step Size"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioStepSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="radioSteps">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" value="Number of Steps"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="radioStepSizeActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepSizeX">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="180.0" minimum="0.1" numberType="java.lang.Double" stepSize="0.1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepsX">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="1000" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerFromX">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="1.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="X From:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="X To:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerToX">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10.0" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Sample X:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Sample Y:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.MotorReadoutPanel" name="motorPanelY">
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="Y To:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="Y From:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerFromY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="1.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerToY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10.0" maximum="10.0" minimum="0.0" numberType="java.lang.Double" stepSize="1.0" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel11">
<Properties>
<Property name="text" type="java.lang.String" value="X:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel12">
<Properties>
<Property name="text" type="java.lang.String" value="Y:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepSizeY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1.0" maximum="90.0" minimum="0.1" numberType="java.lang.Double" stepSize="0.1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel13">
<Properties>
<Property name="text" type="java.lang.String" value="X:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel14">
<Properties>
<Property name="text" type="java.lang.String" value="Y:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerStepsY">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="10" maximum="1000" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkZigzag">
<Properties>
<Property name="text" type="java.lang.String" value="Zigzag"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="ckDummy">
<Properties>
<Property name="text" type="java.lang.String" value="Dummy"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ckDummyActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelSensors">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Sensors"/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[248, 543]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="checkImage" min="-2" max="-2" attributes="0"/>
<Component id="checkCurrent" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="130" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="checkImage" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="checkCurrent" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JCheckBox" name="checkImage">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="CCD Image"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="name" type="java.lang.String" value="ccd.dataMatrix" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkCurrent">
<Properties>
<Property name="text" type="java.lang.String" value="Current"/>
<Property name="name" type="java.lang.String" value="current" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelScan">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Scan Control"/>
</Border>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[248, 543]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonStart" max="32767" attributes="0"/>
<Component id="buttonAbort" max="32767" attributes="0"/>
<Component id="buttonQueue" alignment="1" pref="214" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonStart" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonQueue" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStartActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonQueue">
<Properties>
<Property name="text" type="java.lang.String" value="Queue"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonQueueActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
+549
View File
@@ -0,0 +1,549 @@
/*
* 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.List;
import java.util.Map;
import javax.swing.JCheckBox;
import javax.swing.JSpinner;
import javax.swing.JToggleButton;
import javax.swing.SpinnerNumberModel;
/**
*
*/
public class Scan2D extends ScriptProcessor {
final List<Motor> motors = new ArrayList();
public Scan2D() {
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)));
setPersistedComponents(persistedComponents.toArray(new Component[0]));
startTimer(1000);
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
AreaDetector ccd = (AreaDetector) getDevice("ccd");
ckDummyActionPerformed(null);
}
@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);
boolean enableControls = (value && (getState()==State.Ready));
for (Component c : panelSensors.getComponents()) {
c.setEnabled(enableControls);
}
for (Component c : panelPositioners.getComponents()) {
c.setEnabled(enableControls);
}
buttonStart.setEnabled(enableControls);
buttonAbort.setEnabled(value && getState().isInitialized());
spinnerStepSizeX.setEnabled(enableControls && radioStepSize.isSelected());
spinnerStepsX.setEnabled(enableControls && radioSteps.isSelected());
spinnerFromX.setEnabled(enableControls);
spinnerToX.setEnabled(enableControls);
spinnerStepSizeY.setEnabled(spinnerStepSizeX.isEnabled());
spinnerStepsY.setEnabled(spinnerStepsX.isEnabled());
spinnerFromY.setEnabled(spinnerFromX.isEnabled());
spinnerToY.setEnabled(spinnerToX.isEnabled());
}
@Override
public String getScript() {
return "templates/Scan2D";
}
@Override
public Map<String, Object> getArgs() {
HashMap<String, Object> args = new HashMap<>();
ArrayList<String> sensors = new ArrayList();
for (Component c : panelSensors.getComponents()) {
if ((c instanceof JCheckBox) && ((JCheckBox) c).isSelected()) {
sensors.add(c.getName());
}
}
args.put("MOTORS", motors);
args.put("SENSORS", sensors);
args.put("RANGE_X", new Double[]{(Double) spinnerFromX.getValue(), (Double) spinnerToX.getValue()});
args.put("RANGE_Y", new Double[]{(Double) spinnerFromY.getValue(), (Double) spinnerToY.getValue()});
ArrayList steps = new ArrayList();
if (radioStepSize.isSelected()) {
steps.add((Double) spinnerStepSizeX.getValue());
steps.add((Double) spinnerStepSizeY.getValue());
} else {
steps.add((Integer) spinnerStepsX.getValue());
steps.add((Integer) spinnerStepsY.getValue());
}
args.put("STEPS", steps);
args.put("LATENCY", (Double) 0.0);
args.put("RELATIVE", false);
args.put("ZIGZAG", checkZigzag.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();
panelPositioners = new javax.swing.JPanel();
motorPanelX = new ch.psi.pshell.swing.MotorReadoutPanel();
radioStepSize = new javax.swing.JRadioButton();
radioSteps = new javax.swing.JRadioButton();
spinnerStepSizeX = new javax.swing.JSpinner();
spinnerStepsX = new javax.swing.JSpinner();
spinnerFromX = new javax.swing.JSpinner();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
spinnerToX = new javax.swing.JSpinner();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
motorPanelY = new ch.psi.pshell.swing.MotorReadoutPanel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
spinnerFromY = new javax.swing.JSpinner();
spinnerToY = new javax.swing.JSpinner();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
spinnerStepSizeY = new javax.swing.JSpinner();
jLabel13 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
spinnerStepsY = new javax.swing.JSpinner();
checkZigzag = new javax.swing.JCheckBox();
ckDummy = new javax.swing.JCheckBox();
panelSensors = new javax.swing.JPanel();
checkImage = new javax.swing.JCheckBox();
checkCurrent = new javax.swing.JCheckBox();
panelScan = new javax.swing.JPanel();
buttonStart = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
buttonQueue = new javax.swing.JButton();
panelPositioners.setBorder(javax.swing.BorderFactory.createTitledBorder("Positioners"));
panelPositioners.setPreferredSize(new java.awt.Dimension(248, 543));
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);
}
});
spinnerStepSizeX.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.1d, 180.0d, 0.1d));
spinnerStepsX.setModel(new javax.swing.SpinnerNumberModel(10, 1, 1000, 1));
spinnerStepsX.setEnabled(false);
spinnerFromX.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
jLabel4.setText("X From:");
jLabel5.setText("X To:");
spinnerToX.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 10.0d, 1.0d));
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel6.setText("Sample X:");
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel7.setText("Sample Y:");
jLabel8.setText("Y To:");
jLabel9.setText("Y From:");
spinnerFromY.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.0d, 1.0d, 1.0d));
spinnerToY.setModel(new javax.swing.SpinnerNumberModel(10.0d, 0.0d, 10.0d, 1.0d));
jLabel11.setText("X:");
jLabel12.setText("Y:");
spinnerStepSizeY.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.1d, 90.0d, 0.1d));
jLabel13.setText("X:");
jLabel14.setText("Y:");
spinnerStepsY.setModel(new javax.swing.SpinnerNumberModel(10, 1, 1000, 1));
spinnerStepsY.setEnabled(false);
checkZigzag.setText("Zigzag");
ckDummy.setText("Dummy");
ckDummy.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ckDummyActionPerformed(evt);
}
});
javax.swing.GroupLayout panelPositionersLayout = new javax.swing.GroupLayout(panelPositioners);
panelPositioners.setLayout(panelPositionersLayout);
panelPositionersLayout.setHorizontalGroup(
panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPositionersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPositionersLayout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(motorPanelX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addGap(0, 58, Short.MAX_VALUE)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerFromX, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addComponent(spinnerToX, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerFromY, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(spinnerToY, javax.swing.GroupLayout.Alignment.TRAILING)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerStepSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel14)
.addComponent(jLabel13))
.addGap(6, 6, 6)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerStepsX, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerStepsY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(panelPositionersLayout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(motorPanelY, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelPositionersLayout.createSequentialGroup()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ckDummy)
.addComponent(radioSteps)
.addComponent(radioStepSize)
.addComponent(checkZigzag))
.addGap(0, 71, Short.MAX_VALUE)))
.addContainerGap())
);
panelPositionersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {radioStepSize, radioSteps});
panelPositionersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerStepSizeX, spinnerStepSizeY, spinnerStepsX});
panelPositionersLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel6, jLabel7});
panelPositionersLayout.setVerticalGroup(
panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPositionersLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel6)
.addComponent(motorPanelX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel7)
.addComponent(motorPanelY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerFromX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGap(3, 3, 3)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerToX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(3, 3, 3)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerFromY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addGap(3, 3, 3)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerToY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addComponent(radioStepSize)
.addGap(3, 3, 3)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStepSizeX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11))
.addGap(3, 3, 3)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStepSizeY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(radioSteps)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStepsX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerStepsY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkZigzag)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(ckDummy)
.addContainerGap(146, Short.MAX_VALUE))
);
panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors"));
panelSensors.setPreferredSize(new java.awt.Dimension(248, 543));
checkImage.setSelected(true);
checkImage.setText("CCD Image");
checkImage.setToolTipText("");
checkImage.setContentAreaFilled(false);
checkImage.setName("ccd.dataMatrix"); // NOI18N
checkCurrent.setText("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(130, 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))
);
panelScan.setBorder(javax.swing.BorderFactory.createTitledBorder("Scan Control"));
panelScan.setPreferredSize(new java.awt.Dimension(248, 543));
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 panelScanLayout = new javax.swing.GroupLayout(panelScan);
panelScan.setLayout(panelScanLayout);
panelScanLayout.setHorizontalGroup(
panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelScanLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonQueue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE))
.addContainerGap())
);
panelScanLayout.setVerticalGroup(
panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelScanLayout.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(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(panelPositioners, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelScan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {panelPositioners, panelScan, panelSensors});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelPositioners, 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(panelScan, 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 buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
try {
queue();
} catch (Exception ex) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonQueueActionPerformed
private void ckDummyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckDummyActionPerformed
motors.clear();
if (ckDummy.isSelected()){
motors.add((Motor) getDevice("dummy_x"));
motors.add((Motor) getDevice("dummy_y"));
} else {
motors.add((Motor) getDevice("sample_x"));
motors.add((Motor) getDevice("sample_y"));
}
Motor x=motors.get(0);
Motor y=motors.get(0);
motorPanelX.setDevice(x);
motorPanelY.setDevice(y);
try{
spinnerFromX.setModel(new SpinnerNumberModel(Math.max(x.getMinValue(),(Double)spinnerFromX.getValue()), x.getMinValue(), x.getMaxValue(), 1.0));
spinnerToX.setModel(new SpinnerNumberModel(Math.min(x.getMaxValue(),(Double)spinnerToX.getValue()), x.getMinValue(), x.getMaxValue(), 1.0));
} catch (Exception ex){
spinnerFromX.setModel(new SpinnerNumberModel(x.getMinValue(), x.getMinValue(), x.getMaxValue(), 1.0));
spinnerToX.setModel(new SpinnerNumberModel(x.getMaxValue(), x.getMinValue(), x.getMaxValue(), 1.0));
}
try{
spinnerFromY.setModel(new SpinnerNumberModel(Math.max(y.getMinValue(),(Double)spinnerFromY.getValue()), y.getMinValue(), y.getMaxValue(), 1.0));
spinnerToY.setModel(new SpinnerNumberModel(Math.min(y.getMaxValue(),(Double)spinnerToY.getValue()), y.getMinValue(), y.getMaxValue(), 1.0));
} catch (Exception ex){
spinnerFromY.setModel(new SpinnerNumberModel(y.getMinValue(), y.getMinValue(), y.getMaxValue(), 1.0));
spinnerToY.setModel(new SpinnerNumberModel(y.getMaxValue(), y.getMinValue(), y.getMaxValue(), 1.0));
}
}//GEN-LAST:event_ckDummyActionPerformed
// 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.JCheckBox checkZigzag;
private javax.swing.JCheckBox ckDummy;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
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.JLabel jLabel9;
private ch.psi.pshell.swing.MotorReadoutPanel motorPanelX;
private ch.psi.pshell.swing.MotorReadoutPanel motorPanelY;
private javax.swing.JPanel panelPositioners;
private javax.swing.JPanel panelScan;
private javax.swing.JPanel panelSensors;
private javax.swing.JRadioButton radioStepSize;
private javax.swing.JRadioButton radioSteps;
private javax.swing.JSpinner spinnerFromX;
private javax.swing.JSpinner spinnerFromY;
private javax.swing.JSpinner spinnerStepSizeX;
private javax.swing.JSpinner spinnerStepSizeY;
private javax.swing.JSpinner spinnerStepsX;
private javax.swing.JSpinner spinnerStepsY;
private javax.swing.JSpinner spinnerToX;
private javax.swing.JSpinner spinnerToY;
// End of variables declaration//GEN-END:variables
}