Hello,
With last commit (r1023592) it's possible to add this behavior on
Arguments Panel (in HTTP sampler and Java sampler):
* When user double click in the table on a cell which has a String
value, JMeter display a text box to edit the value.
It's more user-friendly for a long parameter value (like SOAP parameter,
or values from dev web framework (spring, struts, etc))
But, this new functionality will remove the default behavior : actually
a double click on cell allows inline editing (directly in cell). Now if
you want a edit directly on cell, you must use F2 key.
I think that this text box functionality is good, and improve JMeter.
What is your opinion ?
(I have attached the patch (only 1 new line) to ArgumentsPanel if you
want test)
Thanks
Milamber
-------- Original Message --------
Subject: svn commit: r1023592 -
/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
Date: Sun, 17 Oct 2010 22:36:36 -0000
From: [email protected]
Reply-To: [email protected]
To: [email protected]
Author: milamber
Date: Sun Oct 17 22:36:35 2010
New Revision: 1023592
URL: http://svn.apache.org/viewvc?rev=1023592&view=rev
Log:
Adding a new inner class to allow display a text box to edit cell content in
Jtable (futur use in ArgumentsPanel)
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
Modified:
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java?rev=1023592&r1=1023591&r2=1023592&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
(original)
+++
jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/util/TextBoxDialoger.java
Sun Oct 17 22:36:35 2010
@@ -86,8 +86,8 @@ public class TextBoxDialoger implements
* @param editable - allow to modify text
*/
public TextBoxDialoger(String text, boolean editable) {
- init(text);
this.editable = editable;
+ init(text);
}
private void init(String text) {
@@ -191,5 +191,36 @@ public class TextBoxDialoger implements
}
}
+ /**
+ * Class to edit in a dialog box the cell's content
+ * when double (pressed) click on a table's cell which is editable
+ *
+ */
+ public static class TextBoxDoubleClickPressed extends MouseAdapter {
+
+ private JTable table = null;
+
+ public TextBoxDoubleClickPressed(JTable table) {
+ super();
+ this.table = table;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ if (e.getClickCount() == 2) { // double (pressed) click
+ TableModel tm = table.getModel();
+ Object value = tm.getValueAt(table.getSelectedRow(),
table.getSelectedColumn());
+ if (value instanceof String) {
+ if (table.getCellEditor() != null) {
+ table.getCellEditor().cancelCellEditing(); // in main
table (evt mousePressed because cell is editable)
+ }
+ TextBoxDialoger tbd = new
TextBoxDialoger(value.toString(), true);
+ tm.setValueAt(tbd.getTextBox(), table.getSelectedRow(),
table.getSelectedColumn());
+ } // else do nothing (cell isn't a string to edit)
+ }
+ }
+
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Index: src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
===================================================================
--- src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java (revision 1021540)
+++ src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java (working copy)
@@ -39,6 +39,7 @@
import org.apache.jmeter.config.Argument;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.gui.util.HeaderAsPropertyRenderer;
+import org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClickPressed;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.property.PropertyIterator;
import org.apache.jmeter.util.JMeterUtils;
@@ -382,6 +383,7 @@
private Component makeMainPanel() {
initializeTableModel();
table = new JTable(tableModel);
+ table.addMouseListener(new TextBoxDoubleClickPressed(table)); // use a text box dialog to edit
table.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
if (this.background != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]