Issue Details (XML | Word | Printable)

Key: FEST-196
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alex Ruiz
Reporter: Alex Ruiz
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
FEST

Robot#click should not give focus to component

Created: 21/Jul/09 12:35 AM   Updated: 23/Jul/09 02:05 AM   Resolved: 23/Jul/09 02:05 AM
Component/s: Swing
Affects Version/s: FEST-Swing 1.2a2
Fix Version/s: FEST-Swing 1.2a3

Time Tracking:
Not Specified


 Description  « Hide

Many thanks to Kirill Grouchnikov.



Alex Ruiz added a comment - 21/Jul/09 01:06 AM

IMHO, 'click' should not give focus to the component before actually pressing the mouse button.


Kirill Grouchnikov added a comment - 21/Jul/09 01:08 AM

If the user clicks the button with the mouse, that button gets the focus. As Javadocs of Robot.click says, it

Simulates a user clicking once the given Component using the left mouse button.

I wonder if there's a way for the BasicRobot.focus to wait until the focus has been transferred and all registered listeners have been notified. Or perhaps the current implementation already does that? Perhaps BasicRobot.click should call focus(c, true)?

Thanks
Kirill


Alex Ruiz added a comment - 21/Jul/09 01:16 AM

I don't think BasicRobot.click should call BasicRobot.focus. 'click' should automatically give focus to the component once the mouse is pressed. It works just like when a user clicks. The user does not give focus to the component before clicking it. He/she simply hovers the mouse over the component and presses and releases the left mouse button. That is what the Robot simulates. Therefore the call to 'focus' is unnecessary.


Alex Ruiz added a comment - 21/Jul/09 01:18 AM

I was actually going to remove that call to 'focus' before releasing 1.2a2. I was being kind of conservative (a.k.a "lazy") but your test case confirmed what I was thinking


Kirill Grouchnikov added a comment - 21/Jul/09 01:45 AM

So the focus will be on the component after the Robot.click is done?


Alex Ruiz added a comment - 21/Jul/09 02:09 AM

Yep, it should happen automatically, without explicitly calling 'focus'.


Alex Ruiz added a comment - 21/Jul/09 02:10 AM

I'm guessing that should happen if the clicked component is focusable.