RFR: 8091673: Public focus traversal API for use in custom controls [v3]
Michael Strauß
mstrauss at openjdk.org
Thu Nov 7 00:57:49 UTC 2024
On Wed, 6 Nov 2024 22:09:31 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Public focus traversal API for use in custom controls.
>>
>> https://github.com/andy-goryachev-oracle/Test/blob/main/doc/FocusTraversal/FocusTraversal-v3.md
>>
>> This is a lightweight change that only adds the public API for focus traversal, containing neither the public API for the traversal policy (#1555) nor with the changes for the traversal policy hidden (#1604).
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>
> review comments
modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 8549:
> 8547: Direction d;
> 8548: switch (direction) {
> 8549: case DOWN:
Have you considered moving this code to the `Direction` enum, for example like this:
enum Direction {
...
public static Direction of(TraversalDirection direction) {
return switch (direction) {
case DOWN -> DOWN;
case LEFT -> LEFT;
case NEXT -> NEXT;
case PREVIOUS -> PREVIOUS;
case RIGHT -> RIGHT;
case UP -> UP;
}
}
}
This way we won't clutter up the already very long `Node` file with simple conversions, and the co-location of the conversion with the actual enum makes it easier to maintain the code as well.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1628#discussion_r1831911047
More information about the openjfx-dev
mailing list