This commit is contained in:
boccioli_m
2015-06-15 10:59:20 +02:00
parent 97c427d360
commit 793294a732

View File

@@ -31,6 +31,7 @@ import javax.activation.ActivationDataFlavor;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;
@@ -78,7 +79,10 @@ public class TestingList extends Panel {
//start next test
if(iCurrentTestPos>=0 && testingList.isTestRunAllowed())
{
testingList.executeTest(iCurrentTestPos+1);
final int position = iCurrentTestPos+1;
SwingUtilities.invokeLater(() -> {
testingList.executeTest(position);
});
}
}
else{ // ret empty means that either the test script does not have variable ret, or that the script could not be started at all
@@ -113,6 +117,8 @@ public class TestingList extends Panel {
}
}
//table column indexes
public enum COL {
CHECK (0),
TIME (1),
@@ -134,6 +140,7 @@ public class TestingList extends Panel {
}
};
//enumeration of possible test statuses: text and related icon
public enum TestStatus {
SUCCESS (0),
FAILURE (1),
@@ -174,7 +181,7 @@ public class TestingList extends Panel {
}
@Override
public String toString() {
public final String toString() {
String status = "";
switch (this) {
case SUCCESS:
@@ -195,7 +202,6 @@ public class TestingList extends Panel {
}
return status;
}
public ImageIcon Icon(){
String iconFileName = this.IconFilename();
@@ -203,14 +209,10 @@ public class TestingList extends Panel {
if (iconFileName != "")
icon = new ImageIcon(getClass().getResource(this.IconFilename()));
return icon;
}
}
};
public class NetbeansPluginPanel extends MonitoredPanel {
Logger logger = Logger.getLogger("TestsLog");
//these paths are converted to unix or win path according to host OS
private final String TESTS_DEVICES_DEFAULT_DIR = new java.io.File(".").getCanonicalPath()
@@ -221,7 +223,6 @@ public class TestingList extends Panel {
+ FilenameUtils.separatorsToSystem("/home/script/tests/log/TestsLog" + getnow() + ".txt");
//table1 columns indexes
private void initLogger() {
try {
FileHandler fh;
@@ -531,10 +532,10 @@ public class TestingList extends Panel {
if (colT >= 0 && rowD >= 0) {
sStatus = jTable1.getValueAt(rowD, COL.STATUS.index()).toString();
}
return sStatus;
}
//visualise test status (columns status and icon)
public void updateStatus() {
String sStatus;
boolean bSelected;
@@ -542,10 +543,10 @@ public class TestingList extends Panel {
for (int row = 0; row <= jTable1.getRowCount() - 1; row++) {
bSelected = (boolean) jTable1.getValueAt(row, COL.CHECK.index());
if (bSelected) {
sStatus = "Pending";
sStatus = TestStatus.PENDING.toString();
icon = TestStatus.PENDING.Icon();
} else {
sStatus = "Disabled";
sStatus = TestStatus.DISABLED.toString();
icon = TestStatus.DISABLED.Icon();
}
jTable1.setValueAt(bSelected, row, COL.CHECK.index());
@@ -575,7 +576,7 @@ public class TestingList extends Panel {
try{
args.put("DEVICE", sDeviceName);
args.put("ret", "");
args.put("status", false);
args.put("status", false);
run(sTestName, args);
} catch (Exception ex) {
SwingUtils.showMessage(this, "executeTest()", ex.toString());