Closedown

This commit is contained in:
boccioli_m
2015-06-23 10:12:00 +02:00
parent 8e721a0625
commit 67aef3a39c
7 changed files with 624 additions and 776 deletions

View File

@@ -1,5 +1,6 @@
#Wed Jun 17 13:58:22 CEST 2015
#Mon Jun 22 15:51:03 CEST 2015
.\\home\\plugins\\TestMain.java=disabled
.\\home\\plugins\\TestingListDetails.java=disabled
.\\home\\plugins\\TestingList.java=enabled
.\\home\\plugins\\TestingPanel.java=disabled
.\\home\\plugins\\PowerSupply.java=enabled
.\\home\\plugins\\plublic.java=disabled

View File

@@ -51,7 +51,6 @@
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jTable1MouseClicked"/>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jTable1KeyReleased"/>
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="jTable1KeyTyped"/>
</Events>
</Component>
</SubComponents>

View File

@@ -2,14 +2,10 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Controller;
import ch.psi.utils.swing.MonitoredPanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.ApplicationStateException;
import ch.psi.wsaf.Task;
import ch.psi.wsaf.TaskRunningException;
import java.awt.Desktop;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -27,10 +23,9 @@ import java.io.InputStream;
import java.util.Properties;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
import javafx.scene.control.SelectionMode;
import javax.script.ScriptException;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
import org.apache.commons.io.FilenameUtils;
public class TestingList extends Panel {
@@ -49,6 +44,12 @@ public class TestingList extends Panel {
protected JPanel create() {
try {
testingList = new NetbeansPluginPanel();
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().add(new TestingListDetails());
frame.pack();
frame.setVisible(true);
} catch (IOException ex) {
Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex);
}
@@ -289,9 +290,6 @@ public class TestingList extends Panel {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTable1KeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTable1KeyTyped(evt);
}
});
jScrollPane2.setViewportView(jTable1);
@@ -366,6 +364,8 @@ public class TestingList extends Panel {
add(jPanel1, java.awt.BorderLayout.NORTH);
}// </editor-fold>//GEN-END:initComponents
private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed
if(this.jButtonRun.getToolTipText().equals("Run selected tests")){
setButtonToStart();
@@ -383,7 +383,7 @@ public class TestingList extends Panel {
this.jTable1.setEnabled(true);
}
private void setButtonToStart(){
private void setButtonToStart(){
this.jButtonRun.setToolTipText("Stop tests");
jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/button_stop-64px.png")));
this.jTable1.clearSelection();
@@ -412,22 +412,22 @@ public class TestingList extends Panel {
}//GEN-LAST:event_jCheckBox1ActionPerformed
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
switch (evt.getClickCount()){
case 1:
int colIndex = jTable1.getSelectedColumn();
if (colIndex == COL.CHECK.ordinal()) updateStatus();
break;
case 2:
SwingUtils.showMessage(this, "jBu","bo");
TestingListDetails detailsPanel = new TestingListDetails();
//detailsPanel.setVisible(true);
//add(detailsPanel);
break;
}
}//GEN-LAST:event_jTable1MouseClicked
try{
switch (evt.getClickCount()){
case 1:
int colIndex = jTable1.getSelectedColumn();
if (colIndex == COL.CHECK.ordinal()) updateStatus();
break;
case 2:
openDetails();
SwingUtils.showMessage(this, "jBu","bo");
break;
}
} catch (Exception ex){
SwingUtils.showException(this, ex);
}
private void jTable1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyTyped
}//GEN-LAST:event_jTable1KeyTyped
}//GEN-LAST:event_jTable1MouseClicked
//oopen the log file using one of th default OS text reades
private void jButtonOpenLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOpenLogActionPerformed
@@ -458,6 +458,7 @@ public class TestingList extends Panel {
moveUp();
}//GEN-LAST:event_jButtonMoveUpActionPerformed
//<editor-fold defaultstate="collapsed" desc="Witget Variables declaration">
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButtonMoveDown;
private javax.swing.JButton jButtonMoveUp;
@@ -469,26 +470,71 @@ public class TestingList extends Panel {
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable jTable1;
// End of variables declaration//GEN-END:variables
//</editor-fold>
//return status of run button. True = tests launching sequence is running
public boolean isTestRunAllowed(){
return this.jButtonRun.getToolTipText().equals("Stop tests");
}
//move selection up in table
private void moveUp(){
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
int[] rows = jTable1.getSelectedRows();
model.moveRow(rows[0],rows[rows.length-1],rows[0]-1);
jTable1.setRowSelectionInterval(rows[0]-1, rows[rows.length-1]-1);
}
//move selection down in table
private void moveDown(){
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
int[] rows = jTable1.getSelectedRows();
model.moveRow(rows[0],rows[rows.length-1],rows[0]+1);
jTable1.setRowSelectionInterval(rows[0]+1, rows[rows.length-1]+1);
}
}
//open details of the selected test in a new panel
private void openDetails() throws ClassNotFoundException, InstantiationException, IllegalAccessException{
String sDeviceName;
String sTestName;
String sTestCaseName;
String sDeviceDescription;
String sLastResult;
String sResultTime;
HashMap mParameters = new HashMap();
//pick details from the clicked row
int row = jTable1.getSelectedRow();
sDeviceName = jTable1.getValueAt(row, COL.DEVICENAME.ordinal()).toString();
sTestName = jTable1.getValueAt(row, COL.TESTNAME.ordinal()).toString();
sTestCaseName = jTable1.getValueAt(row, COL.TESTSUITE.ordinal()).toString();
sDeviceDescription = jTable1.getValueAt(row, COL.DEVICEDESCR.ordinal()).toString();
sLastResult = jTable1.getValueAt(row, COL.RESULT.ordinal()).toString();
sResultTime = jTable1.getValueAt(row, COL.TIME.ordinal()).toString();
mParameters = buildParametersMap(String.valueOf(jTable1.getValueAt(row, COL.TESTPARAMS.ordinal())));
//create map to pass to details panel
HashMap details = new HashMap();
details.put("deviceName", sDeviceName);
details.put("deviceDescription", sDeviceDescription);
details.put("testSuite", sTestCaseName);
details.put("testName", sTestName);
details.put("testResult", sLastResult);
details.put("time", sResultTime);
details.put("parameters", mParameters);
//open details panel
JDialog dlg = new JDialog(getView(), true);
//dlg.setLayout(new BorderLayout());
//TestingListDetails detailsPanel = new TestingListDetails();
Class TestingListDetailsClass = getController().getClassByName("TestingListDetails");
TestingListDetails detailsPanel = (TestingListDetails) TestingListDetailsClass.newInstance();
dlg.getContentPane().add(detailsPanel);
//dlg.add(new TestingListDetails());
dlg.pack();
dlg.setVisible(true);
}
//show test result in table
public int showResult(String deviceName, String testName, String res, String status) {
int rowD = -1;
@@ -628,7 +674,6 @@ public class TestingList extends Panel {
}
showResult(sDeviceName, sTestPath, "Test running", TestStatus.RUNNING.toString());
//launch the test
args.put("DEVICE", sDeviceName);
args.put("ret", "");
args.put("status", false);
@@ -742,7 +787,7 @@ public class TestingList extends Panel {
logger.log(Level.INFO, iCounter + " tests loaded.");
}
private HashMap buildParametersMap(String parametersString){
//<editor-fold defaultstate="collapsed" desc="Function Description">
/*
Build a map with optional parameters to be passed to the testing script.
The map is like this:
@@ -760,6 +805,8 @@ public class TestingList extends Panel {
...
the name 'name' is the mapping key. 'value' and 'description' are constant mapping keys of a nested map.
*/
//</editor-fold>
private HashMap buildParametersMap(String parametersString){
HashMap mParameters = new HashMap(); // contains name and attributes
HashMap mParameterAttributes = new HashMap(); //contians value and description
String[] dsParameterAttributes = null;

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
@@ -45,18 +45,22 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jButton3" min="-2" pref="132" max="-2" attributes="0"/>
<Component id="cmDefault" min="-2" pref="132" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton2" min="-2" pref="96" max="-2" attributes="0"/>
<Component id="cmOk" min="-2" pref="96" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="98" max="-2" attributes="0"/>
<Component id="cmCancel" min="-2" pref="98" max="-2" attributes="0"/>
</Group>
<Component id="jTextField5" max="32767" attributes="0"/>
<Component id="jTextField4" alignment="1" max="32767" attributes="0"/>
<Component id="jTextField1" max="32767" attributes="0"/>
<Component id="jTextField2" max="32767" attributes="0"/>
<Component id="jTextField3" alignment="0" max="32767" attributes="0"/>
<Component id="txtTestName" alignment="1" max="32767" attributes="0"/>
<Component id="txtDeviceName" max="32767" attributes="0"/>
<Component id="txtDeviceDescription" max="32767" attributes="0"/>
<Component id="txtTestSuite" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="666" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="txtTestResult" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtTime" min="-2" pref="148" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
@@ -74,40 +78,41 @@
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtDeviceName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtDeviceDescription" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTestSuite" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTestName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jTextField5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTestResult" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" min="-2" pref="318" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="200" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton2" pref="32" max="32767" attributes="0"/>
<Component id="jButton1" max="32767" attributes="0"/>
<Component id="jButton3" max="32767" attributes="0"/>
<Component id="cmOk" max="32767" attributes="0"/>
<Component id="cmCancel" max="32767" attributes="0"/>
<Component id="cmDefault" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -118,7 +123,7 @@
<Property name="text" type="java.lang.String" value="Device name"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField1">
<Component class="javax.swing.JTextField" name="txtDeviceName">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
@@ -128,7 +133,7 @@
<Property name="text" type="java.lang.String" value="Device Description"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField2">
<Component class="javax.swing.JTextField" name="txtDeviceDescription">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField2"/>
</Properties>
@@ -146,7 +151,7 @@
<Property name="text" type="java.lang.String" value="Test Case/Suite"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField3">
<Component class="javax.swing.JTextField" name="txtTestSuite">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField2"/>
</Properties>
@@ -156,17 +161,17 @@
<Property name="text" type="java.lang.String" value="Test Name"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField4">
<Component class="javax.swing.JTextField" name="txtTestName">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField2"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Last test result"/>
<Property name="text" type="java.lang.String" value="Last Test Result"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="jTextField5">
<Component class="javax.swing.JTextField" name="txtTestResult">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField2"/>
</Properties>
@@ -178,18 +183,18 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="jTable1">
<Component class="javax.swing.JTable" name="jTableParams">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="3" rowCount="4">
<Column editable="true" title="Parameter" type="java.lang.Object"/>
<Column editable="true" title="Value" type="java.lang.Object"/>
<Column editable="true" title="Description" type="java.lang.Object"/>
<Table columnCount="3" rowCount="0">
<Column editable="false" title="Parameter" type="java.lang.Object"/>
<Column editable="false" title="Value" type="java.lang.Object"/>
<Column editable="false" title="Description" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="150" minWidth="100" prefWidth="100" resizable="true">
<Column maxWidth="150" minWidth="150" prefWidth="150" resizable="true">
<Title/>
<Editor/>
<Renderer/>
@@ -206,6 +211,7 @@
</Column>
</TableColumnModel>
</Property>
<Property name="dragEnabled" type="boolean" value="true"/>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
@@ -215,26 +221,40 @@
</Container>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" value="Test parameters"/>
<Property name="text" type="java.lang.String" value="Test Parameters"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Component class="javax.swing.JButton" name="cmCancel">
<Properties>
<Property name="text" type="java.lang.String" value="Cancel"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmCancelActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Component class="javax.swing.JButton" name="cmOk">
<Properties>
<Property name="text" type="java.lang.String" value="Ok"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Component class="javax.swing.JButton" name="cmDefault">
<Properties>
<Property name="text" type="java.lang.String" value="Save as Default"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_InitCodePost" type="java.lang.String" value="this.cmCancel.setVisible(false);&#xd;&#xa;this.cmOk.setVisible(false);&#xd;&#xa;this.cmDefault.setVisible(false);&#xd;&#xa;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JTextField" name="txtTime">
<Properties>
<Property name="text" type="java.lang.String" value="jTextField1"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -1,3 +1,9 @@
import java.util.HashMap;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import org.apache.commons.io.FilenameUtils;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
@@ -16,6 +22,11 @@ public class TestingListDetails extends javax.swing.JPanel {
public TestingListDetails() {
initComponents();
}
public TestingListDetails(HashMap hDetails) {
initComponents();
fillComponents(hDetails);
}
/**
* This method is called from within the constructor to initialize the form.
@@ -27,78 +38,94 @@ public class TestingListDetails extends javax.swing.JPanel {
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
txtDeviceName = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
txtDeviceDescription = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
txtTestSuite = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
txtTestName = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
txtTestResult = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jTableParams = new javax.swing.JTable();
jLabel7 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
cmCancel = new javax.swing.JButton();
cmOk = new javax.swing.JButton();
cmDefault = new javax.swing.JButton();
txtTime = new javax.swing.JTextField();
jLabel1.setText("Device name");
jTextField1.setText("jTextField1");
txtDeviceName.setText("jTextField1");
jLabel2.setText("Device Description");
jTextField2.setText("jTextField2");
txtDeviceDescription.setText("jTextField2");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel3.setText("Test details");
jLabel4.setText("Test Case/Suite");
jTextField3.setText("jTextField2");
txtTestSuite.setText("jTextField2");
jLabel5.setText("Test Name");
jTextField4.setText("jTextField2");
txtTestName.setText("jTextField2");
jLabel6.setText("Last test result");
jLabel6.setText("Last Test Result");
jTextField5.setText("jTextField2");
txtTestResult.setText("jTextField2");
jTable1.setModel(new javax.swing.table.DefaultTableModel(
jTableParams.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null},
{null, null, null},
{null, null, null},
{null, null, null}
},
new String [] {
"Parameter", "Value", "Description"
}
));
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setMinWidth(100);
jTable1.getColumnModel().getColumn(0).setPreferredWidth(100);
jTable1.getColumnModel().getColumn(0).setMaxWidth(150);
jTable1.getColumnModel().getColumn(1).setPreferredWidth(80);
jTable1.getColumnModel().getColumn(1).setMaxWidth(100);
) {
boolean[] canEdit = new boolean [] {
false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTableParams.setDragEnabled(true);
jScrollPane1.setViewportView(jTableParams);
if (jTableParams.getColumnModel().getColumnCount() > 0) {
jTableParams.getColumnModel().getColumn(0).setMinWidth(150);
jTableParams.getColumnModel().getColumn(0).setPreferredWidth(150);
jTableParams.getColumnModel().getColumn(0).setMaxWidth(150);
jTableParams.getColumnModel().getColumn(1).setPreferredWidth(80);
jTableParams.getColumnModel().getColumn(1).setMaxWidth(100);
}
jLabel7.setText("Test parameters");
jLabel7.setText("Test Parameters");
jButton1.setText("Cancel");
jButton1.addActionListener(new java.awt.event.ActionListener() {
cmCancel.setText("Cancel");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
cmCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
cmCancelActionPerformed(evt);
}
});
jButton2.setText("Ok");
cmOk.setText("Ok");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
jButton3.setText("Save as Default");
cmDefault.setText("Save as Default");
this.cmCancel.setVisible(false);
this.cmOk.setVisible(false);
this.cmDefault.setVisible(false);
txtTime.setText("jTextField1");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
@@ -128,17 +155,20 @@ public class TestingListDetails extends javax.swing.JPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmDefault, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cmOk, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField5)
.addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField1)
.addComponent(jTextField2)
.addComponent(jTextField3)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 666, Short.MAX_VALUE))))
.addComponent(cmCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtTestName, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtDeviceName)
.addComponent(txtDeviceDescription)
.addComponent(txtTestSuite)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 666, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(txtTestResult)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtTime, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(21, Short.MAX_VALUE))))
);
layout.setVerticalGroup(
@@ -149,45 +179,71 @@ public class TestingListDetails extends javax.swing.JPanel {
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtDeviceName, 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(jLabel2)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtDeviceDescription, 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(jLabel4)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtTestSuite, 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(jLabel5)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtTestName, 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(jLabel6)
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtTestResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addComponent(jLabel7)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(cmOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cmDefault, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void fillComponents(HashMap hDetails) {
this.txtDeviceName.setText(hDetails.get("deviceName").toString());
this.txtDeviceDescription.setText(hDetails.get("deviceDescription").toString());
this.txtTestSuite.setText(hDetails.get("testSuite").toString());
this.txtTestName.setText(hDetails.get("testName").toString());
this.txtTestResult.setText(hDetails.get("testResult").toString());
this.txtTime.setText(hDetails.get("time").toString());
//parameters table
HashMap hParams = (HashMap) hDetails.get("parameters");
String name="", value="", description="";
DefaultTableModel model = (DefaultTableModel) jTableParams.getModel();
for(Object entry : hParams.keySet()){
Object param = entry;
if(param instanceof String){
name = (String) param;
HashMap attributes = (HashMap) hParams.get(param);
value = (String) attributes.get("value");
description = (String) attributes.get("description");
model.addRow(new Object[]{name, value, description});
}
jTableParams.setModel(model);
}
}
private void cmCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmCancelActionPerformed
}//GEN-LAST:event_cmCancelActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton cmCancel;
private javax.swing.JButton cmDefault;
private javax.swing.JButton cmOk;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
@@ -196,11 +252,12 @@ public class TestingListDetails extends javax.swing.JPanel {
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTable jTableParams;
private javax.swing.JTextField txtDeviceDescription;
private javax.swing.JTextField txtDeviceName;
private javax.swing.JTextField txtTestName;
private javax.swing.JTextField txtTestResult;
private javax.swing.JTextField txtTestSuite;
private javax.swing.JTextField txtTime;
// End of variables declaration//GEN-END:variables
}

View File

@@ -1,226 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="41" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="check" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonExecute" max="32767" attributes="0"/>
<Component id="buttonAbort" max="32767" attributes="0"/>
</Group>
<Component id="jButton1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="spinner" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="87" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="panel" min="-2" pref="394" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="cmTestPS" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="txtTestPSRes" pref="57" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jCheckBox1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jButton4" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" attributes="0">
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="plot" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="cmTestPS" min="-2" max="-2" attributes="0"/>
<Component id="txtTestPSRes" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="spinner" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="buttonExecute" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="panel" min="-2" pref="137" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="check" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="plot" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonExecute">
<Properties>
<Property name="text" type="java.lang.String" value="Execute test11"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonExecuteActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonAbort">
<Properties>
<Property name="text" type="java.lang.String" value="Abort"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Test with params"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="check">
<Properties>
<Property name="text" type="java.lang.String" value="Var1"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinner">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="10" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panel">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
</Container>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Java Code"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="cmTestPS">
<Properties>
<Property name="text" type="java.lang.String" value="Test PS"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cmTestPSActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Properties>
<Property name="actionCommand" type="java.lang.String" value="check2"/>
<Property name="label" type="java.lang.String" value="check2"/>
<Property name="name" type="java.lang.String" value="check2" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jCheckBox1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton4">
<Properties>
<Property name="text" type="java.lang.String" value="Test LS"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton4ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="txtTestPSRes">
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" value="jButton3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="txtOutput">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="rows" type="int" value="5"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.plot.LinePlotJFree" name="plot">
<Properties>
<Property name="title" type="java.lang.String" value=""/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -1,414 +1,364 @@
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.dev.Motor;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotJFree;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.swing.MotorPanel;
import ch.psi.pshell.ui.App;
import ch.psi.utils.swing.MonitoredPanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.ApplicationStateException;
import ch.psi.wsaf.Task;
import ch.psi.wsaf.TaskRunMode;
import ch.psi.wsaf.TaskRunningException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
/**
*
*/
public class TestingPanel extends Panel {
MotorPanel motorPanel;
LinePlotBase plot ;
LinePlotSeries series;
Motor motor;
Task task = new Task() {
@Override
protected Object execute() throws Exception {
series.clear();
for (int i=0;i<1000;i++){
double pos = motor.read();
Thread.sleep(2);
plot.getAxis(Plot.AxisId.X).setRange(0, 1000);
series.appendData(i, pos);
}
return true;
}
};
@Override
protected JPanel create() {
getApp().addTask(task);
return new NetbeansPluginPanel();
}
@Override
protected void onInitialize(int runCount){
motor = (Motor) TestingPanel.this.getDevice("motor");
motorPanel.setDevice(motor);
}
//listen to script end of execution and get return value
@Override
protected void onExecutedFile(String fileName) {
try {
switch(fileName){
case "power-supply":
Object ret = eval("ret");
if (ret != null) {
SwingUtils.showMessage(getComponent(), "", ret.toString() + " - " + ret.getClass().getName());
}
break;
}
}
catch (Exception ex) {
SwingUtils.showException(getComponent(), ex);
}
}
public class NetbeansPluginPanel extends MonitoredPanel {
public NetbeansPluginPanel() {
initComponents();
motorPanel = new MotorPanel();
panel.add(motorPanel);
onInitialize(-1);
plot.setTitle("bo");
series=new LinePlotSeries("Position");
plot.addSeries(series);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonExecute = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
check = new javax.swing.JCheckBox();
spinner = new javax.swing.JSpinner();
panel = new javax.swing.JPanel();
jButton2 = 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();
plot = new ch.psi.pshell.plot.LinePlotJFree();
buttonExecute.setText("Execute test11");
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExecuteActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jButton1.setText("Test with params");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
check.setText("Var1");
spinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));
panel.setLayout(new java.awt.BorderLayout());
jButton2.setText("Java Code");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
cmTestPS.setText("Test PS");
cmTestPS.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmTestPSActionPerformed(evt);
}
});
jCheckBox1.setActionCommand("check2");
jCheckBox1.setLabel("check2");
jCheckBox1.setName("check2"); // NOI18N
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
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);
plot.setTitle("");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(check)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonExecute, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(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()
.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)
.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()
.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))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(plot, 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)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonExecute)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonAbort))
.addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.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.RELATED)
.addComponent(plot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
try {
//Run script
//run("test1");
//Alternatives to run script with arguments
eval("start = 22.0");
eval("end = 32.0");
eval("step = 10");
run("test11");
/*
HashMap args = new HashMap();
args.put("start", 12.0);
args.put("end", 52.0);
args.put("step", 10);
run("test11", args);
*/
//eval("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) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonExecuteActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
abort();
}//GEN-LAST:event_buttonAbortActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
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) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
getApp().startTask(task);
task.start(TaskRunMode.async);
} catch (Exception ex) {
SwingUtils.showException(NetbeansPluginPanel.this, ex);
}
/*
new Thread(() -> {
try {
series.clear();
for (int i=0;i<1000;i++){
double pos = motor.read();
Thread.sleep(2);
plot.getAxis(Plot.AxisId.X).setRange(0, 1000);
series.appendData(i, pos);
}
} catch (Exception ex) {
SwingUtils.showException(NetbeansPluginPanel.this, ex);
}
}).start(); */
}//GEN-LAST:event_jButton2ActionPerformed
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);
//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();
HashMap args = new HashMap();
args.put("relative", var1);
args.put("steps", var2);
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_jButton4ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
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 ch.psi.pshell.plot.LinePlotJFree plot;
private javax.swing.JSpinner spinner;
private javax.swing.JTextArea txtOutput;
private javax.swing.JTextField txtTestPSRes;
// End of variables declaration//GEN-END:variables
}
}
/*
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.dev.Motor;
import ch.psi.pshell.plot.LinePlotBase;
import ch.psi.pshell.plot.LinePlotJFree;
import ch.psi.pshell.plot.LinePlotSeries;
import ch.psi.pshell.plot.Plot;
import ch.psi.pshell.swing.MotorPanel;
import ch.psi.pshell.ui.App;
import ch.psi.utils.swing.MonitoredPanel;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.wsaf.ApplicationStateException;
import ch.psi.wsaf.Task;
import ch.psi.wsaf.TaskRunMode;
import ch.psi.wsaf.TaskRunningException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
/**
*
*/
public class TestingPanel extends Panel {
MotorPanel motorPanel;
LinePlotBase plot ;
LinePlotSeries series;
Motor motor;
Task task = new Task() {
@Override
protected Object execute() throws Exception {
series.clear();
for (int i=0;i<1000;i++){
double pos = motor.read();
Thread.sleep(2);
plot.getAxis(Plot.AxisId.X).setRange(0, 1000);
series.appendData(i, pos);
}
return true;
}
};
@Override
protected JPanel create() {
getApp().addTask(task);
return new NetbeansPluginPanel();
}
@Override
protected void onInitialize(int runCount){
motor = (Motor) TestingPanel.this.getDevice("motor");
motorPanel.setDevice(motor);
}
public class NetbeansPluginPanel extends MonitoredPanel {
public NetbeansPluginPanel() {
initComponents();
motorPanel = new MotorPanel();
panel.add(motorPanel);
onInitialize(-1);
plot = new LinePlotJFree();
plot.setTitle("bo");
panelPlot.add(plot);
series=new LinePlotSeries("Position");
plot.addSeries(series);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonExecute = new javax.swing.JButton();
buttonAbort = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
check = new javax.swing.JCheckBox();
spinner = new javax.swing.JSpinner();
panel = new javax.swing.JPanel();
panelPlot = new javax.swing.JPanel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jCheckBox1 = new javax.swing.JCheckBox();
jButton4 = new javax.swing.JButton();
txtTestPSRes = new javax.swing.JTextField();
buttonExecute.setText("Execute test11");
buttonExecute.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonExecuteActionPerformed(evt);
}
});
buttonAbort.setText("Abort");
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonAbortActionPerformed(evt);
}
});
jButton1.setText("Test with params");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
check.setText("Var1");
spinner.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1));
panel.setLayout(new java.awt.BorderLayout());
panelPlot.setLayout(new java.awt.BorderLayout());
jButton2.setText("Java Code");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Test PS");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jCheckBox1.setActionCommand("check2");
jCheckBox1.setLabel("check2");
jCheckBox1.setName("check2"); // NOI18N
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);
}
});
jButton4.setText("Test LS");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(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()
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(check)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonExecute, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jButton1)
.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()
.addGap(277, 277, 277)
.addComponent(jButton2)
.addGap(0, 0, Short.MAX_VALUE))
.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)
.addGroup(layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtTestPSRes, javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE))
.addComponent(jCheckBox1)
.addComponent(jButton4))
.addContainerGap())))
.addGroup(layout.createSequentialGroup()
.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(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonExecute)
.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)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton3)
.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)
.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, 185, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void buttonExecuteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecuteActionPerformed
try {
//Run script
//run("test1");
//Alternatives to run script with arguments
eval("start = 22.0");
eval("end = 32.0");
eval("step = 10");
run("test11");
/*
HashMap args = new HashMap();
args.put("start", 12.0);
args.put("end", 52.0);
args.put("step", 10);
run("test11", args);
*/
//eval("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) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_buttonExecuteActionPerformed
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
abort();
}//GEN-LAST:event_buttonAbortActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
boolean var1 = check.isSelected();
int var2 = (Integer)spinner.getValue();
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) {
SwingUtils.showException(this, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
getApp().startTask(task);
task.start(TaskRunMode.async);
} catch (Exception ex) {
SwingUtils.showException(NetbeansPluginPanel.this, ex);
}
/*
new Thread(() -> {
try {
series.clear();
for (int i=0;i<1000;i++){
double pos = motor.read();
Thread.sleep(2);
plot.getAxis(Plot.AxisId.X).setRange(0, 1000);
series.appendData(i, pos);
}
} catch (Exception ex) {
SwingUtils.showException(NetbeansPluginPanel.this, ex);
}
}).start(); */
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
boolean var1 = jCheckBox1.isSelected();
int var2 = 2;// (Integer)spinner.getValue();
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_jButton3ActionPerformed
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();
HashMap args = new HashMap();
args.put("relative", var1);
args.put("steps", var2);
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_jButton4ActionPerformed
// 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 jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JPanel panel;
private javax.swing.JPanel panelPlot;
private javax.swing.JSpinner spinner;
private javax.swing.JTextField txtTestPSRes;
// End of variables declaration//GEN-END:variables
}
}