jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1753308 - in /jmeter/trunk: src/components/org/apache/jmeter/assertions/gui/ src/components/org/apache/jmeter/modifiers/gui/ src/core/org/apache/jmeter/config/gui/ src/core/org/apache/jmeter/testbeans/gui/ src/protocol/http/org/apache/jmet...
Date Mon, 18 Jul 2016 19:41:09 GMT
Author: fschumacher
Date: Mon Jul 18 19:41:08 2016
New Revision: 1753308

URL: http://svn.apache.org/viewvc?rev=1753308&view=rev
Log:
Reduce duplicated code by using the newly added method GuiUtils#cancelEditing.
Contributed by Benoit Wiart (b.wiart at ubik-ingenierie.com)

This closes #215 on github.

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
    jmeter/trunk/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/AssertionGui.java Mon Jul
18 19:41:08 2016
@@ -408,10 +408,7 @@ public class AssertionGui extends Abstra
     private class ClearPatternsListener implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (stringTable.isEditing()) {
-                TableCellEditor cellEditor = stringTable.getCellEditor(stringTable.getEditingRow(),
stringTable.getEditingColumn());
-                cellEditor.cancelCellEditing();
-            }
+            GuiUtils.cancelEditing(stringTable);
             
             int[] rowsSelected = stringTable.getSelectedRows();
             stringTable.clearSelection();

Modified: jmeter/trunk/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/modifiers/gui/UserParametersGui.java Mon
Jul 18 19:41:08 2016
@@ -329,11 +329,7 @@ public class UserParametersGui extends A
     private class DeleteRowAction implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (paramTable.isEditing()) {
-                TableCellEditor cellEditor = paramTable.getCellEditor(paramTable.getEditingRow(),
paramTable
-                        .getEditingColumn());
-                cellEditor.cancelCellEditing();
-            }
+            GuiUtils.cancelEditing(paramTable);
 
             int rowSelected = paramTable.getSelectedRow();
             if (rowSelected >= 0) {
@@ -363,11 +359,7 @@ public class UserParametersGui extends A
     private class DeleteColumnAction implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent e) {
-            if (paramTable.isEditing()) {
-                TableCellEditor cellEditor = paramTable.getCellEditor(paramTable.getEditingRow(),
paramTable
-                        .getEditingColumn());
-                cellEditor.cancelCellEditing();
-            }
+            GuiUtils.cancelEditing(paramTable);
 
             int colSelected = paramTable.getSelectedColumn();
             if (colSelected == 0 || colSelected == 1) {

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=1753308&r1=1753307&r2=1753308&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 Mon Jul 18 19:41:08
2016
@@ -367,17 +367,6 @@ public class ArgumentsPanel extends Abst
         }
     }
 
