This commit is contained in:
boccioli_m
2016-01-13 14:54:06 +01:00
parent bb7a49941d
commit 10710c6dbf
8 changed files with 237 additions and 68 deletions

View File

@@ -1,19 +1,10 @@
import ch.psi.jcae.Channel;
import ch.psi.jcae.ChannelException;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.epics.ChannelDouble;
import ch.psi.pshell.epics.ChannelString;
import ch.psi.utils.State;
import gov.aps.jca.CAException;
import gov.aps.jca.Context;
import gov.aps.jca.JCALibrary;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JTextField;
/*
@@ -49,8 +40,8 @@ public class Kollimators extends javax.swing.JPanel {
public void animate(String deviceName) {
g_deviceName = deviceName;
jLabelDeviceName.setText(deviceName);
connectString(deviceName+":STA:2", jTextSta);
connect(deviceName+":DIST:2", jTextDist);
connectString(deviceName+":STA:2", jTextSta); //for Strings
connect(deviceName+":DIST:2", jTextDist); //for Numbers
connect(deviceName+":IST1:1", jTextIst1);
connect(deviceName+":IST2:1", jTextIst2);
connect(deviceName+":REF1:1", jTextRef1);
@@ -136,20 +127,7 @@ public class Kollimators extends javax.swing.JPanel {
System.out.println(ex.toString());
}
}
public void onStateChange(State state, State former) {
}
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
protected void doUpdate() {
}
private void monitorChannel(ChannelDouble channel, Object textField){
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@@ -177,7 +155,7 @@ public class Kollimators extends javax.swing.JPanel {
jLabel8 = new javax.swing.JLabel();
jLabelDeviceName = new javax.swing.JLabel();
jButtonReconnect = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jButtonStopMotor = new javax.swing.JButton();
jLabel1.setText("STA:");
@@ -221,11 +199,11 @@ public class Kollimators extends javax.swing.JPanel {
}
});
jButton1.setText("Stop motor");
jButton1.setToolTipText("Immediately stop the collimator motor");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButtonStopMotor.setText("Stop motor");
jButtonStopMotor.setToolTipText("Immediately stop the collimator motor");
jButtonStopMotor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
jButtonStopMotorActionPerformed(evt);
}
});
@@ -241,7 +219,7 @@ public class Kollimators extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addComponent(jButtonReconnect)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1)
.addComponent(jButtonStopMotor)
.addGap(0, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -308,7 +286,7 @@ public class Kollimators extends javax.swing.JPanel {
.addComponent(jLabel8)
.addComponent(jTextRes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButtonReconnect)
.addComponent(jButton1))
.addComponent(jButtonStopMotor))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@@ -318,15 +296,15 @@ public class Kollimators extends javax.swing.JPanel {
animate(g_deviceName);
}//GEN-LAST:event_jButtonReconnectActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
private void jButtonStopMotorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStopMotorActionPerformed
// TODO add your handling code here:
stopMotor();
}//GEN-LAST:event_jButton1ActionPerformed
}//GEN-LAST:event_jButtonStopMotorActionPerformed
// <editor-fold defaultstate="collapsed" desc="Variables declaration">
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButtonReconnect;
private javax.swing.JButton jButtonStopMotor;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;