RFR: 8090456: Focus Management [v8]
Nir Lisker
nlisker at openjdk.org
Wed Oct 9 17:38:08 UTC 2024
On Tue, 8 Oct 2024 14:44:37 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> FocusTraversal accepts null nodes, making the code more resilient
In what way is it more resilient? `traverse` does nothing if the node is `null`, which means that passing `null` is a bug more often than not. `null` nodes can't be displayed in the scenegraph anyway, so what is the use case of passing in `null`? Resilient code is usually more restrictive, guiding the user away from misuse, not one that accepts everything.
> the static nature of FocusTraversal indicates that it is not something related to particular node, but happens in the context of the scene graph
But methods like `next` of `left` *are* related to a particular node - the one that indicates to which node focus will be moved. `Node::requestFocus` means "give focus to me", `Node::focuseNext` means "give focus to the next node from me".
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1555#issuecomment-2402911154
More information about the openjfx-dev
mailing list