You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2012/09/16 17:52:53 UTC

svn commit: r1385289 - in /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http: gui/AuthPanel.java gui/CookiePanel.java gui/HTTPFileArgsPanel.java gui/HeaderPanel.java proxy/gui/ProxyControlGui.java

Author: pmouawad
Date: Sun Sep 16 15:52:53 2012
New Revision: 1385289

URL: http://svn.apache.org/viewvc?rev=1385289&view=rev
Log:
Factor out stopTableEditing

Modified:
    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/HTTPFileArgsPanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HeaderPanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java

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=1385289&r1=1385288&r2=1385289&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 Sun Sep 16 15:52:53 2012
@@ -47,6 +47,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.Authorization;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -103,9 +104,7 @@ public class AuthPanel extends AbstractC
      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
      */
     public void modifyTestElement(TestElement el) {
-        if (authTable.isEditing()) {
-            authTable.getCellEditor().stopCellEditing();
-        }
+        GuiUtils.stopTableEditing(authTable);
         el.clear();
         el.addTestElement((TestElement) tableModel.manager.clone());
         configureTestElement(el);
@@ -191,11 +190,7 @@ public class AuthPanel extends AbstractC
         } else if (action.equals(ADD_COMMAND)) {
             // If a table cell is being edited, we should accept the current
             // value and stop the editing before adding a new row.
-            if (authTable.isEditing()) {
-                TableCellEditor cellEditor = authTable.getCellEditor(authTable.getEditingRow(), authTable
-                        .getEditingColumn());
-                cellEditor.stopCellEditing();
-            }
+            GuiUtils.stopTableEditing(authTable);
 
             tableModel.addNewRow();
             tableModel.fireTableDataChanged();

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=1385289&r1=1385288&r2=1385289&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 Sun Sep 16 15:52:53 2012
@@ -186,11 +186,7 @@ public class CookiePanel extends Abstrac
         } else if (action.equals(ADD_COMMAND)) {
             // If a table cell is being edited, we should accept the current
             // value and stop the editing before adding a new row.
-            if (cookieTable.isEditing()) {
-                TableCellEditor cellEditor = cookieTable.getCellEditor(cookieTable.getEditingRow(),
-                        cookieTable.getEditingColumn());
-                cellEditor.stopCellEditing();
-            }
+            GuiUtils.stopTableEditing(cookieTable);
 
             tableModel.addNewRow();
             tableModel.fireTableDataChanged();
@@ -250,9 +246,7 @@ public class CookiePanel extends Abstrac
      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
      */
     public void modifyTestElement(TestElement cm) {
-        if (cookieTable.isEditing()) {
-            cookieTable.getCellEditor().stopCellEditing();
-        }
+        GuiUtils.stopTableEditing(cookieTable);
         cm.clear();
         configureTestElement(cm);
         if (cm instanceof CookieManager) {

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=1385289&r1=1385288&r2=1385289&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 Sun Sep 16 15:52:53 2012
@@ -152,7 +152,7 @@ public class HTTPFileArgsPanel extends J
      * @param testElement
      */
     public void modifyTestElement(TestElement testElement) {
-        stopTableEditing();
+        GuiUtils.stopTableEditing(table);
         if (testElement instanceof HTTPSamplerBase) {
             HTTPSamplerBase base = (HTTPSamplerBase) testElement;
             int rows = tableModel.getRowCount();
@@ -208,7 +208,7 @@ public class HTTPFileArgsPanel extends J
      * Clear all rows from the table.
      */
     public void clear() {
-        stopTableEditing();
+        GuiUtils.stopTableEditing(table);
         tableModel.clearData();
     }
 
@@ -285,7 +285,7 @@ public class HTTPFileArgsPanel extends J
     private void addFile(String path) {
         // If a table cell is being edited, we should accept the current value
         // and stop the editing before adding a new row.
-        stopTableEditing();
+        GuiUtils.stopTableEditing(table);
 
         tableModel.addRow(new HTTPFileArg(path));
 
@@ -317,17 +317,6 @@ public class HTTPFileArgsPanel extends J
     }
 
     /**
-     * Stop any editing that is currently being done on the table. This will
-     * save any changes that have already been made.
-     */
-    protected void stopTableEditing() {
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.stopCellEditing();
-        }
-    }
-
-    /**
      * Create the main GUI panel which contains the file table.
      *
      * @return the main GUI panel

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HeaderPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HeaderPanel.java?rev=1385289&r1=1385288&r2=1385289&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HeaderPanel.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HeaderPanel.java Sun Sep 16 15:52:53 2012
@@ -41,6 +41,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -94,9 +95,7 @@ public class HeaderPanel extends Abstrac
      * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
      */
     public void modifyTestElement(TestElement el) {
-        if (headerTable.isEditing()) {// Bug 41905
-            headerTable.getCellEditor().stopCellEditing();
-        }
+        GuiUtils.stopTableEditing(headerTable);
         el.clear();
         el.addTestElement(headerManager);
         configureTestElement(el);
@@ -179,11 +178,7 @@ public class HeaderPanel extends Abstrac
         } else if (action.equals(ADD_COMMAND)) {
             // If a table cell is being edited, we should accept the current
             // value and stop the editing before adding a new row.
-            if (headerTable.isEditing()) {
-                TableCellEditor cellEditor = headerTable.getCellEditor(headerTable.getEditingRow(),
-                        headerTable.getEditingColumn());
-                cellEditor.stopCellEditing();
-            }
+            GuiUtils.stopTableEditing(headerTable);
 
             tableModel.addNewRow();
             tableModel.fireTableDataChanged();

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev=1385289&r1=1385288&r2=1385289&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java Sun Sep 16 15:52:53 2012
@@ -66,6 +66,7 @@ import org.apache.jmeter.testelement.Tes
 import org.apache.jmeter.testelement.WorkBench;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -217,12 +218,8 @@ public class ProxyControlGui extends Log
     /** {@inheritDoc} */
     @Override
     public void modifyTestElement(TestElement el) {
-        if (excludeTable.isEditing()) {// Bug 42948
-            excludeTable.getCellEditor().stopCellEditing();
-        }
-        if (includeTable.isEditing()) {// Bug 42948
-            includeTable.getCellEditor().stopCellEditing();
-        }
+        GuiUtils.stopTableEditing(excludeTable);
+        GuiUtils.stopTableEditing(includeTable);
         configureTestElement(el);
         if (el instanceof ProxyControl) {
             model = (ProxyControl) el;
@@ -706,7 +703,7 @@ public class ProxyControlGui extends Log
 
         return panel;
     }
-
+    
     private JPanel createTableButtonPanel(String addCommand, String deleteCommand) {
         JPanel buttonPanel = new JPanel();