/* * 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.swing.DevicePanel; import ch.psi.pshell.swing.DeviceValueChart; 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.awt.Dimension; import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; 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; import javax.swing.JDialog; import javax.swing.JFrame; /** * */ 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 ret = (List) ((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) ((Plugin)this).eval("WireScanner.ScanType", true); for (String scan: ret){ model.addElement(scan); } comboScanType.setModel(model); comboWireScannerActionPerformed(null); ret = (List) ((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) ((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); checkSaveRaw.setEnabled(state==State.Ready); 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()); updateRawButtons(); } void updateRawButtons(){ boolean validWireScan = isValidScanner(); Object sel = comboBlm1.getSelectedItem(); buttonRaw1.setEnabled(validWireScan && (sel!=null) && (!sel.toString().isEmpty())); sel = comboBlm2.getSelectedItem(); buttonRaw2.setEnabled(validWireScan && (sel!=null) && (!sel.toString().isEmpty())); sel = comboBlm3.getSelectedItem(); buttonRaw3.setEnabled(validWireScan && (sel!=null) && (!sel.toString().isEmpty())); } @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 pos = (List)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(""); } void showBlmRawData(String blm){ try { if ((blm==null) || (blm.isEmpty())){ return; } String channel = blm + ":LOSS_SIGNAL_RAW"; Device dev = Epics.newChannelDevice(channel, channel, null); //dev.setPolling(1000); dev.setMonitored(true); dev.initialize(); DeviceValueChart chart = new DeviceValueChart(); JDialog dlg = SwingUtils.showDialog((Window)this.getTopLevel(), blm, new Dimension(600,400), chart); chart = null; chart.setDevice(dev); dlg.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { try { dev.close(); } catch (Exception ex) { Logger.getLogger(WireScan.class.getName()).log(Level.WARNING, null, ex); } } }); } catch (Exception ex) { showException(ex); } } @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { plot = new ch.psi.pshell.plot.LinePlotJFree(); panelLeft = new javax.swing.JPanel(); buttonRaw1 = new javax.swing.JButton(); labelPosY = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); buttonScan = new javax.swing.JButton(); ledHomed = new ch.psi.pshell.swing.Led(); comboScanType = new javax.swing.JComboBox(); spinnerCycles = new javax.swing.JSpinner(); panelPosition1 = new ch.psi.pshell.swing.DeviceValuePanel(); labelEndY = new javax.swing.JLabel(); comboBlm1 = new javax.swing.JComboBox(); jLabel7 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); buttonMoveStart = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); spinnerStartY = new javax.swing.JSpinner(); buttonParkAll = new javax.swing.JButton(); panelStatus = new ch.psi.pshell.swing.DeviceValuePanel(); buttonPark = new javax.swing.JButton(); panelPosition = new ch.psi.pshell.swing.DeviceValuePanel(); comboBlm2 = new javax.swing.JComboBox(); comboBpm3 = new javax.swing.JComboBox(); spinnerVel = new javax.swing.JSpinner(); buttonRaw2 = new javax.swing.JButton(); comboBlm3 = new javax.swing.JComboBox(); comboWireScanner = new javax.swing.JComboBox(); jLabel15 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); checkSaveRaw = new javax.swing.JCheckBox(); jLabel20 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); spinnerEndY = new javax.swing.JSpinner(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); spinnerStartX = new javax.swing.JSpinner(); jLabel13 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); buttonMotorPanel = new javax.swing.JButton(); labelPosX = new javax.swing.JLabel(); spinnerBackground = new javax.swing.JSpinner(); buttonHoming = new javax.swing.JButton(); jLabel10 = new javax.swing.JLabel(); comboBpm1 = new javax.swing.JComboBox(); jLabel3 = new javax.swing.JLabel(); comboBpm2 = new javax.swing.JComboBox(); buttonAbort = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); labelStartY = new javax.swing.JLabel(); spinnerEndX = new javax.swing.JSpinner(); buttonRaw3 = new javax.swing.JButton(); jLabel18 = new javax.swing.JLabel(); buttonScannerPanel = new javax.swing.JButton(); plot.setTitle(""); buttonRaw1.setText("Raw Signal"); buttonRaw1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonRaw1ActionPerformed(evt); } }); labelPosY.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); labelPosY.setBorder(javax.swing.BorderFactory.createTitledBorder("")); jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel14.setText("Pos y (µm):"); jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel8.setText("Vel (µm/s):"); buttonScan.setText("Scan"); buttonScan.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonScanActionPerformed(evt); } }); ledHomed.setForeground(java.awt.Color.darkGray); ledHomed.setLedSize(18); comboScanType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboScanTypeActionPerformed(evt); } }); spinnerCycles.setModel(new javax.swing.SpinnerNumberModel(1, 1, 100, 1)); labelEndY.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); labelEndY.setText("End Y (µm):"); comboBlm1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboBlm1ActionPerformed(evt); } }); jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel7.setText("End X (µm):"); jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel9.setText("Cycles:"); buttonMoveStart.setText("Go to Start"); buttonMoveStart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonMoveStartActionPerformed(evt); } }); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel4.setText("BPM 2:"); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel2.setText("Scan Type:"); spinnerStartY.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d)); buttonParkAll.setText("ParkAll"); buttonParkAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonParkAllActionPerformed(evt); } }); buttonPark.setText("Garage"); buttonPark.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonParkActionPerformed(evt); } }); comboBlm2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboBlm2ActionPerformed(evt); } }); spinnerVel.setModel(new javax.swing.SpinnerNumberModel(200.0d, 1.0d, 10000.0d, 1.0d)); buttonRaw2.setText("Raw Signal"); buttonRaw2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonRaw2ActionPerformed(evt); } }); comboBlm3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboBlm3ActionPerformed(evt); } }); comboWireScanner.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comboWireScannerActionPerformed(evt); } }); jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel15.setText("Trigger(Hz):"); jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel19.setText("Background:"); checkSaveRaw.setText("Save Raw Signal"); jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel20.setText("Wire Scanner:"); jLabel12.setText("Homed:"); jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel5.setText("BPM 3:"); spinnerEndY.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d)); jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel16.setText("BLM 3:"); jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel17.setText("BLM 2:"); spinnerStartX.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d)); jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel13.setText("Pos x (µm):"); 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); } }); labelPosX.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); labelPosX.setBorder(javax.swing.BorderFactory.createTitledBorder("")); spinnerBackground.setModel(new javax.swing.SpinnerNumberModel(50, 0, 1000, 1)); buttonHoming.setText("Homing"); buttonHoming.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonHomingActionPerformed(evt); } }); jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel10.setText("Scan status:"); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel3.setText("BPM 1:"); buttonAbort.setText("Abort"); buttonAbort.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonAbortActionPerformed(evt); } }); jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel6.setText("Start X (µm):"); labelStartY.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); labelStartY.setText("Start Y (µm):"); spinnerEndX.setModel(new javax.swing.SpinnerNumberModel(1000.0d, -10000.0d, 10000.0d, 1.0d)); buttonRaw3.setText("Raw Signal"); buttonRaw3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonRaw3ActionPerformed(evt); } }); jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); jLabel18.setText("BLM 1:"); buttonScannerPanel.setText("Scanner Panel"); buttonScannerPanel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { buttonScannerPanelActionPerformed(evt); } }); javax.swing.GroupLayout panelLeftLayout = new javax.swing.GroupLayout(panelLeft); panelLeft.setLayout(panelLeftLayout); panelLeftLayout.setHorizontalGroup( panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelLeftLayout.createSequentialGroup() .addGap(0, 0, 0) .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelLeftLayout.createSequentialGroup() .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, 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(labelStartY, 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(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelLeftLayout.createSequentialGroup() .addGroup(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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))) .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) .addGroup(panelLeftLayout.createSequentialGroup() .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(spinnerStartY) .addComponent(panelStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 16, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelLeftLayout.createSequentialGroup() .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(panelLeftLayout.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(panelLeftLayout.createSequentialGroup() .addComponent(spinnerStartX) .addGap(18, 18, Short.MAX_VALUE) .addComponent(jLabel7)) .addGroup(panelLeftLayout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel19) .addComponent(labelEndY)))) .addGap(8, 8, 8) .addGroup(panelLeftLayout.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(panelLeftLayout.createSequentialGroup() .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(comboBlm3, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(comboBlm2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(comboBlm1, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buttonRaw1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(buttonRaw2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(buttonRaw3, javax.swing.GroupLayout.Alignment.TRAILING))))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelLeftLayout.createSequentialGroup() .addComponent(buttonPark) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonParkAll) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonMoveStart)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelLeftLayout.createSequentialGroup() .addComponent(buttonScan) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(checkSaveRaw) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonAbort))) .addGap(0, 0, 0)) ); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel10, jLabel11, jLabel13, jLabel14, jLabel15, jLabel16, jLabel17, jLabel18, jLabel2, jLabel20, jLabel3, jLabel4, jLabel5, jLabel6, jLabel7, jLabel8, jLabel9, labelEndY, labelStartY}); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonMoveStart, buttonPark, buttonParkAll, buttonScan}); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonMotorPanel, buttonScannerPanel}); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition, panelPosition1}); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerBackground, spinnerCycles, spinnerEndX, spinnerEndY}); panelLeftLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerStartX, spinnerStartY, spinnerVel}); panelLeftLayout.setVerticalGroup( panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelLeftLayout.createSequentialGroup() .addGap(0, 0, 0) .addGroup(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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) .addComponent(buttonRaw1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelLeftLayout.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) .addComponent(buttonRaw2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelLeftLayout.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) .addComponent(buttonRaw3)) .addGap(18, 18, Short.MAX_VALUE) .addGroup(panelLeftLayout.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(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel13) .addComponent(labelPosX) .addComponent(buttonMotorPanel)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel14) .addComponent(labelPosY)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.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(panelLeftLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(buttonAbort) .addComponent(buttonScan) .addComponent(checkSaveRaw)) .addGap(0, 0, 0)) ); panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {labelPosX, labelPosY, panelPosition}); panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerStartX, spinnerStartY, spinnerVel}); panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerCycles, spinnerEndX, spinnerEndY}); panelLeftLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {panelPosition1, panelStatus}); 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(panelLeft, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE) .addGap(11, 11, 11)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panelLeft, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); }// //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 ret = (List) ((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) ((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); parameters.add(checkSaveRaw.isSelected()); 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()!=null && (!cb.getSelectedItem().toString().isEmpty())){ bpms.add(cb.getSelectedItem().toString()); } } parameters.add(bpms); ArrayList blms = new ArrayList(); for (JComboBox cb : blmCombos){ if ((cb.getSelectedItem()!=null) && (!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); ex.printStackTrace(); } }//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"; String caqtdm = "caqtdm -noMsg -stylefile sfop.qss"; 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 private void buttonRaw1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRaw1ActionPerformed showBlmRawData(comboBlm1.getSelectedItem().toString()); }//GEN-LAST:event_buttonRaw1ActionPerformed private void buttonRaw2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRaw2ActionPerformed showBlmRawData(comboBlm2.getSelectedItem().toString()); }//GEN-LAST:event_buttonRaw2ActionPerformed private void buttonRaw3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRaw3ActionPerformed showBlmRawData(comboBlm3.getSelectedItem().toString()); }//GEN-LAST:event_buttonRaw3ActionPerformed private void comboBlm1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBlm1ActionPerformed updateRawButtons(); }//GEN-LAST:event_comboBlm1ActionPerformed private void comboBlm3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBlm3ActionPerformed updateRawButtons(); }//GEN-LAST:event_comboBlm3ActionPerformed private void comboBlm2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBlm2ActionPerformed updateRawButtons(); }//GEN-LAST:event_comboBlm2ActionPerformed // 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 buttonRaw1; private javax.swing.JButton buttonRaw2; private javax.swing.JButton buttonRaw3; private javax.swing.JButton buttonScan; private javax.swing.JButton buttonScannerPanel; private javax.swing.JCheckBox checkSaveRaw; 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 javax.swing.JPanel panelLeft; 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 }