On 21 August 2013 13:29, <[email protected]> wrote:
> Author: pmouawad
> Date: Wed Aug 21 12:29:52 2013
> New Revision: 1516145
>
> URL: http://svn.apache.org/r1516145
> Log:
> Bug 55459 - Elements using ComboStringEditor lose the input value if user
> selects another Test Element
> Rollback change using Editor to access value
> Replace requestFocus() by requestFocusInWindow()
> Bugzilla Id: 55459
>
> Modified:
>
> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java
>
> Modified:
> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java
> URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java?rev=1516145&r1=1516144&r2=1516145&view=diff
> ==============================================================================
> ---
> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java
> (original)
> +++
> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java
> Wed Aug 21 12:29:52 2013
> @@ -183,11 +183,7 @@ class ComboStringEditor extends Property
> return tags[item-minTagIndex];
> }
> // Not a tag entry, return the original value
> - // combo.getSelectedItem() javadocs says:
> - // If the combo box is editable, then this value may not have been
> added to the combo box
> - // with addItem, insertItemAt or the data constructors.
> - JTextComponent textField = (JTextComponent)
> combo.getEditor().getEditorComponent();
> - return textField.getText();
> + return (String) value;
> }
>
> /**
> @@ -241,7 +237,7 @@ class ComboStringEditor extends Property
>
> combo.setEditable(true);
>
> - textField.requestFocus();
> + textField.requestFocusInWindow();
I see that requestFocus() is discouraged as it is platform dependent.
Code should call requestFocusInWindow() instead.
We should probably change all the other occurrences; I'll raise a bug.
This does not fix the issue; but adding requestFocusInWindow() to
JMeterTreeListener seems to have done the trick.
> String text = translate(initialEditValue);
> if (text == null) {
> text = ""; // will revert to last valid value if invalid
>
>