<AWT Dev> Review Request for 8025001: setFocusTraversalPolicy() to ContainerOrderFocusTraversalPolicy results in an infinite loop
Semyon Sadetsky
semyon.sadetsky at oracle.com
Thu Feb 11 06:54:50 UTC 2016
Looks good.
--Semyon
On 2/1/2016 4:48 PM, Ambarish Rapte wrote:
>
> Hi All,
>
> Please review the fix for jdk9,
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8025001
>
> Webrev: http://cr.openjdk.java.net/~arapte/8025001/webrev.00/
> <http://cr.openjdk.java.net/%7Earapte/8025001/webrev.00/>
>
> Issue:
>
> ContainerOrderFocusTraversalPolicy.getComponentAfter() returns the
> same component on each call,
>
> which results in an infinite loop in the test provided in bug.
>
> Cause:
>
> 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.
>
> Fix:
>
> 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.
>
> Verification:
>
> Verified that FocusTraversal tests PASS.
>
> DefaultFocusTraversalPolicy is directly inherited from
> ContainerOrderFocusTraversalPolicy.
>
> DefaultFocusTraversalPolicy also behaves well with
> above change.
>
> Thanks,
>
> Ambarish
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160211/23fb9cd0/attachment.html>
More information about the awt-dev
mailing list