On Wed, 21 Oct 2026 12:07:51 GMT, John Hendrikx <[email protected]> wrote:

> If you listen on both `x` and `y` you will get notified twice still, but you 
> can't observe a wrong x/y pair. I also have something to avoid that on the 
> listener side of things:
> 
> ```
> Observe.values(x, y).subscribe((x, y) -> { ... });
> ```

This is a nice solution!

> Well, I can't speak for all situations, and the layout system involves way 
> more than just a handful of properties in a single class, but generally if 
> you can delay when listeners fire, then there is no re-entrancy problem 
> because you can trigger the listeners after your code is done (it will still 
> nest on the stack, but you can control exactly where that happens).

Yes, this is also my assumption.

A system like this in JavaFX is really needed IMO, especially to improve the 
whole CSS and layout logic.
I know it is usually not recommended to e.g. listen to most of the layout 
properties. But there are valid (although rare) usecases out there which need 
it. 

So a system like that, where we fire the listener after everything is 
consistent and done, and e.g. if the user changed something layout or css 
relevant -- sure, we will do another pass the next pulse,- but now we are 
consistent and done, is highly needed. Likewise, the system to listen to 
multiple properties but only get one event if both changed is needed in the 
same way.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2347#discussion_r4339047953

Reply via email to