diff --git a/plugins/NewTest.form b/plugins/NewTest.form index beb0f21..53da18f 100644 --- a/plugins/NewTest.form +++ b/plugins/NewTest.form @@ -16,12 +16,12 @@ - + - + @@ -42,9 +42,13 @@ - - + + + + + + @@ -53,54 +57,52 @@ - + - - - - - + + + + - - + - + - + - + - + - - - + + + @@ -147,6 +149,9 @@ + + + @@ -202,7 +207,7 @@ - + <Editor/> @@ -220,10 +225,11 @@ </Column> </TableColumnModel> </Property> + <Property name="columnSelectionAllowed" type="boolean" value="true"/> <Property name="dragEnabled" type="boolean" value="true"/> <Property name="rowHeight" type="int" value="20"/> <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor"> - <TableHeader reorderingAllowed="true" resizingAllowed="true"/> + <TableHeader reorderingAllowed="false" resizingAllowed="true"/> </Property> </Properties> <Events> @@ -232,13 +238,38 @@ </Component> </SubComponents> </Container> - <Component class="javax.swing.JButton" name="jButtonGenerate"> - <Properties> - <Property name="text" type="java.lang.String" value="Generate"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonGenerateActionPerformed"/> - </Events> - </Component> + <Container class="javax.swing.JPanel" name="jPanel1"> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace pref="442" max="32767" attributes="0"/> + <Component id="jButtonGenerate" min="-2" pref="188" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="0" max="-2" attributes="0"/> + <Component id="jButtonGenerate" min="-2" pref="33" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JButton" name="jButtonGenerate"> + <Properties> + <Property name="text" type="java.lang.String" value="Generate"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonGenerateActionPerformed"/> + </Events> + </Component> + </SubComponents> + </Container> </SubComponents> </Form> diff --git a/plugins/NewTest.java b/plugins/NewTest.java index 779f4f9..c4cbad4 100644 --- a/plugins/NewTest.java +++ b/plugins/NewTest.java @@ -6,6 +6,8 @@ import ch.psi.utils.swing.SwingUtils; import ch.psi.utils.swing.SwingUtils.OptionResult; import ch.psi.utils.swing.SwingUtils.OptionType; import java.awt.Desktop; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -61,7 +63,7 @@ public class NewTest extends javax.swing.JPanel { jPopupMenuTable = new javax.swing.JPopupMenu(); jMenuItemAddRow = new javax.swing.JMenuItem(); - jMenuItemReleteRow = new javax.swing.JMenuItem(); + jMenuItemDeleteRow = new javax.swing.JMenuItem(); lblName = new javax.swing.JLabel(); lblSuite = new javax.swing.JLabel(); lblParams = new javax.swing.JLabel(); @@ -72,6 +74,7 @@ public class NewTest extends javax.swing.JPanel { txtTestDescription = new javax.swing.JTextArea(); jScrollPane1 = new javax.swing.JScrollPane(); jTableParams = new javax.swing.JTable(); + jPanel1 = new javax.swing.JPanel(); jButtonGenerate = new javax.swing.JButton(); jMenuItemAddRow.setText("Add Row"); @@ -82,13 +85,13 @@ public class NewTest extends javax.swing.JPanel { }); jPopupMenuTable.add(jMenuItemAddRow); - jMenuItemReleteRow.setText("Delete Row"); - jMenuItemReleteRow.addActionListener(new java.awt.event.ActionListener() { + jMenuItemDeleteRow.setText("Delete Row"); + jMenuItemDeleteRow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - jMenuItemReleteRowActionPerformed(evt); + jMenuItemDeleteRowActionPerformed(evt); } }); - jPopupMenuTable.add(jMenuItemReleteRow); + jPopupMenuTable.add(jMenuItemDeleteRow); lblName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N lblName.setText("Name *"); @@ -104,6 +107,7 @@ public class NewTest extends javax.swing.JPanel { txtTestName.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N + jComboBoxTestSuites.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jComboBoxTestSuites.setMinimumSize(new java.awt.Dimension(31, 26)); jComboBoxTestSuites.setPreferredSize(new java.awt.Dimension(31, 26)); @@ -124,14 +128,17 @@ public class NewTest extends javax.swing.JPanel { "Parameter", "Value", "Description" } )); + jTableParams.setColumnSelectionAllowed(true); jTableParams.setDragEnabled(true); jTableParams.setRowHeight(20); + jTableParams.getTableHeader().setReorderingAllowed(false); jTableParams.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTableParamsMouseClicked(evt); } }); jScrollPane1.setViewportView(jTableParams); + jTableParams.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); if (jTableParams.getColumnModel().getColumnCount() > 0) { jTableParams.getColumnModel().getColumn(0).setMinWidth(150); jTableParams.getColumnModel().getColumn(0).setPreferredWidth(150); @@ -147,6 +154,23 @@ public class NewTest extends javax.swing.JPanel { } }); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(442, Short.MAX_VALUE) + .addComponent(jButtonGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(jButtonGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -154,6 +178,9 @@ public class NewTest extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(1, 1, 1)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblParams) @@ -161,18 +188,17 @@ public class NewTest extends javax.swing.JPanel { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(19, 19, 19) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 513, Short.MAX_VALUE) .addComponent(txtTestName, javax.swing.GroupLayout.DEFAULT_SIZE, 513, Short.MAX_VALUE) .addComponent(jComboBoxTestSuites, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jButtonGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 513, javax.swing.GroupLayout.PREFERRED_SIZE))))) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 513, Short.MAX_VALUE) + .addGap(1, 1, 1))) + .addGap(12, 12, 12)) .addComponent(lblName) - .addComponent(lblSuite)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(lblSuite))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -192,10 +218,10 @@ public class NewTest extends javax.swing.JPanel { .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lblParams) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jButtonGenerate, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents @@ -220,14 +246,14 @@ public class NewTest extends javax.swing.JPanel { jTableParams.setModel(model); }//GEN-LAST:event_jMenuItemAddRowActionPerformed - private void jMenuItemReleteRowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemReleteRowActionPerformed + private void jMenuItemDeleteRowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDeleteRowActionPerformed // TODO add your handling code here: int row = jTableParams.getSelectedRow(); if(row>=0 && row<jTableParams.getRowCount()){ DefaultTableModel model = (DefaultTableModel) jTableParams.getModel(); model.removeRow(row); } - }//GEN-LAST:event_jMenuItemReleteRowActionPerformed + }//GEN-LAST:event_jMenuItemDeleteRowActionPerformed /** * constants declarations @@ -248,9 +274,20 @@ public class NewTest extends javax.swing.JPanel { * @param newType the new can be Device or Test. */ private void fillComponents(String newType) { + + // listener for mouse-click also on table header + jTableParams.getTableHeader().addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent evt) { + if(evt.getButton() == java.awt.event.MouseEvent.BUTTON3){ + jPopupMenuTable.show(jTableParams, evt.getX(), evt.getY()); + } + } + }); + + //adapt labels according to type (Device or Test) if(newType == "Device"){ this.lblDescr.setText(newType + " "+ this.lblDescr.getText()); - this.lblName.setText(newType + " "+ this.lblName.getText()); + this.lblName.setText( newType + " "+ this.lblName.getText()); lblParams.setVisible(false); jTableParams.setVisible(false); jScrollPane1.setVisible(false); @@ -268,6 +305,7 @@ public class NewTest extends javax.swing.JPanel { } this.jComboBoxTestSuites.setEditable(true); this.jComboBoxTestSuites.setSelectedItem(null); + //fill parameters table InputStream ist = null; try { @@ -486,6 +524,7 @@ public class NewTest extends javax.swing.JPanel { SwingUtils.showMessage(this, "generateTestFiles()", "Cannot find tests default directory " + TESTS_TESTS_DEFAULT_DIR.toString()); } } + /** * create folders and files for the new device to generate @@ -739,7 +778,8 @@ public class NewTest extends javax.swing.JPanel { private javax.swing.JButton jButtonGenerate; private javax.swing.JComboBox jComboBoxTestSuites; private javax.swing.JMenuItem jMenuItemAddRow; - private javax.swing.JMenuItem jMenuItemReleteRow; + private javax.swing.JMenuItem jMenuItemDeleteRow; + private javax.swing.JPanel jPanel1; private javax.swing.JPopupMenu jPopupMenuTable; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane3; diff --git a/plugins/TestingList.form b/plugins/TestingList.form index 79a24de..93cf06b 100644 --- a/plugins/TestingList.form +++ b/plugins/TestingList.form @@ -241,7 +241,7 @@ </Constraint> </Constraints> </Component> - <Container class="javax.swing.JPanel" name="jPanel3"> + <Container class="javax.swing.JPanel" name="jPanelButtons"> <Properties> <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[0, 80]"/> diff --git a/plugins/TestingList.java b/plugins/TestingList.java index ff5e1f7..792c0f6 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -353,7 +353,7 @@ public class TestingList extends Panel { jTable1 = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); jButtonRun = new javax.swing.JButton(); - jPanel3 = new javax.swing.JPanel(); + jPanelButtons = new javax.swing.JPanel(); jButtonOptions = new javax.swing.JButton(); jButtonSave = new javax.swing.JButton(); jButtonOpen = new javax.swing.JButton(); @@ -532,9 +532,9 @@ public class TestingList extends Panel { }); jPanel1.add(jButtonRun, java.awt.BorderLayout.CENTER); - jPanel3.setMinimumSize(new java.awt.Dimension(0, 80)); - jPanel3.setPreferredSize(new java.awt.Dimension(100, 80)); - jPanel3.setLayout(new java.awt.BorderLayout()); + jPanelButtons.setMinimumSize(new java.awt.Dimension(0, 80)); + jPanelButtons.setPreferredSize(new java.awt.Dimension(100, 80)); + jPanelButtons.setLayout(new java.awt.BorderLayout()); jButtonOptions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/settings-32px.png"))); // NOI18N jButtonOptions.setMaximumSize(new java.awt.Dimension(60, 40)); @@ -545,7 +545,7 @@ public class TestingList extends Panel { jButtonOptionsActionPerformed(evt); } }); - jPanel3.add(jButtonOptions, java.awt.BorderLayout.LINE_START); + jPanelButtons.add(jButtonOptions, java.awt.BorderLayout.LINE_START); jButtonSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/android-save-24-000000.png"))); // NOI18N jButtonSave.setToolTipText("Save current configuration"); @@ -557,7 +557,7 @@ public class TestingList extends Panel { jButtonSaveActionPerformed(evt); } }); - jPanel3.add(jButtonSave, java.awt.BorderLayout.LINE_END); + jPanelButtons.add(jButtonSave, java.awt.BorderLayout.LINE_END); jButtonOpen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/folder-open-24-000000.png"))); // NOI18N jButtonOpen.setToolTipText("Open configuration"); @@ -568,9 +568,9 @@ public class TestingList extends Panel { jButtonOpenActionPerformed(evt); } }); - jPanel3.add(jButtonOpen, java.awt.BorderLayout.PAGE_END); + jPanelButtons.add(jButtonOpen, java.awt.BorderLayout.PAGE_END); - jPanel1.add(jPanel3, java.awt.BorderLayout.EAST); + jPanel1.add(jPanelButtons, java.awt.BorderLayout.EAST); jPanel2.setLayout(new java.awt.BorderLayout()); @@ -614,7 +614,7 @@ public class TestingList extends Panel { }// </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")) { + if (this.jButtonRun.getToolTipText().equals("Run enabled tests")) { setButtonToStart(); updateStatus(); executeTests(); @@ -623,9 +623,12 @@ public class TestingList extends Panel { } }//GEN-LAST:event_jButtonRunActionPerformed + /** + * reaction to Stop + */ private void setButtonToStop() { abort(); - this.jButtonRun.setToolTipText("Run selected tests"); + this.jButtonRun.setToolTipText("Run enabled tests"); jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/play-circled-64-000000.png"))); this.jTable1.setEnabled(true); this.jButtonOpen.setEnabled(true); @@ -633,6 +636,9 @@ public class TestingList extends Panel { this.jButtonSave.setEnabled(true); } + /** + * reaction to Start + */ private void setButtonToStart() { this.jButtonRun.setToolTipText("Stop tests"); jButtonRun.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/stop-circled-64-000000.png"))); @@ -863,7 +869,7 @@ public class TestingList extends Panel { private javax.swing.JMenu jMenuSelect; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanelButtons; private javax.swing.JPopupMenu jPopupMenuConfigs; private javax.swing.JPopupMenu jPopupMenuOptions; private javax.swing.JPopupMenu jPopupMenuTable; @@ -903,15 +909,11 @@ public class TestingList extends Panel { public void openNewTestEditor(String type){ try { - // NewTest nt = new NewTest(); - // nt.setVisible(true); JDialog dlg = new JDialog(getView(), "New Test", true); //create a class to visualise the details panel Class testingListDetailsClass = getController().getClassByName("NewTest"); - JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{type}); - + JPanel detailsPanel = (JPanel) testingListDetailsClass.getConstructor(new Class[]{String.class}).newInstance(new Object[]{type}); dlg.getContentPane().add(detailsPanel); - //dlg.add(new TestingListDetails()); dlg.pack(); dlg.setVisible(true); } catch (ClassNotFoundException ex) { @@ -929,7 +931,6 @@ public class TestingList extends Panel { } catch (InvocationTargetException ex) { Logger.getLogger(TestingList.class.getName()).log(Level.SEVERE, null, ex); } - } /** @@ -1659,12 +1660,12 @@ public class TestingList extends Panel { int iCounter = 0; //search devices and their tests //Scan the list of devices - File[] listOfFiles = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles(); - for (File listOfFile : listOfFiles) { + File[] listOfDevices = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles(); + for (File deviceInList : listOfDevices) { propDevice.clear(); - if (listOfFile.isFile()) { - } else if (listOfFile.isDirectory()) { - File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME)); + if (deviceInList.isFile()) { + } else if (deviceInList.isDirectory()) { + File configFile = new File(deviceInList.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME)); if (configFile.exists() && !configFile.isDirectory()) { InputStream is = new FileInputStream(configFile); propDevice.load(is); @@ -1673,10 +1674,10 @@ public class TestingList extends Panel { testsFolder = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile(); if (testsFolder.exists() && testsFolder.isDirectory()) { File[] listOfTests = testsFolder.listFiles(); - for (File listOfTest : listOfTests) { + for (File testinList : listOfTests) { propTest.clear(); - if (listOfTest.isDirectory()) { - configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME)); + if (testinList.isDirectory()) { + configFile = new File(testinList.getPath() + FilenameUtils.separatorsToSystem("/" + TESTS_CONFIG_FILENAME)); if (configFile.exists() && !configFile.isDirectory()) { InputStream ist = new FileInputStream(configFile); propTest.load(ist); @@ -1700,7 +1701,7 @@ public class TestingList extends Panel { } /** - * scan tests table and see if tests in the table still exist in directory. + * scan tests table and see if tests/devices in the table still exist in directory. * Remove from table the tests whose files do not exist in directories. * * @throws FileNotFoundException @@ -1716,15 +1717,14 @@ public class TestingList extends Panel { int iCounter = 0; //search devices and their tests //Scan the list of devices - File[] listOfFiles = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles(); - //first, collect all tests from files + File[] listOfDevices = TESTS_DEVICES_DEFAULT_DIR.toFile().listFiles(); + //collect all tests from files List<List> testsInDir = new ArrayList<List>(); List<String> testDetails = new ArrayList<String>(); - for (File listOfFile : listOfFiles) { + for (File deviceInList : listOfDevices) { propDevice.clear(); - if (listOfFile.isFile()) { - } else if (listOfFile.isDirectory()) { - File configFile = new File(listOfFile.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME)); + if (deviceInList.isDirectory()) { + File configFile = new File(deviceInList.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME)); if (configFile.exists() && !configFile.isDirectory()) { InputStream is = new FileInputStream(configFile); propDevice.load(is); @@ -1733,10 +1733,10 @@ public class TestingList extends Panel { testsFolder = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), propDevice.getProperty("tests")).toFile(); if (testsFolder.exists() && testsFolder.isDirectory()) { File[] listOfTests = testsFolder.listFiles(); - for (File listOfTest : listOfTests) { + for (File testinList : listOfTests) { propTest.clear(); - if (listOfTest.isDirectory()) { - configFile = new File(listOfTest.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME)); + if (testinList.isDirectory()) { + configFile = new File(testinList.getPath() + FilenameUtils.separatorsToSystem("/"+TESTS_CONFIG_FILENAME)); if (configFile.exists() && !configFile.isDirectory()) { InputStream ist = new FileInputStream(configFile); propTest.load(ist); @@ -1766,26 +1766,30 @@ public class TestingList extends Panel { //loop among the tests in the table for (row = 0; row < totalRows; row++) { bTestAlreadyInTable = false; - //deviceNameTable = model.getValueAt(row, COL.DEVICENAME.ordinal()).toString(); + deviceNameTable = model.getValueAt(row, COL.DEVICENAME.ordinal()).toString(); //testSuiteTable = model.getValueAt(row, COL.TESTSUITE.ordinal()).toString(); //testNameTable = model.getValueAt(row, COL.TESTNAME.ordinal()).toString(); testPathTable = model.getValueAt(row, COL.TESTPATH.ordinal()).toString(); //loop to compare current test in table with all tests in directory for (int i = 0; i < testsInDir.size(); i++) { deviceNameDir = testsInDir.get(i).get(0).toString(); - testSuiteDir = testsInDir.get(i).get(1).toString(); - testNameDir = testsInDir.get(i).get(2).toString(); - testPathDir = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), testSuiteDir, testNameDir, testNameDir + ".py").toString(); - bTestAlreadyInTable = (testPathDir.equals(testPathTable)); + testSuiteDir = testsInDir.get(i).get(1).toString(); + testNameDir = testsInDir.get(i).get(2).toString(); + testPathDir = Paths.get(TESTS_TESTS_DEFAULT_DIR.toString(), + testSuiteDir, testNameDir, testNameDir + ".py").toString(); + //check if the test files and device files corresponding to the current test row exist + bTestAlreadyInTable = (testPathDir.equals(testPathTable) && deviceNameDir.equals(deviceNameTable)); if (bTestAlreadyInTable) { break; } } if (!bTestAlreadyInTable) { - //this test in table does not exist any more in the tests directory: remove + //this test in table does not exist any more in the tests directory or in the device directory: remove model.removeRow(row); totalRows = model.getRowCount(); + row=0; } + } }