jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: svn commit: r1516145 - /jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/ComboStringEditor.java
Date Wed, 21 Aug 2013 15:10:21 GMT
On Wed, Aug 21, 2013 at 3:43 PM, sebb <sebbaz@gmail.com> wrote:

> On 21 August 2013 13:29,  <pmouawad@apache.org> 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.
>
I had already done the changes locally, will commit this evening.

> We should probably change all the other occurrences; I'll raise a bug.
>
> Agree

> This does not fix the issue; but adding requestFocusInWindow() to
> JMeterTreeListener seems to have done the trick.
>

Well frankly, I reviewed the changes made by the bug we think introduced
the regression. I think it requires a double check.
I don't see what could have introduced this. I wonder if it was not working
fine by some sort of chance.
But as to root explanation of why focusLost was not called before
valueChanged, as we say in french "je donne ma langue au chat " :-).

With current commit, we force the focus on tree, and by consequence
focusLost on all components of TestElement GUI, so it seems clean to me.


>
> >          String text = translate(initialEditValue);
> >          if (text == null) {
> >              text = ""; // will revert to last valid value if invalid
> >
> >
>



-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message