Before starting working with parallel/serial execution

This commit is contained in:
boccioli_m
2015-06-24 16:09:18 +02:00
parent 1e15704e31
commit 9c3c9fe485
2 changed files with 54 additions and 15 deletions

View File

@@ -28,9 +28,12 @@ import java.util.Properties;
import java.util.Vector;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
import javax.swing.DefaultCellEditor;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableCellRenderer;
import org.apache.commons.io.FilenameUtils;
/**
@@ -138,9 +141,10 @@ public class TestingList extends Panel {
TESTPARAMS (7),
TESTDESCR (8),
TESTHELP (9),
RESULT (10),
STATUS (11),
ICON (12);
STARTSEQUENCE (10),
RESULT (11),
STATUS (12),
ICON (13);
private int value;
private COL(int value) {
@@ -213,8 +217,7 @@ public class TestingList extends Panel {
break;
}
return status;
}
}
/**
*
* @return
@@ -227,6 +230,27 @@ public class TestingList extends Panel {
return icon;
}
};
public enum StartSequence {
START_SEQ_AFTER,
START_SEQ_BEFORE;
@Override
public final String toString() {
String status = "";
switch (this) {
case START_SEQ_AFTER:
status = "After previous";
break;
case START_SEQ_BEFORE:
status = "Together with previous";
break;
}
return status;
}
};
/**
*
@@ -240,7 +264,6 @@ public class TestingList extends Panel {
+ FilenameUtils.separatorsToSystem("/home/script/tests/tests/");
private final String TESTS_LOG_DEFAULT_DIR = new java.io.File(".").getCanonicalPath()
+ FilenameUtils.separatorsToSystem("/home/script/tests/log/TestsLog" + getnow() + ".txt");
//table1 columns indexes
private void initLogger() {
try {
@@ -294,14 +317,14 @@ public class TestingList extends Panel {
},
new String [] {
"Select", "Time", "Device Name", "Device Description", "Test Suite", "Test Name", "Test Peth", "Test Parameters", "Test Description", "Test Help", "Last Test Result", "Status", ""
"Select", "Time", "Device Name", "Device Description", "Test Suite", "Test Name", "Test Peth", "Test Parameters", "Test Description", "Test Help", "Start", "Last Test Result", "Status", ""
}
) {
Class[] types = new Class [] {
java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class
java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, javax.swing.Icon.class
};
boolean[] canEdit = new boolean [] {
true, false, false, false, false, false, false, false, false, false, false, false, false
true, false, false, false, false, false, false, false, false, false, true, false, false, false
};
public Class getColumnClass(int columnIndex) {
@@ -465,7 +488,9 @@ public class TestingList extends Panel {
switch (evt.getClickCount()){
case 1:
int colIndex = jTable1.getSelectedColumn();
if (colIndex == COL.CHECK.ordinal()) updateStatus();
if (colIndex == COL.CHECK.ordinal()){
updateStatus();
}
break;
case 2:
openDetails();
@@ -697,6 +722,7 @@ public class TestingList extends Panel {
String sStatus;
boolean bSelected;
ImageIcon icon = null;
String sStart;
for (int row = 0; row <= jTable1.getRowCount() - 1; row++) {
bSelected = (boolean) jTable1.getValueAt(row, COL.CHECK.ordinal());
if (bSelected) {
@@ -776,6 +802,17 @@ public class TestingList extends Panel {
String sDate = getNow();
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
jTable1.setModel(model);
//Set up the combo box editor for the Start Sequence cells.
JComboBox comboBox = new JComboBox();
comboBox.addItem(StartSequence.START_SEQ_AFTER.toString());
comboBox.addItem(StartSequence.START_SEQ_BEFORE.toString());
jTable1.getColumnModel().getColumn(COL.STARTSEQUENCE.ordinal()).setCellEditor(new DefaultCellEditor(comboBox));
//Set up tool tips for the sequence cells.
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for options");
jTable1.getColumnModel().getColumn(COL.STARTSEQUENCE.ordinal()).setCellRenderer(renderer);
jTable1.getColumnModel().getColumn(COL.ICON.ordinal()).setMaxWidth(27);
jTable1.getColumnModel().getColumn(COL.CHECK.ordinal()).setMaxWidth(27);
jTable1.getColumnModel().getColumn(COL.DEVICENAME.ordinal()).setPreferredWidth(30);
@@ -809,7 +846,7 @@ public class TestingList extends Panel {
ImageIcon icon = null;// new ImageIcon(getClass().getResource("/icons/button_pause-16px.png"));
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
String testPath = FilenameUtils.separatorsToSystem(TESTS_TESTS_DEFAULT_DIR + testSuite + "/" + testName + "/" + testName + ".py");
model.addRow(new Object[]{false, sDate, deviceName, deviceDescription, testSuite, testName, testPath, testParams, testDescription, testHelp, "", "Pending", icon});
model.addRow(new Object[]{false, sDate, deviceName, deviceDescription, testSuite, testName, testPath, testParams, testDescription, testHelp, StartSequence.START_SEQ_AFTER.toString(), "", "Pending", icon});
jTable1.setModel(model);
updateStatus();
}
@@ -986,10 +1023,12 @@ public class TestingList extends Panel {
}
catch (Exception ex) {
ex.printStackTrace();
SwingUtils.showMessage(this, "getTestInProgress()", ex.toString());
SwingUtils.showMessage(this, "loadSettings()", ex.toString());
}
}
}
}
//end of class
}
}