-    /**
-     * Cancel cell editing if it is being edited
-     */
-    private void cancelEditing() {
-        // If a table cell is being edited, we must cancel the editing before
-        // deleting the row
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
-    }
     
     /**
      * Move a row down
@@ -476,7 +465,7 @@ public class ArgumentsPanel extends Abst
      * Remove the currently selected argument from the table.
      */
     protected void deleteArgument() {
-        cancelEditing();
+        GuiUtils.cancelEditing(table);
 
         int[] rowsSelected = table.getSelectedRows();
         int anchorSelection = table.getSelectionModel().getAnchorSelectionIndex();

Modified: jmeter/trunk/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/gui/SimpleConfigGui.java Mon Jul 18 19:41:08
2016
@@ -279,10 +279,7 @@ public class SimpleConfigGui extends Abs
     protected void deleteArgument() {
         // If a table cell is being edited, we must cancel the editing before
         // deleting the row
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
+        GuiUtils.cancelEditing(table);
 
         int rowSelected = table.getSelectedRow();
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TableEditor.java Mon Jul 18 19:41:08
2016
@@ -376,7 +376,7 @@ public class TableEditor extends Propert
     private class UpListener implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent e) {
-            cancelEditing();
+            GuiUtils.cancelEditing(table);
 
             int[] rowsSelected = table.getSelectedRows();
             if (rowsSelected.length > 0 && rowsSelected[0] > 0) {
@@ -394,7 +394,7 @@ public class TableEditor extends Propert
     private class DownListener implements ActionListener {
         @Override
         public void actionPerformed(ActionEvent e) {
-            cancelEditing();
+            GuiUtils.cancelEditing(table);
             
             int[] rowsSelected = table.getSelectedRows();
             if (rowsSelected.length > 0 && rowsSelected[rowsSelected.length -
1] < table.getRowCount() - 1) {
@@ -415,16 +415,4 @@ public class TableEditor extends Propert
         this.model.clearData();
     }
     
-    /**
-     * Cancel cell editing if it is being edited
-     */
-    private void cancelEditing() {
-        // If a table cell is being edited, we must cancel the editing before
-        // deleting the row
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
-    }
-
 }

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/AuthPanel.java Mon
Jul 18 19:41:08 2016
@@ -184,7 +184,7 @@ public class AuthPanel extends AbstractC
     protected void deleteRows() {
         // If a table cell is being edited, we must cancel the editing
         // before deleting the row.
-        cancelEditing();
+        GuiUtils.cancelEditing(authTable);
 
         int[] rowsSelected = authTable.getSelectedRows();
         int anchorSelection = authTable.getSelectionModel().getAnchorSelectionIndex();
@@ -208,15 +208,6 @@ public class AuthPanel extends AbstractC
         }
     }
 
-    /**
-     * If a table cell is being edited, we must cancel the editing before deleting the row
-     */
-    private void cancelEditing() {
-        if (authTable.isEditing()) {
-            TableCellEditor cellEditor = authTable.getCellEditor(authTable.getEditingRow(),
authTable.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
-    }
 
     private void checkButtonsStatus() {
         // Disable DELETE if there are no rows in the table to delete.

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java Mon
Jul 18 19:41:08 2016
@@ -150,11 +150,7 @@ public class CookiePanel extends Abstrac
             if (tableModel.getRowCount() > 0) {
                 // If a table cell is being edited, we must cancel the editing
                 // before deleting the row.
-                if (cookieTable.isEditing()) {
-                    TableCellEditor cellEditor = cookieTable.getCellEditor(cookieTable.getEditingRow(),
-                            cookieTable.getEditingColumn());
-                    cellEditor.cancelCellEditing();
-                }
+                GuiUtils.cancelEditing(cookieTable);
 
                 int rowSelected = cookieTable.getSelectedRow();
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/DNSCachePanel.java
Mon Jul 18 19:41:08 2016
@@ -282,11 +282,7 @@ public class DNSCachePanel extends Abstr
             if (dnsServersTableModel.getRowCount() > 0) {
                 // If a table cell is being edited, we must cancel the editing
                 // before deleting the row.
-                if (dnsServersTable.isEditing()) {
-                    TableCellEditor cellEditor = dnsServersTable.getCellEditor(dnsServersTable.getEditingRow(),
-                            dnsServersTable.getEditingColumn());
-                    cellEditor.cancelCellEditing();
-                }
+                GuiUtils.cancelEditing(dnsServersTable);
 
                 int rowSelected = dnsServersTable.getSelectedRow();
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java
Mon Jul 18 19:41:08 2016
@@ -249,10 +249,8 @@ public class HTTPFileArgsPanel extends J
     private void runCommandOnSelectedFile(String command) {
         // If a table cell is being edited, we must cancel the editing before
         // deleting the row
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
+        GuiUtils.cancelEditing(table);
+
         int rowSelected = table.getSelectedRow();
         if (rowSelected >= 0) {
             runCommandOnRow(command, rowSelected);

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java
(original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/control/gui/JMSPropertiesPanel.java
Mon Jul 18 19:41:08 2016
@@ -136,11 +136,7 @@ public class JMSPropertiesPanel extends
             if (tableModel.getRowCount() > 0) {
                 // If a table cell is being edited, we must cancel the editing
                 // before deleting the row.
-                if (jmsPropertiesTable.isEditing()) {
-                    TableCellEditor cellEditor = jmsPropertiesTable.getCellEditor(jmsPropertiesTable.getEditingRow(),
jmsPropertiesTable
-                            .getEditingColumn());
-                    cellEditor.cancelCellEditing();
-                }
+                GuiUtils.cancelEditing(jmsPropertiesTable);
 
                 int rowSelected = jmsPropertiesTable.getSelectedRow();
 

Modified: jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java
(original)
+++ jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java
Mon Jul 18 19:41:08 2016
@@ -209,10 +209,7 @@ public class LDAPArgumentsPanel extends
     private void deleteArgument() {
         // If a table cell is being edited, we must cancel the editing before
         // deleting the row
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.cancelCellEditing();
-        }
+        GuiUtils.cancelEditing(table);
 
         int rowSelected = table.getSelectedRow();
         if (rowSelected >= 0) {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1753308&r1=1753307&r2=1753308&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Mon Jul 18 19:41:08 2016
@@ -123,7 +123,9 @@ Summary
 
 <ch_section>Non-functional changes</ch_section>
 <ul>
-<li>Updated to tika-core and tika-parsers 1.13 (from 1.12)</li>
+    <li>Updated to tika-core and tika-parsers 1.13 (from 1.12)</li>
+    <li><pr>215</pr>Reduce duplicated code by using the newly added method
<code>GuiUtils#cancelEditing</code>.
+    Contributed by Benoit Wiart (b.wiart at ubik-ingenierie.com)</li>
 </ul>
  
  <!-- =================== Bug fixes =================== -->



Mime
View raw message