diff --git a/config/plugins.properties b/config/plugins.properties
index c9d1e41..dd326d3 100644
--- a/config/plugins.properties
+++ b/config/plugins.properties
@@ -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
diff --git a/plugins/TestingList.form b/plugins/TestingList.form
index b4c0627..46ba34b 100644
--- a/plugins/TestingList.form
+++ b/plugins/TestingList.form
@@ -51,7 +51,6 @@
-
diff --git a/plugins/TestingList.java b/plugins/TestingList.java
index 43d8cc4..379c007 100644
--- a/plugins/TestingList.java
+++ b/plugins/TestingList.java
@@ -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);
}// //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
+ //
// 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
-
+ //
//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){
+ //
/*
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.
*/
+ //
+ private HashMap buildParametersMap(String parametersString){
HashMap mParameters = new HashMap(); // contains name and attributes
HashMap mParameterAttributes = new HashMap(); //contians value and description
String[] dsParameterAttributes = null;
diff --git a/plugins/TestingListDetails.form b/plugins/TestingListDetails.form
index 18ca04c..d463424 100644
--- a/plugins/TestingListDetails.form
+++ b/plugins/TestingListDetails.form
@@ -1,6 +1,6 @@
-