991 lines
52 KiB
Java
991 lines
52 KiB
Java
/*
|
|
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
|
|
*/
|
|
|
|
import ch.psi.pshell.device.Device;
|
|
import ch.psi.pshell.device.DeviceAdapter;
|
|
import ch.psi.pshell.epics.ChannelDouble;
|
|
import ch.psi.pshell.epics.ChannelInteger;
|
|
import ch.psi.pshell.epics.Epics;
|
|
import ch.psi.pshell.ui.App;
|
|
import ch.psi.pshell.ui.Panel;
|
|
import ch.psi.pshell.ui.Plugin;
|
|
import ch.psi.utils.Convert;
|
|
import ch.psi.utils.State;
|
|
import ch.psi.utils.swing.SwingUtils;
|
|
import java.awt.Color;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import javax.swing.DefaultComboBoxModel;
|
|
import javax.swing.JComboBox;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
public class WireScan extends Panel {
|
|
final JComboBox[] bpmCombos;
|
|
final JComboBox[] blmCombos;
|
|
boolean homed;
|
|
boolean parked;
|
|
String currentScannner;
|
|
|
|
public WireScan() {
|
|
initComponents();
|
|
bpmCombos = new JComboBox[]{comboBpm1, comboBpm2, comboBpm3};
|
|
blmCombos = new JComboBox[]{comboBlm1, comboBlm2, comboBlm3};
|
|
}
|
|
|
|
//Overridable callbacks
|
|
@Override
|
|
public void onInitialize(int runCount) {
|
|
try {
|
|
startTimer(1000, 10);
|
|
|
|
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
|
eval("run('Devices/Elements')", true);
|
|
model.addElement("");
|
|
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scanners()", true);
|
|
for (String scan: ret){
|
|
model.addElement(scan);
|
|
}
|
|
comboWireScanner.setModel(model);
|
|
eval("run('Devices/WireScanner')", true);
|
|
model = new DefaultComboBoxModel();
|
|
ret = (List<String>) ((Plugin)this).eval("WireScanner.ScanType", true);
|
|
for (String scan: ret){
|
|
model.addElement(scan);
|
|
}
|
|
comboScanType.setModel(model);
|
|
comboWireScannerActionPerformed(null);
|
|
|
|
|
|
ret = (List<String>) ((Plugin)this).eval("get_bpms()", true);
|
|
for (JComboBox cb : bpmCombos){
|
|
model = new DefaultComboBoxModel();
|
|
model.addElement("");
|
|
for (String scan: ret){
|
|
model.addElement(scan);
|
|
}
|
|
cb.setModel(model);
|
|
}
|
|
|
|
ret = (List<String>) ((Plugin)this).eval("get_blms()", true);
|
|
for (JComboBox cb : blmCombos){
|
|
model = new DefaultComboBoxModel();
|
|
model.addElement("");
|
|
for (String scan: ret){
|
|
model.addElement(scan);
|
|
}
|
|
cb.setModel(model);
|
|
}
|
|
|
|
if (App.hasArgument("ws")){
|
|
comboWireScanner.setSelectedItem(App.getArgumentValue("ws"));
|
|
}
|
|
comboWireScannerActionPerformed(null);
|
|
|
|
Device dev = new ChannelInteger (null, "SIN-TIMAST-TMA:Evt-15-Freq-I");
|
|
dev.setMonitored(true);
|
|
dev.initialize();
|
|
panelPosition1.setDevice(dev);
|
|
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onStart() {
|
|
super.onStart();
|
|
}
|
|
|
|
@Override
|
|
public void onStop() {
|
|
try {
|
|
closeDevices();
|
|
} catch (Exception ex) {
|
|
Logger.getLogger(WireScan.class.getName()).log(Level.WARNING, null, ex);
|
|
}
|
|
super.onStop();
|
|
}
|
|
|
|
|
|
@Override
|
|
protected void onTimer(){
|
|
try{
|
|
if (isValidScanner()){
|
|
homed = (Epics.get(currentScannner + ":MOTOR_1_HOMED", Integer.class) == 1);
|
|
if (homed){
|
|
ledHomed.setColor(Color.GREEN);
|
|
} else if (Epics.get(currentScannner + ":MOTOR_1_HOMING", Integer.class) == 1){
|
|
ledHomed.setColor(Color.YELLOW);
|
|
} else {
|
|
ledHomed.setColor(Color.RED);
|
|
}
|
|
} else {
|
|
ledHomed.setColor(Color.darkGray);
|
|
homed = false;
|
|
}
|
|
onStateChange(getState(), getState());
|
|
} catch (Exception ex){
|
|
}
|
|
}
|
|
//S20CB01-DWSC440:MOTOR_1_HOME.PROC
|
|
@Override
|
|
public void onStateChange(State state, State former) {
|
|
boolean validWireScan = isValidScanner();
|
|
buttonMoveStart.setEnabled((state==State.Ready) && validWireScan && homed);
|
|
buttonPark.setEnabled((state==State.Ready) && validWireScan && homed);
|
|
buttonParkAll.setEnabled(state==State.Ready);
|
|
buttonScan.setEnabled((state==State.Ready) && validWireScan && homed);
|
|
buttonAbort.setEnabled(state==State.Busy);
|
|
comboScanType.setEnabled(validWireScan);
|
|
for (JComboBox cb : bpmCombos){
|
|
cb.setEnabled(validWireScan && !isBackground());
|
|
}
|
|
for (JComboBox cb : blmCombos){
|
|
cb.setEnabled(validWireScan);
|
|
}
|
|
buttonMotorPanel.setEnabled(validWireScan);
|
|
buttonScannerPanel.setEnabled(validWireScan);
|
|
buttonHoming.setEnabled(validWireScan);
|
|
spinnerVel.setEnabled(validWireScan && !isBackground());
|
|
spinnerCycles.setEnabled(validWireScan && !isBackground());
|
|
spinnerStartX.setEnabled(validWireScan && isX());
|
|
spinnerEndX.setEnabled(spinnerStartX.isEnabled());
|
|
spinnerStartY.setEnabled(validWireScan && isY());
|
|
spinnerEndY.setEnabled(spinnerStartY.isEnabled());
|
|
}
|
|
|
|
@Override
|
|
public void onExecutedFile(String fileName, Object result) {
|
|
}
|
|
|
|
|
|
//Callback to perform update - in event thread
|
|
@Override
|
|
protected void doUpdate() {
|
|
}
|
|
|
|
boolean isValidScanner(){
|
|
return (currentScannner!=null) && (!currentScannner.isEmpty());
|
|
}
|
|
|
|
void closeDevices() throws Exception{
|
|
if ((currentScannner!=null) && (!currentScannner.isEmpty())){
|
|
try{
|
|
if (panelStatus.getDevice()!=null){
|
|
panelStatus.getDevice().close();
|
|
panelStatus.setDevice(null);
|
|
}
|
|
if (panelPosition.getDevice()!=null){
|
|
panelPosition.getDevice().close();
|
|
panelPosition.setDevice(null);
|
|
}
|
|
labelPosX.setText("");
|
|
labelPosY.setText("");
|
|
boolean moved = Epics.get(currentScannner + ":WIRE_SP", Integer.class) != 0;
|
|
if (parked && moved){
|
|
System.out.println("Parking scanner");
|
|
Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1);
|
|
Epics.putq(currentScannner + ":INIT.PROC", 1);
|
|
}
|
|
} catch (Exception ex){
|
|
ex.printStackTrace();
|
|
throw ex;
|
|
} finally{
|
|
currentScannner = "" ;
|
|
}
|
|
}
|
|
}
|
|
|
|
int getWireSet(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 0: case 1: case 4:
|
|
return 1;
|
|
case 2: case 3: case 5:
|
|
return 2;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
boolean isSet(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 4: case 5:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean isSet1(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 0: case 1: case 4:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean isX(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 0: case 2: case 4: case 5:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean isY(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 1: case 3: case 4: case 5:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
boolean isBackground(){
|
|
switch (comboScanType.getSelectedIndex()){
|
|
case 6: case 7:
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
void updatePosition(Double value){
|
|
if (value!=null && !Double.isNaN((Double)value)){
|
|
try {
|
|
List<Double> pos = (List<Double>)eval("get_wire_pos(scanner_info, " + value + ")", true);
|
|
int offset = (getWireSet()-1) *2;
|
|
labelPosX.setText(String.valueOf(Convert.roundDouble(pos.get(0 + offset),1)));
|
|
labelPosY.setText(String.valueOf(Convert.roundDouble(pos.get(1 + offset),1)));
|
|
return;
|
|
} catch (Exception ex) {
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
labelPosX.setText("");
|
|
labelPosY.setText("");
|
|
}
|
|
|
|
@SuppressWarnings("unchecked")
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
private void initComponents() {
|
|
|
|
comboWireScanner = new javax.swing.JComboBox();
|
|
jLabel2 = new javax.swing.JLabel();
|
|
comboScanType = new javax.swing.JComboBox();
|
|
jLabel3 = new javax.swing.JLabel();
|
|
jLabel4 = new javax.swing.JLabel();
|
|
jLabel5 = new javax.swing.JLabel();
|
|
comboBpm3 = new javax.swing.JComboBox();
|
|
jLabel6 = new javax.swing.JLabel();
|
|
jLabel7 = new javax.swing.JLabel();
|
|
jLabel8 = new javax.swing.JLabel();
|
|
jLabel9 = new javax.swing.JLabel();
|
|
jLabel10 = new javax.swing.JLabel();
|
|
buttonScan = new javax.swing.JButton();
|
|
buttonAbort = new javax.swing.JButton();
|
|
buttonMoveStart = new javax.swing.JButton();
|
|
spinnerStartX = new javax.swing.JSpinner();
|
|
spinnerEndX = new javax.swing.JSpinner();
|
|
spinnerVel = new javax.swing.JSpinner();
|
|
spinnerCycles = new javax.swing.JSpinner();
|
|
panelStatus = new ch.psi.pshell.swing.DeviceValuePanel();
|
|
plot = new ch.psi.pshell.plot.LinePlotJFree();
|
|
comboBpm1 = new javax.swing.JComboBox();
|
|
comboBpm2 = new javax.swing.JComboBox();
|
|
buttonPark = new javax.swing.JButton();
|
|
jLabel11 = new javax.swing.JLabel();
|
|
panelPosition = new ch.psi.pshell.swing.DeviceValuePanel();
|
|
buttonMotorPanel = new javax.swing.JButton();
|
|
buttonScannerPanel = new javax.swing.JButton();
|
|
jLabel12 = new javax.swing.JLabel();
|
|
ledHomed = new ch.psi.pshell.swing.Led();
|
|
buttonHoming = new javax.swing.JButton();
|
|
jLabel13 = new javax.swing.JLabel();
|
|
jLabel14 = new javax.swing.JLabel();
|
|
labelPosX = new javax.swing.JLabel();
|
|
labelPosY = new javax.swing.JLabel();
|
|
labelStartY = new javax.swing.JLabel();
|
|
spinnerStartY = new javax.swing.JSpinner();
|
|
labelEndY = new javax.swing.JLabel();
|
|
spinnerEndY = new javax.swing.JSpinner();
|
|
jLabel15 = new javax.swing.JLabel();
|
|
panelPosition1 = new ch.psi.pshell.swing.DeviceValuePanel();
|
|
jLabel16 = new javax.swing.JLabel();
|
|
comboBlm3 = new javax.swing.JComboBox();
|
|
jLabel17 = new javax.swing.JLabel();
|
|
comboBlm2 = new javax.swing.JComboBox();
|
|
comboBlm1 = new javax.swing.JComboBox();
|
|
jLabel18 = new javax.swing.JLabel();
|
|
jLabel19 = new javax.swing.JLabel();
|
|
spinnerBackground = new javax.swing.JSpinner();
|
|
jLabel20 = new javax.swing.JLabel();
|
|
buttonParkAll = new javax.swing.JButton();
|
|
|
|
comboWireScanner.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
comboWireScannerActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel2.setText("Scan Type:");
|
|
|
|
comboScanType.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
comboScanTypeActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel3.setText("BPM 1:");
|
|
|
|
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel4.setText("BPM 2:");
|
|
|
|
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel5.setText("BPM 3:");
|
|
|
|
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel6.setText("Start X (µm):");
|
|
|
|
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel7.setText("End X (µm):");
|
|
|
|
jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel8.setText("Vel (µm/s):");
|
|
|
|
jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel9.setText("Cycles:");
|
|
|
|
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel10.setText("Scan status:");
|
|
|
|
buttonScan.setText("Scan");
|
|
buttonScan.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonScanActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonAbort.setText("Abort");
|
|
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonAbortActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonMoveStart.setText("Go to Start");
|
|
buttonMoveStart.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonMoveStartActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
spinnerStartX.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
|
|
|
spinnerEndX.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
|
|
|
spinnerVel.setModel(new javax.swing.SpinnerNumberModel(200.0d, 1.0d, 10000.0d, 1.0d));
|
|
|
|
spinnerCycles.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1));
|
|
|
|
plot.setTitle("");
|
|
|
|
buttonPark.setText("Garage");
|
|
buttonPark.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonParkActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel11.setText("Pos mot (µm):");
|
|
|
|
buttonMotorPanel.setText("Motor Panel");
|
|
buttonMotorPanel.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonMotorPanelActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
buttonScannerPanel.setText("Scanner Panel");
|
|
buttonScannerPanel.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonScannerPanelActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel12.setText("Homed:");
|
|
|
|
ledHomed.setForeground(java.awt.Color.darkGray);
|
|
ledHomed.setLedSize(18);
|
|
|
|
buttonHoming.setText("Homing");
|
|
buttonHoming.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonHomingActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel13.setText("Pos x (µm):");
|
|
|
|
jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel14.setText("Pos y (µm):");
|
|
|
|
labelPosX.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
labelPosX.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
|
|
|
|
labelPosY.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
labelPosY.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
|
|
|
|
labelStartY.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
labelStartY.setText("Start Y (µm):");
|
|
|
|
spinnerStartY.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
|
|
|
labelEndY.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
labelEndY.setText("End Y (µm):");
|
|
|
|
spinnerEndY.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d));
|
|
|
|
jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel15.setText("Trigger(Hz):");
|
|
|
|
jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel16.setText("BLM 3:");
|
|
|
|
jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel17.setText("BLM 2:");
|
|
|
|
jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel18.setText("BLM 1:");
|
|
|
|
jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel19.setText("Background:");
|
|
|
|
spinnerBackground.setModel(new javax.swing.SpinnerNumberModel(50, 0, 1000, 1));
|
|
|
|
jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
|
jLabel20.setText("Wire Scanner:");
|
|
|
|
buttonParkAll.setText("ParkAll");
|
|
buttonParkAll.addActionListener(new java.awt.event.ActionListener() {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
buttonParkAllActionPerformed(evt);
|
|
}
|
|
});
|
|
|
|
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.LEADING, false)
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
.addComponent(buttonScan)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonAbort))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(jLabel15)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(jLabel11)
|
|
.addComponent(jLabel13)
|
|
.addComponent(jLabel14)))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelPosX, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelPosY, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addComponent(jLabel12)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(buttonHoming, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonScannerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(buttonMotorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(labelStartY, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel20, 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)
|
|
.addComponent(comboWireScanner, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboScanType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBpm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBpm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBpm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBlm3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBlm2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(comboBlm1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(spinnerStartY)
|
|
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(0, 0, Short.MAX_VALUE))
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addComponent(jLabel9))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(spinnerStartX)
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addComponent(jLabel7))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGap(0, 0, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(jLabel19)
|
|
.addComponent(labelEndY))))
|
|
.addGap(8, 8, 8)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addComponent(spinnerEndX, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(spinnerEndY, javax.swing.GroupLayout.Alignment.TRAILING)
|
|
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerCycles, javax.swing.GroupLayout.Alignment.TRAILING)))))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(jLabel8)
|
|
.addGap(154, 154, 154))
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addComponent(buttonPark)
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addComponent(buttonParkAll)
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addComponent(buttonMoveStart)
|
|
.addGap(0, 0, 0)))
|
|
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
|
|
.addGap(11, 11, 11))
|
|
);
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonParkAll, buttonScan});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition, panelPosition1});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBackground, spinnerCycles, spinnerEndX, spinnerEndY});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerStartX, spinnerStartY, spinnerVel});
|
|
|
|
layout.setVerticalGroup(
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addContainerGap()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createSequentialGroup()
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(comboWireScanner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel20))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(comboScanType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel2))
|
|
.addGap(18, 18, 18)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel8)
|
|
.addComponent(spinnerCycles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel9)
|
|
.addComponent(spinnerVel, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(spinnerBackground, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel19))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel6)
|
|
.addComponent(jLabel7)
|
|
.addComponent(spinnerEndX, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(spinnerStartX, 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(spinnerStartY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelEndY)
|
|
.addComponent(spinnerEndY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(labelStartY))
|
|
.addGap(18, 18, 18)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel3)
|
|
.addComponent(comboBpm1, 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(comboBpm2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel4))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(comboBpm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel5))
|
|
.addGap(18, 18, 18)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(jLabel18)
|
|
.addComponent(comboBlm1, 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(comboBlm2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel17))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(comboBlm3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel16))
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel11)
|
|
.addComponent(panelPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(buttonScannerPanel))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel13)
|
|
.addComponent(labelPosX)
|
|
.addComponent(buttonMotorPanel))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel14)
|
|
.addComponent(labelPosY))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel15)
|
|
.addComponent(panelPosition1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(jLabel12)
|
|
.addComponent(ledHomed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
.addComponent(buttonHoming))
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
|
.addComponent(jLabel10)
|
|
.addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
.addGap(18, 18, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(buttonPark)
|
|
.addComponent(buttonMoveStart)
|
|
.addComponent(buttonParkAll))
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
.addComponent(buttonAbort)
|
|
.addComponent(buttonScan)))
|
|
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
.addContainerGap())
|
|
);
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerStartX, spinnerStartY, spinnerVel});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerCycles, spinnerEndX, spinnerEndY});
|
|
|
|
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {panelPosition1, panelStatus});
|
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
private void comboWireScannerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboWireScannerActionPerformed
|
|
try {
|
|
closeDevices();
|
|
ledHomed.setColor(Color.darkGray);
|
|
homed = false;
|
|
parked = false;
|
|
currentScannner = comboWireScanner.getSelectedItem().toString();
|
|
|
|
if (currentScannner.isEmpty()){
|
|
for (JComboBox cb : bpmCombos){
|
|
cb.setSelectedItem("");
|
|
}
|
|
for (JComboBox cb : blmCombos){
|
|
cb.setSelectedItem("");
|
|
}
|
|
} else {
|
|
List<String> ret = (List<String>) ((Plugin)this).eval("get_wire_scanners_bpms('" + currentScannner + "')", true);
|
|
comboBpm1.setSelectedItem((ret==null) ? "" : ret.get(0));
|
|
comboBpm2.setSelectedItem((ret==null) ? "" : ret.get(1));
|
|
ret = (List<String>) ((Plugin)this).eval("get_wire_scanners_blms('" + currentScannner + "')", true);
|
|
comboBlm1.setSelectedItem((ret==null) ? "" : ret.get(0));
|
|
comboBlm2.setSelectedItem((ret==null) ? "" : ret.get(1));
|
|
int selection = Epics.get(currentScannner + ":WIRE_SP", Integer.class);
|
|
//comboSelection.setSelectedIndex(selection); //TODO: FIX
|
|
spinnerVel.setValue(Epics.get(currentScannner + ":SCAN_VELO_SP", Double.class));
|
|
spinnerCycles.setValue(Epics.get(currentScannner + ":NB_CYCL_SP", Integer.class));
|
|
Device scannerInfo = (Device)eval("new_scan_info_device(None, '" + currentScannner+ "')", true);
|
|
setGlobalVar("scanner_info", scannerInfo);
|
|
panelStatus.setDevice(scannerInfo);
|
|
Device dev = new ChannelDouble (null, currentScannner + ":ENC_1_BS", 3);
|
|
dev.setMonitored(true);
|
|
dev.addListener(new DeviceAdapter() {
|
|
@Override
|
|
public void onValueChanged(Device device, Object value, Object former) {
|
|
updatePosition((Double)value);
|
|
}
|
|
});
|
|
dev.initialize();
|
|
panelPosition.setDevice(dev);
|
|
parked = (selection== 0);
|
|
comboScanTypeActionPerformed(null);
|
|
}
|
|
} catch (Exception ex) {
|
|
try {
|
|
closeDevices();
|
|
} catch (Exception ex1) {
|
|
Logger.getLogger(WireScan.class.getName()).log(Level.SEVERE, null, ex1);
|
|
}
|
|
showException(ex);
|
|
comboWireScanner.setSelectedItem("");
|
|
for (JComboBox cb : bpmCombos){
|
|
cb.setSelectedItem("");
|
|
}
|
|
for (JComboBox cb : blmCombos){
|
|
cb.setSelectedItem("");
|
|
}
|
|
}
|
|
onStateChange(getState(), getState());
|
|
}//GEN-LAST:event_comboWireScannerActionPerformed
|
|
|
|
private void comboScanTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboScanTypeActionPerformed
|
|
try {
|
|
if (!isBackground()){
|
|
boolean set1 = isSet1();
|
|
spinnerStartX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_START_SP", Double.class));
|
|
spinnerEndX.setValue(Epics.get(currentScannner + (set1 ? ":W1X" : ":W2X") + "_END_SP", Double.class));
|
|
spinnerStartY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_START_SP", Double.class));
|
|
spinnerEndY.setValue(Epics.get(currentScannner + (set1 ? ":W1Y" : ":W2Y") + "_END_SP", Double.class));
|
|
}
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
try {
|
|
updatePosition((Double) panelPosition.getDevice().take());
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
onStateChange(getState(), getState());
|
|
}//GEN-LAST:event_comboScanTypeActionPerformed
|
|
|
|
private void buttonScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanActionPerformed
|
|
try {
|
|
ArrayList parameters = new ArrayList();
|
|
System.out.println("Background: " + isBackground());
|
|
if (isBackground()){
|
|
parameters.add(currentScannner);
|
|
parameters.add(comboScanType.getSelectedItem().toString());
|
|
ArrayList blms = new ArrayList();
|
|
for (JComboBox cb : blmCombos){
|
|
if (!cb.getSelectedItem().toString().isEmpty()){
|
|
blms.add(cb.getSelectedItem().toString());
|
|
}
|
|
}
|
|
parameters.add(blms);
|
|
parameters.add(spinnerBackground.getValue());
|
|
parameters.add(plot);
|
|
runAsync("Diagnostics/WireScanBackground", parameters).handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
getLogger().info("Exception executing scan: " + ex);
|
|
showException((Exception) ex);
|
|
}
|
|
return ret;
|
|
});
|
|
} else {
|
|
parameters.add(currentScannner);
|
|
parameters.add(comboScanType.getSelectedItem().toString());
|
|
ArrayList range = new ArrayList();
|
|
range.add(spinnerStartX.getValue());
|
|
range.add(spinnerEndX.getValue());
|
|
range.add(spinnerStartY.getValue());
|
|
range.add(spinnerEndY.getValue());
|
|
parameters.add(range);
|
|
parameters.add(spinnerCycles.getValue());
|
|
parameters.add(spinnerVel.getValue());
|
|
ArrayList bpms = new ArrayList();
|
|
for (JComboBox cb : bpmCombos){
|
|
if (!cb.getSelectedItem().toString().isEmpty()){
|
|
bpms.add(cb.getSelectedItem().toString());
|
|
}
|
|
}
|
|
parameters.add(bpms);
|
|
ArrayList blms = new ArrayList();
|
|
for (JComboBox cb : blmCombos){
|
|
if (!cb.getSelectedItem().toString().isEmpty()){
|
|
blms.add(cb.getSelectedItem().toString());
|
|
}
|
|
}
|
|
parameters.add(blms);
|
|
parameters.add(spinnerBackground.getValue());
|
|
parameters.add(plot);
|
|
|
|
runAsync("Diagnostics/WireScan", parameters).handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
getLogger().info("Exception executing scan: " + ex);
|
|
showException((Exception) ex);
|
|
} else {
|
|
//SwingUtils.showMessage(WireScan.this, "Success", "Data file: \n" + getContext().getDataManager().getLastOutput());
|
|
/*
|
|
JPanel pn = new JPanel(new BorderLayout());
|
|
((BorderLayout) pn.getLayout()).setHgap(5);
|
|
pn.add(new JLabel("Generated data file:"), BorderLayout.NORTH);
|
|
JTextField tf = new JTextField(getContext().getDataManager().getLastOutput());
|
|
tf.setPreferredSize(new Dimension(600, tf.getPreferredSize().height));
|
|
tf.setEditable(false);
|
|
pn.add(tf, BorderLayout.SOUTH);
|
|
JOptionPane.showOptionDialog(WireScan.this, pn, "Success", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null);
|
|
*/
|
|
}
|
|
return ret;
|
|
});
|
|
}
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonScanActionPerformed
|
|
|
|
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 buttonMoveStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveStartActionPerformed
|
|
try {
|
|
int type = comboScanType.getSelectedIndex();
|
|
if (isBackground()){
|
|
Epics.putq(currentScannner + ":WIRE_SP", (type==7) ? 5 : 0);
|
|
} else if (isSet1()){
|
|
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 1 : 2);
|
|
} else {
|
|
Epics.putq(currentScannner + ":WIRE_SP", isX() ? 3 : 4);
|
|
}
|
|
Epics.putq(currentScannner + ":INIT.PROC", 1);
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonMoveStartActionPerformed
|
|
|
|
private void buttonParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkActionPerformed
|
|
try {
|
|
Epics.putq(currentScannner + ":GARAGE_SEL.PROC", 1);
|
|
Epics.putq(currentScannner + ":INIT.PROC", 1);
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonParkActionPerformed
|
|
|
|
String caqtdm = "caqtdm -noMsg -stylefile sfop.qss -attach";
|
|
private void buttonMotorPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMotorPanelActionPerformed
|
|
try {
|
|
String cmd = caqtdm + " -macro 'P=" + comboWireScanner.getSelectedItem() + ":,M=MOTOR_1' /sf/common/config/qt/motorx_all.ui";
|
|
Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonMotorPanelActionPerformed
|
|
|
|
private void buttonScannerPanelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScannerPanelActionPerformed
|
|
try {
|
|
String cmd = caqtdm + " -macro 'SYS=" + comboWireScanner.getSelectedItem() + "' /sf/common/config/qt/S_DI_WSC_EXPERT.ui";
|
|
Runtime.getRuntime().exec(new String[]{"bash", "-c", cmd.toString()});
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
|
|
}//GEN-LAST:event_buttonScannerPanelActionPerformed
|
|
|
|
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
|
|
try {
|
|
Epics.putq(currentScannner + ":MOTOR_1_HOME.PROC", 1);
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonHomingActionPerformed
|
|
|
|
private void buttonParkAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonParkAllActionPerformed
|
|
try {
|
|
runAsync("Diagnostics/ParkAllWireScanners").handle((ret, ex) -> {
|
|
if (ex != null) {
|
|
getLogger().info("Exception executing scan: " + ex);
|
|
showException((Exception) ex);
|
|
} else {
|
|
SwingUtils.showMessage(getTopLevel(), "Success", "Finished parking wire scanners");
|
|
}
|
|
return ret;
|
|
});
|
|
|
|
} catch (Exception ex) {
|
|
showException(ex);
|
|
}
|
|
}//GEN-LAST:event_buttonParkAllActionPerformed
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
private javax.swing.JButton buttonAbort;
|
|
private javax.swing.JButton buttonHoming;
|
|
private javax.swing.JButton buttonMotorPanel;
|
|
private javax.swing.JButton buttonMoveStart;
|
|
private javax.swing.JButton buttonPark;
|
|
private javax.swing.JButton buttonParkAll;
|
|
private javax.swing.JButton buttonScan;
|
|
private javax.swing.JButton buttonScannerPanel;
|
|
private javax.swing.JComboBox comboBlm1;
|
|
private javax.swing.JComboBox comboBlm2;
|
|
private javax.swing.JComboBox comboBlm3;
|
|
private javax.swing.JComboBox comboBpm1;
|
|
private javax.swing.JComboBox comboBpm2;
|
|
private javax.swing.JComboBox comboBpm3;
|
|
private javax.swing.JComboBox comboScanType;
|
|
private javax.swing.JComboBox comboWireScanner;
|
|
private javax.swing.JLabel jLabel10;
|
|
private javax.swing.JLabel jLabel11;
|
|
private javax.swing.JLabel jLabel12;
|
|
private javax.swing.JLabel jLabel13;
|
|
private javax.swing.JLabel jLabel14;
|
|
private javax.swing.JLabel jLabel15;
|
|
private javax.swing.JLabel jLabel16;
|
|
private javax.swing.JLabel jLabel17;
|
|
private javax.swing.JLabel jLabel18;
|
|
private javax.swing.JLabel jLabel19;
|
|
private javax.swing.JLabel jLabel2;
|
|
private javax.swing.JLabel jLabel20;
|
|
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.JLabel jLabel9;
|
|
private javax.swing.JLabel labelEndY;
|
|
private javax.swing.JLabel labelPosX;
|
|
private javax.swing.JLabel labelPosY;
|
|
private javax.swing.JLabel labelStartY;
|
|
private ch.psi.pshell.swing.Led ledHomed;
|
|
private ch.psi.pshell.swing.DeviceValuePanel panelPosition;
|
|
private ch.psi.pshell.swing.DeviceValuePanel panelPosition1;
|
|
private ch.psi.pshell.swing.DeviceValuePanel panelStatus;
|
|
private ch.psi.pshell.plot.LinePlotJFree plot;
|
|
private javax.swing.JSpinner spinnerBackground;
|
|
private javax.swing.JSpinner spinnerCycles;
|
|
private javax.swing.JSpinner spinnerEndX;
|
|
private javax.swing.JSpinner spinnerEndY;
|
|
private javax.swing.JSpinner spinnerStartX;
|
|
private javax.swing.JSpinner spinnerStartY;
|
|
private javax.swing.JSpinner spinnerVel;
|
|
// End of variables declaration//GEN-END:variables
|
|
}
|