diff --git a/plugins/TestingList.form b/plugins/TestingList.form index 37be5cb..ba11e2a 100644 --- a/plugins/TestingList.form +++ b/plugins/TestingList.form @@ -147,11 +147,12 @@ - + + @@ -162,17 +163,21 @@ + + + - + + @@ -183,6 +188,9 @@ + + + diff --git a/plugins/TestingList.java b/plugins/TestingList.java index aa162d0..ccad803 100644 --- a/plugins/TestingList.java +++ b/plugins/TestingList.java @@ -249,8 +249,8 @@ public class TestingList extends Panel { jButtonOpenLog = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jCheckBox1 = new javax.swing.JCheckBox(); - jButton2 = new javax.swing.JButton(); - jButton1 = new javax.swing.JButton(); + jButtonMoveDown = new javax.swing.JButton(); + jButtonMoveUp = new javax.swing.JButton(); setLayout(new java.awt.BorderLayout()); @@ -345,17 +345,29 @@ public class TestingList extends Panel { }); jPanel2.add(jCheckBox1, java.awt.BorderLayout.WEST); - jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/ArrowDown - 24.png"))); // NOI18N - jButton2.setMaximumSize(new java.awt.Dimension(25, 25)); - jButton2.setMinimumSize(new java.awt.Dimension(25, 25)); - jButton2.setPreferredSize(new java.awt.Dimension(25, 25)); - jPanel2.add(jButton2, java.awt.BorderLayout.SOUTH); + jButtonMoveDown.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/ArrowDown - 24.png"))); // NOI18N + jButtonMoveDown.setToolTipText("Move the selected tests down"); + jButtonMoveDown.setMaximumSize(new java.awt.Dimension(25, 25)); + jButtonMoveDown.setMinimumSize(new java.awt.Dimension(25, 25)); + jButtonMoveDown.setPreferredSize(new java.awt.Dimension(25, 25)); + jButtonMoveDown.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonMoveDownActionPerformed(evt); + } + }); + jPanel2.add(jButtonMoveDown, java.awt.BorderLayout.SOUTH); - jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/ArrowUp - 24.png"))); // NOI18N - jButton1.setMaximumSize(new java.awt.Dimension(25, 25)); - jButton1.setMinimumSize(new java.awt.Dimension(25, 25)); - jButton1.setPreferredSize(new java.awt.Dimension(25, 25)); - jPanel2.add(jButton1, java.awt.BorderLayout.PAGE_START); + jButtonMoveUp.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/ArrowUp - 24.png"))); // NOI18N + jButtonMoveUp.setToolTipText("Move the selected tests up"); + jButtonMoveUp.setMaximumSize(new java.awt.Dimension(25, 25)); + jButtonMoveUp.setMinimumSize(new java.awt.Dimension(25, 25)); + jButtonMoveUp.setPreferredSize(new java.awt.Dimension(25, 25)); + jButtonMoveUp.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonMoveUpActionPerformed(evt); + } + }); + jPanel2.add(jButtonMoveUp, java.awt.BorderLayout.PAGE_START); jPanel1.add(jPanel2, java.awt.BorderLayout.LINE_START); @@ -442,9 +454,17 @@ public class TestingList extends Panel { if (colIndex == COL.CHECK.ordinal()) updateStatus(); }//GEN-LAST:event_jTable1KeyReleased + private void jButtonMoveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMoveDownActionPerformed + moveDown(); + }//GEN-LAST:event_jButtonMoveDownActionPerformed + + private void jButtonMoveUpActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonMoveUpActionPerformed + moveUp(); + }//GEN-LAST:event_jButtonMoveUpActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton jButton1; - private javax.swing.JButton jButton2; + private javax.swing.JButton jButtonMoveDown; + private javax.swing.JButton jButtonMoveUp; private javax.swing.JButton jButtonOpenLog; private javax.swing.JButton jButtonRun; private javax.swing.JCheckBox jCheckBox1; @@ -454,10 +474,24 @@ public class TestingList extends Panel { 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"); } + + 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); + } + 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); + } //show test result in table public int showResult(String deviceName, String testName, String res, String status) {