On Fri, 15 May 2026 20:58:24 GMT, Martin Fox <[email protected]> wrote:

>> Maybe I wasn't clear.  You have two methods - this and an identical one in
>> https://github.com/openjdk/jfx/pull/2166/changes#diff-9117771ea1db4c49f8f0e82634427f7d8205b1f15038c1429959a003a10a5af7R250
>> 
>> that dispatch an event to a component, bypassing the normal chain, correct?
>> 
>> Why not make it a public API?  `Event.dispatchTo(Node)` or something like 
>> that?
>> 
>> Or, at a minimum, replace these two with a utility method added to 
>> `EventUtil` ?
>
>> Why not make it a public API? `Event.dispatchTo(Node)` or something like 
>> that?
> 
> Dispatching to a single node is a very specialized case and I don't think 
> it's worth adding a public routine. We would get more mileage out of adding a 
> public API to create an EventDispatchChain. Then clients could write their 
> own version of this short routine or build more complicated chains that 
> dispatch across multiple nodes.
> 
>> Or, at a minimum, replace these two with a utility method added to 
>> `EventUtil` ?
> 
> This routine is only used in two places and I'm hoping it stays that way. The 
> right location for this routine is a common superclass of ComboBox and 
> Spinner (something like ForwardingControl) but that doesn't exist and I don't 
> know how to add it after the fact. As it stands Spinner doesn't handle input 
> method events or requests correctly and to fix that we'll have to copy code 
> verbatim from ComboBox. New controls that need to do this sort of forwarding 
> should start with a common superclass and it should probably pursue a 
> different design.

I suspect it may not be a specialized case (any composite control might want to 
dispatch an event to its child control for example), and you already have two 
places with the duplicate code.  

I am ok with this not being a public API, so perhaps it belongs in 
`EventUtils`.  Certainly not in the ComboBox base class.  I don't quite 
understand the reason for your objection here.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2166#discussion_r3251173264

Reply via email to