<AWT Dev> Review Request for 8025001: setFocusTraversalPolicy() to ContainerOrderFocusTraversalPolicy results in an infinite loop
ambarish.rapte at oracle.com
Wed Feb 10 17:38:09 UTC 2016
This issue does not occur with getComponentBefore().
The components can be traversed consistently in correct sequence using getComponentBefore().
Also have verified the JCK tests related to focus traversal system.
There are no failures due to this change.
From: prasanta sadhukhan
Sent: Wednesday, February 10, 2016 2:28 PM
To: Ambarish Rapte; Semyon Sadetsky; awt-dev at openjdk.java.net
Subject: Re: Review Request for 8025001: setFocusTraversalPolicy() to ContainerOrderFocusTraversalPolicy results in an infinite loop
Looks ok to me logically. Also, don't we need to do the same for getComponentBefore() to check for same component? Did you run JCK java/awt/containerorderfocustraversalpolicy tests just to be safe?
On 2/1/2016 7:18 PM, Ambarish Rapte wrote:
Please review the fix for jdk9,
ContainerOrderFocusTraversalPolicy.getComponentAfter() returns the same component on each call,
which results in an infinite loop in the test provided in bug.
By default, ContainerOrderFocusTraversalPolicy implicitly transfers focus down-cycle.
That is, during normal forward focus traversal, the Component traversed after a focus-cycle-root
will be the focus-cycle-root's default Component to focus.
For a scenarios for above behavior, i.e.
When focus-cycle-root & focus-cycle-root's default Component are the same component in traversal cycle.
If getComponentAfter() is called with focus-cycle-root, it returns focus-cycle-root itself.
Added a check to verify if the getComponentDownCycle() returns same component as the one passed to it.
Then do not return this component and continue traversing.
Verified that FocusTraversal tests PASS.
DefaultFocusTraversalPolicy is directly inherited from ContainerOrderFocusTraversalPolicy.
DefaultFocusTraversalPolicy also behaves well with above change.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the awt-dev