FEST

Robot#click should not give focus to component

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: FEST-Swing 1.2a2
  • Fix Version/s: FEST-Swing 1.2a3
  • Component/s: Swing
  • Labels:
    None
  • Number of attachments :
    0

Description

Many thanks to Kirill Grouchnikov.

Activity

Hide
Alex Ruiz added a comment -

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

Show
Alex Ruiz added a comment - IMHO, 'click' should not give focus to the component before actually pressing the mouse button.
Hide
Kirill Grouchnikov added a comment -

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

Show
Kirill Grouchnikov added a comment - 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
Hide
Alex Ruiz added a comment -

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.

Show
Alex Ruiz added a comment - 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.
Hide
Alex Ruiz added a comment -

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

Show
Alex Ruiz added a comment - 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
Hide
Kirill Grouchnikov added a comment -

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

Show
Kirill Grouchnikov added a comment - So the focus will be on the component after the Robot.click is done?
Hide
Alex Ruiz added a comment -

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

Show
Alex Ruiz added a comment - Yep, it should happen automatically, without explicitly calling 'focus'.
Hide
Alex Ruiz added a comment -

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

Show
Alex Ruiz added a comment - I'm guessing that should happen if the clicked component is focusable.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: