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:36 UTC

svn commit: r1385288 - in /jmeter/trunk/src: jorphan/org/apache/jorphan/gui/GuiUtils.java protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java

Author: pmouawad
Date: Sun Sep 16 15:52:35 2012
New Revision: 1385288

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

Modified:
    jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java
    jmeter/trunk/src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java

Modified: jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java?rev=1385288&r1=1385287&r2=1385288&view=diff
==============================================================================
--- jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java (original)
+++ jmeter/trunk/src/jorphan/org/apache/jorphan/gui/GuiUtils.java Sun Sep 16 15:52:35 2012
@@ -28,10 +28,11 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 import javax.swing.JTable;
 import javax.swing.border.EmptyBorder;
+import javax.swing.table.TableCellEditor;
 import javax.swing.table.TableCellRenderer;
 import javax.swing.table.TableColumn;
 
-public class GuiUtils {
+public final class GuiUtils {
 
     /**
      * Create a scroll panel that sets its preferred size to its minimum size.
@@ -87,4 +88,14 @@ public class GuiUtils {
         return labelCombo;
     }
 
+    /**
+     * Stop any editing that is currently being done on the table. This will
+     * save any changes that have already been made.
+     */
+    public static void stopTableEditing(JTable table) {
+        if (table.isEditing()) {
+            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
+            cellEditor.stopCellEditing();
+        }
+    }
 }

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=1385288&r1=1385287&r2=1385288&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 Sun Sep 16 15:52:35 2012
@@ -40,6 +40,7 @@ import org.apache.jmeter.gui.util.Header
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.testelement.property.PropertyIterator;
 import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.gui.GuiUtils;
 import org.apache.jorphan.gui.ObjectTableModel;
 import org.apache.jorphan.reflect.Functor;
 
@@ -128,7 +129,7 @@ public class LDAPArgumentsPanel extends 
 
     /* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
     public void modifyTestElement(TestElement args) {
-        stopTableEditing();
+        GuiUtils.stopTableEditing(table);
         LDAPArguments arguments = null;
         if (args instanceof LDAPArguments) {
             arguments = (LDAPArguments) args;
@@ -244,7 +245,7 @@ public class LDAPArgumentsPanel extends 
     private void addArgument() {
         // 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(makeNewLDAPArgument());
 
@@ -266,17 +267,6 @@ public class LDAPArgumentsPanel extends 
     }
 
     /**
-     * Stop any editing that is currently being done on the table. This will
-     * save any changes that have already been made.
-     */
-    private void stopTableEditing() {
-        if (table.isEditing()) {
-            TableCellEditor cellEditor = table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
-            cellEditor.stopCellEditing();
-        }
-    }
-
-    /**
      * Initialize the table model used for the arguments table.
      */
     private void initializeTableModel() {