Proposal: Focus Traversal API

Kevin Rushforth kevin.rushforth at oracle.com
Wed Oct 23 18:15:35 UTC 2024


I think we just need a good name. I agree that "predict" isn't the API 
we want.

How about "requestFocusTraversal"? It has symmetry with requestFocus.

-- Kevin


On 10/23/2024 11:05 AM, Andy Goryachev wrote:
>
> I don't think prediction should be the functionality we want in the 
> Node.  This functionality, in my opinion, belongs to the traversal policy.
>
> All we want is to navigate away from the specified node.
>
> It might have been easier had we kept the original FocusTraversal 
> class - not only one can add a bunch of convenience methods (predict, 
> infer, contemplate, etc.) but we could have added 
> applicationFocusOwnerProperty() etc.
>
> Do we need another brainstorming round?
>
> -andy
>
> *From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of 
> Michael Strauß <michaelstrau2 at gmail.com>
> *Date: *Wednesday, October 23, 2024 at 10:58
> *To: *
> *Cc: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
> *Subject: *Re: Proposal: Focus Traversal API
>
> How about „predictFocus“, which will return a Node without changing focus?
>
> This would give applications even more flexibility, because they can 
> then decide if they want to go ahead and actually change focus by 
> calling predictFocus()?.requestFocus()
>
> Andy Goryachev <andy.goryachev at oracle.com> schrieb am Mi. 23. Okt. 
> 2024 um 19:16:
>
>     Thank you for suggestion!
>
>     My only problem with a more assertive “moveFocus” is that it
>     implies a success, while this API may or may not succeed
>     (similarly to requestFocus).
>
>     The word "shift" in "shiftFocus" might clash with the "shift" key,
>     don't really like that.
>
>     Maybe "requestTraversal" although it will expand auto-completion
>     list that has 2 items already.  Welcome any alternative, as long
>     as it's not creat().
>
>     -andy
>
>     *From: *openjfx-dev <openjfx-dev-retn at openjdk.org> on behalf of
>     Michael Strauß <michaelstrau2 at gmail.com>
>     *Date: *Wednesday, October 23, 2024 at 10:05
>     *To: *
>     *Cc: *openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
>     *Subject: *Re: Proposal: Focus Traversal API
>
>     Maybe we can polish the naming a bit:
>
>     When used as a transitive verb, "traverse" means (according to
>     Merriam-Webster): to go or travel across or over, to move or pass
>     along or through.
>
>     MW gives the example: "light rays traversing a crystal". So one thing
>     is moving (light rays), while the other thing is static (a crystal).
>     Cambridge gives the example "Stanley traversed the continent from west
>     to east." Again, "Stanley" is moving, "the continent" is static.
>
>     Since "traverseFocus" is a transitive verb followed by a direct noun,
>     it sounds to me like "focus" is the thing that can be traversed over
>     or across.
>     As an analogy, let's call the method "traverseContinent" for a moment.
>     It becomes obvious that "continent" is the space which is traveled
>     across, and not the thing travelling.
>
>     In our case, "focus" is the moving thing, not the thing that it is
>     moved across. I would use something like "moveFocus", "shiftFocus", or
>     something along those lines.
>
>     As for "TraversalDirection", I think it is acceptable, but I'll note
>     that to me, "direction" implies one of the four directional modes, not
>     the two logical modes (previous and next).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20241023/f10ce68c/attachment-0001.htm>


More information about the openjfx-dev mailing list