jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1724599 - in /jmeter/trunk: src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java xdocs/changes.xml
Date Thu, 14 Jan 2016 13:11:03 GMT
Author: pmouawad
Date: Thu Jan 14 13:11:03 2016
New Revision: 1724599

URL: http://svn.apache.org/viewvc?rev=1724599&view=rev
Log:
Bug 58844 - Buttons enable / disable is broken in the arguments panel 
#resolve #69
Bugzilla Id: 58844

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java?rev=1724599&r1=1724598&r2=1724599&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java Thu Jan 14 13:11:03
2016
@@ -87,11 +87,14 @@ public class ArgumentsPanel extends Abst
      */
     private final boolean standalone;
 
-    /** Button to move a argument up*/
+    /** Button to move an argument up*/
     private JButton up;
 
-    /** Button to move a argument down*/
+    /** Button to move an argument down*/
     private JButton down;
+    
+    /** Button to show the detail of an argument*/
+    private JButton showDetail;
 
     private final boolean enableUpDown;
 
@@ -242,8 +245,7 @@ public class ArgumentsPanel extends Abst
      * querying the Test Element object for the relevant information to display
      * in its GUI.
      *
-     * @param el
-     *            the TestElement to configure
+     * @param el the TestElement to configure
      */
     @Override
     public void configure(TestElement el) {
@@ -299,17 +301,31 @@ public class ArgumentsPanel extends Abst
      * Enable or disable the delete button depending on whether or not there is
      * a row to be deleted.
      */
+    @Deprecated
     protected void checkDeleteStatus() {
+       checkButtonsStatus();
+    }
+    
+    
+    protected void checkButtonsStatus() {
         // Disable DELETE if there are no rows in the table to delete.
         if (tableModel.getRowCount() == 0) {
             delete.setEnabled(false);
+            showDetail.setEnabled(false);
         } else {
             delete.setEnabled(true);
+            showDetail.setEnabled(true);
         }
         
-        if(enableUpDown && tableModel.getRowCount()>1) {
-            up.setEnabled(true);
-            down.setEnabled(true);
+        if(enableUpDown) {
+            if(tableModel.getRowCount()>1) {
+                up.setEnabled(true);
+                down.setEnabled(true);
+            }
+            else {
+                up.setEnabled(false);
+                down.setEnabled(false);
+            }
         }
     }
 
@@ -331,8 +347,7 @@ public class ArgumentsPanel extends Abst
      * Invoked when an action occurs. This implementation supports the add and
      * delete buttons.
      *
-     * @param e
-     *            the event that has occurred
+     * @param e the event that has occurred
      */
     @Override
     public void actionPerformed(ActionEvent e) {
@@ -429,23 +444,16 @@ public class ArgumentsPanel extends Abst
                 tableModel.removeRow(rowsSelected[i]);
             }
 
-            // Disable DELETE if there are no rows in the table to delete.
-            if (tableModel.getRowCount() == 0) {
-                delete.setEnabled(false);
-            }
             // Table still contains one or more rows, so highlight (select)
             // the appropriate one.
-            else if (tableModel.getRowCount() > 0) {
+            if (tableModel.getRowCount() > 0) {
                 if (anchorSelection >= tableModel.getRowCount()) {
                     anchorSelection = tableModel.getRowCount() - 1;
                 }
                 table.setRowSelectionInterval(anchorSelection, anchorSelection);
             }
             
-            if(enableUpDown && tableModel.getRowCount()>1) {
-                up.setEnabled(true);
-                down.setEnabled(true);
-            }
+            checkButtonsStatus();
         }
     }
 
@@ -459,14 +467,9 @@ public class ArgumentsPanel extends Abst
 
         tableModel.addRow(makeNewArgument());
 
-        // Enable DELETE (which may already be enabled, but it won't hurt)
-        delete.setEnabled(true);
-        if(enableUpDown && tableModel.getRowCount()>1) {
-            up.setEnabled(true);
-            down.setEnabled(true);
-        }
+        checkButtonsStatus();
         
-        // Highlight (select) and scroll the appropriate row.
+        // Highlight (select) and scroll to the appropriate row.
         int rowToSelect = tableModel.getRowCount() - 1;
         table.setRowSelectionInterval(rowToSelect, rowToSelect);
         table.scrollRectToVisible(table.getCellRect(rowToSelect, 0, true));
@@ -492,8 +495,7 @@ public class ArgumentsPanel extends Abst
                 }
             }
             if (table.getRowCount() > rowCount) {
-                // Enable DELETE (which may already be enabled, but it won't hurt)
-                delete.setEnabled(true);
+                checkButtonsStatus();
 
                 // Highlight (select) and scroll to the appropriate rows.
                 int rowToSelect = tableModel.getRowCount() - 1;
@@ -545,9 +547,9 @@ public class ArgumentsPanel extends Abst
      * Initialize the table model used for the arguments table.
      */
     protected void initializeTableModel() {
-    if (tableModel == null) {
-        if(standalone) {
-            tableModel = new ObjectTableModel(new String[] { COLUMN_RESOURCE_NAMES_0, COLUMN_RESOURCE_NAMES_1,
COLUMN_RESOURCE_NAMES_2 },
+        if (tableModel == null) {
+            if(standalone) {
+                tableModel = new ObjectTableModel(new String[] { COLUMN_RESOURCE_NAMES_0,
COLUMN_RESOURCE_NAMES_1, COLUMN_RESOURCE_NAMES_2 },
                     Argument.class,
                     new Functor[] {
                     new Functor("getName"), // $NON-NLS-1$
@@ -558,8 +560,8 @@ public class ArgumentsPanel extends Abst
                     new Functor("setValue"), // $NON-NLS-1$
                     new Functor("setDescription") },  // $NON-NLS-1$
                     new Class[] { String.class, String.class, String.class });
-        } else {
-            tableModel = new ObjectTableModel(new String[] { COLUMN_RESOURCE_NAMES_0, COLUMN_RESOURCE_NAMES_1
},
+            } else {
+                tableModel = new ObjectTableModel(new String[] { COLUMN_RESOURCE_NAMES_0,
COLUMN_RESOURCE_NAMES_1 },
                     Argument.class,
                     new Functor[] {
                     new Functor("getName"), // $NON-NLS-1$
@@ -581,8 +583,7 @@ public class ArgumentsPanel extends Abst
     /**
      * Resize the table columns to appropriate widths.
      *
-     * @param _table
-     *            the table to resize columns for
+     * @param _table the table to resize columns for
      */
     protected void sizeColumns(JTable _table) {
     }
@@ -623,14 +624,15 @@ public class ArgumentsPanel extends Abst
      * @return a GUI panel containing the buttons
      */
     private JPanel makeButtonPanel() {
-        JButton showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$
+        showDetail = new JButton(JMeterUtils.getResString("detail")); // $NON-NLS-1$
         showDetail.setActionCommand(DETAIL);
         showDetail.setEnabled(true);
         
         add = new JButton(JMeterUtils.getResString("add")); // $NON-NLS-1$
         add.setActionCommand(ADD);
         add.setEnabled(true);
-        /** A button for adding new arguments to the table from the clipboard. */
+        
+        // A button for adding new arguments to the table from the clipboard
         JButton addFromClipboard = new JButton(JMeterUtils.getResString("add_from_clipboard"));
// $NON-NLS-1$
         addFromClipboard.setActionCommand(ADD_FROM_CLIPBOARD);
         addFromClipboard.setEnabled(true);
@@ -645,7 +647,7 @@ public class ArgumentsPanel extends Abst
             down = new JButton(JMeterUtils.getResString("down")); // $NON-NLS-1$
             down.setActionCommand(DOWN);
         }
-        checkDeleteStatus();
+        checkButtonsStatus();
 
         JPanel buttonPanel = new JPanel();
         buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java?rev=1724599&r1=1724598&r2=1724599&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
Thu Jan 14 13:11:03 2016
@@ -130,7 +130,7 @@ public class HTTPArgumentsPanel extends
                 tableModel.addRow(arg);
             }
         }
-        checkDeleteStatus();
+        checkButtonsStatus();
     }
 
     protected boolean isMetaDataNormal(HTTPArgument arg) {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1724599&r1=1724598&r2=1724599&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Jan 14 13:11:03 2016
@@ -214,6 +214,7 @@ Summary
     <li><bug>58453</bug>HTTP Test Script Recorder : NullPointerException
when disabling Capture HTTP Headers </li>
     <li><bug>57804</bug>HTTP Request doesn't reuse cached SSL context when
using Client Certificates in HTTPS (only fixed for HttpClient4 implementation)</li>
     <li><bug>58800</bug>proxy.pause default value , fix documentation</li>
+    <li><bug>58844</bug>Buttons enable / disable is broken in the arguments
panel. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 </ul>
 
 <h3>Other Samplers</h3>



Mime
View raw message