Closedown
This commit is contained in:
@@ -24,13 +24,12 @@ import javax.swing.JPanel;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TestingPanel2 extends Panel {
|
||||
public class TestingList extends Panel {
|
||||
MotorPanel motorPanel;
|
||||
LinePlotBase plot;
|
||||
LinePlotBase plot ;
|
||||
LinePlotSeries series;
|
||||
Motor motor;
|
||||
|
||||
|
||||
|
||||
Task task = new Task() {
|
||||
@Override
|
||||
protected Object execute() throws Exception {
|
||||
@@ -45,6 +44,7 @@ public class TestingPanel2 extends Panel {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
protected JPanel create() {
|
||||
getApp().addTask(task);
|
||||
@@ -54,7 +54,7 @@ public class TestingPanel2 extends Panel {
|
||||
|
||||
@Override
|
||||
protected void onInitialize(int runCount){
|
||||
motor = (Motor) TestingPanel2.this.getDevice("motor");
|
||||
motor = (Motor) TestingList.this.getDevice("motor");
|
||||
motorPanel.setDevice(motor);
|
||||
}
|
||||
|
||||
@@ -65,15 +65,13 @@ public class TestingPanel2 extends Panel {
|
||||
motorPanel = new MotorPanel();
|
||||
panel.add(motorPanel);
|
||||
onInitialize(-1);
|
||||
|
||||
|
||||
|
||||
plot = new LinePlotJFree();
|
||||
plot.setTitle("");
|
||||
panelPlot.add(plot);
|
||||
|
||||
|
||||
plot.setTitle("bo");
|
||||
panelPlot.add(plot);
|
||||
series=new LinePlotSeries("Position");
|
||||
plot.addSeries(series);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -88,10 +86,15 @@ public class TestingPanel2 extends Panel {
|
||||
panel = new javax.swing.JPanel();
|
||||
panelPlot = new javax.swing.JPanel();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
cmTestPS = new javax.swing.JButton();
|
||||
jCheckBox1 = new javax.swing.JCheckBox();
|
||||
jButton4 = new javax.swing.JButton();
|
||||
txtTestPSRes = new javax.swing.JTextField();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
txtOutput = new javax.swing.JTextArea();
|
||||
|
||||
buttonExecute.setText("Execute");
|
||||
buttonExecute.setText("Execute test11");
|
||||
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonExecuteActionPerformed(evt);
|
||||
@@ -127,10 +130,10 @@ public class TestingPanel2 extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jButton3.setText("New Test");
|
||||
jButton3.addActionListener(new java.awt.event.ActionListener() {
|
||||
cmTestPS.setText("Test PS");
|
||||
cmTestPS.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton3ActionPerformed(evt);
|
||||
cmTestPSActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -143,6 +146,24 @@ public class TestingPanel2 extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jButton4.setText("Test LS");
|
||||
jButton4.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton4ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButton3.setText("jButton3");
|
||||
jButton3.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton3ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
txtOutput.setColumns(20);
|
||||
txtOutput.setRows(5);
|
||||
jScrollPane1.setViewportView(txtOutput);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -150,9 +171,6 @@ public class TestingPanel2 extends Panel {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(41, 41, 41)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(check)
|
||||
@@ -161,23 +179,45 @@ public class TestingPanel2 extends Panel {
|
||||
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jButton1)
|
||||
.addComponent(spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(87, 87, 87)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(87, 87, 87)
|
||||
.addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, 394, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButton3)
|
||||
.addComponent(jCheckBox1)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(cmTestPS)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtTestPSRes, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jCheckBox1)
|
||||
.addComponent(jButton4))
|
||||
.addGap(0, 0, Short.MAX_VALUE))))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(277, 277, 277)
|
||||
.addComponent(jButton2)))
|
||||
.addGap(0, 25, Short.MAX_VALUE))))
|
||||
.addComponent(jButton3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jButton2))))
|
||||
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(46, 46, 46)
|
||||
.addComponent(jCheckBox1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(cmTestPS)
|
||||
.addComponent(txtTestPSRes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton4)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(27, 27, 27)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -186,25 +226,21 @@ public class TestingPanel2 extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonAbort))
|
||||
.addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(32, 32, 32)
|
||||
.addComponent(check))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(46, 46, 46)
|
||||
.addComponent(jCheckBox1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton3)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jButton3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(check))
|
||||
.addComponent(jScrollPane1, 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(jButton1)
|
||||
.addComponent(jButton2))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
|
||||
.addGap(5, 5, 5))
|
||||
.addComponent(panelPlot, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jCheckBox1.getAccessibleContext().setAccessibleName("check2");
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
|
||||
@@ -214,12 +250,12 @@ public class TestingPanel2 extends Panel {
|
||||
|
||||
//Alternatives to run script with arguments
|
||||
|
||||
/*
|
||||
|
||||
eval("start = 22.0");
|
||||
eval("end = 32.0");
|
||||
eval("step = 10");
|
||||
run("test11");
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
HashMap args = new HashMap();
|
||||
@@ -231,7 +267,7 @@ public class TestingPanel2 extends Panel {
|
||||
|
||||
//eval("run('test11', locals = {'start':10.0, 'end':50.0, 'step':40})");
|
||||
|
||||
evalAsync("run('test11', locals = {'start':10.0, 'end':50.0, 'step':40})");
|
||||
// evalAsync("run('test11', locals = {'start':10.0, 'end':50.0, 'step':40})");
|
||||
|
||||
|
||||
} catch (Exception ex) {
|
||||
@@ -247,13 +283,12 @@ public class TestingPanel2 extends Panel {
|
||||
try {
|
||||
boolean var1 = check.isSelected();
|
||||
int var2 = (Integer)spinner.getValue();
|
||||
|
||||
int i = 0;
|
||||
HashMap args = new HashMap();
|
||||
args.put("relative", var1);
|
||||
args.put("steps", var2);
|
||||
run("args", args);
|
||||
|
||||
|
||||
|
||||
//evalAsync("run('args', locals = {'relative':" + (var1 ? "True" :"False") + ", 'steps':" + var2 + "})");
|
||||
|
||||
} catch (Exception ex) {
|
||||
@@ -264,7 +299,7 @@ public class TestingPanel2 extends Panel {
|
||||
|
||||
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
|
||||
|
||||
try {
|
||||
try {
|
||||
getApp().startTask(task);
|
||||
|
||||
task.start(TaskRunMode.async);
|
||||
@@ -289,7 +324,34 @@ public class TestingPanel2 extends Panel {
|
||||
|
||||
}//GEN-LAST:event_jButton2ActionPerformed
|
||||
|
||||
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
|
||||
private void cmTestPSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmTestPSActionPerformed
|
||||
try {
|
||||
boolean var1 = jCheckBox1.isSelected();
|
||||
int var2 = 2;// (Integer)spinner.getValue();
|
||||
int result;
|
||||
|
||||
HashMap args = new HashMap();
|
||||
args.put("relative", var1);
|
||||
args.put("steps", var2);
|
||||
run("power-supply", args);
|
||||
|
||||
//try to print the result
|
||||
txtTestPSRes.setText(args.get("steps").toString());
|
||||
|
||||
|
||||
//evalAsync("run('args', locals = {'relative':" + (var1 ? "True" :"False") + ", 'steps':" + var2 + "})");
|
||||
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
} // TODO add your handling code here:
|
||||
}//GEN-LAST:event_cmTestPSActionPerformed
|
||||
|
||||
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jCheckBox1ActionPerformed
|
||||
|
||||
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
try {
|
||||
boolean var1 = jCheckBox1.isSelected();
|
||||
int var2 = 2;// (Integer)spinner.getValue();
|
||||
@@ -297,33 +359,38 @@ public class TestingPanel2 extends Panel {
|
||||
HashMap args = new HashMap();
|
||||
args.put("relative", var1);
|
||||
args.put("steps", var2);
|
||||
run("args", args);
|
||||
|
||||
|
||||
run("motor-slide", args);
|
||||
|
||||
//evalAsync("run('args', locals = {'relative':" + (var1 ? "True" :"False") + ", 'steps':" + var2 + "})");
|
||||
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
} // TODO add your handling code here:
|
||||
}//GEN-LAST:event_jButton3ActionPerformed
|
||||
}//GEN-LAST:event_jButton4ActionPerformed
|
||||
|
||||
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed
|
||||
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
|
||||
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jCheckBox1ActionPerformed
|
||||
|
||||
|
||||
|
||||
txtOutput.setText("Working Directory = " +
|
||||
System.getProperty("user.dir"));
|
||||
}//GEN-LAST:event_jButton3ActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonExecute;
|
||||
private javax.swing.JCheckBox check;
|
||||
private javax.swing.JButton cmTestPS;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JButton jButton3;
|
||||
private javax.swing.JButton jButton4;
|
||||
private javax.swing.JCheckBox jCheckBox1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JPanel panel;
|
||||
private javax.swing.JPanel panelPlot;
|
||||
private javax.swing.JSpinner spinner;
|
||||
private javax.swing.JTextArea txtOutput;
|
||||
private javax.swing.JTextField txtTestPSRes;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTextArea" name="jTextArea1">
|
||||
<Component class="javax.swing.JTextArea" name="txtOutput">
|
||||
<Properties>
|
||||
<Property name="columns" type="int" value="20"/>
|
||||
<Property name="rows" type="int" value="5"/>
|
||||
|
||||
@@ -92,7 +92,7 @@ public class TestingPanel extends Panel {
|
||||
txtTestPSRes = new javax.swing.JTextField();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jTextArea1 = new javax.swing.JTextArea();
|
||||
txtOutput = new javax.swing.JTextArea();
|
||||
|
||||
buttonExecute.setText("Execute test11");
|
||||
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
|
||||
@@ -160,9 +160,9 @@ public class TestingPanel extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
jTextArea1.setColumns(20);
|
||||
jTextArea1.setRows(5);
|
||||
jScrollPane1.setViewportView(jTextArea1);
|
||||
txtOutput.setColumns(20);
|
||||
txtOutput.setRows(5);
|
||||
jScrollPane1.setViewportView(txtOutput);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
@@ -371,7 +371,7 @@ public class TestingPanel extends Panel {
|
||||
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
|
||||
|
||||
// TODO add your handling code here:
|
||||
System.out.println("Working Directory = " +
|
||||
txtOutput.setText("Working Directory = " +
|
||||
System.getProperty("user.dir"));
|
||||
}//GEN-LAST:event_jButton3ActionPerformed
|
||||
|
||||
@@ -386,10 +386,10 @@ public class TestingPanel extends Panel {
|
||||
private javax.swing.JButton jButton4;
|
||||
private javax.swing.JCheckBox jCheckBox1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JTextArea jTextArea1;
|
||||
private javax.swing.JPanel panel;
|
||||
private javax.swing.JPanel panelPlot;
|
||||
private javax.swing.JSpinner spinner;
|
||||
private javax.swing.JTextArea txtOutput;
|
||||
private javax.swing.JTextField txtTestPSRes;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user