Enhancements for JavaFX 18
John Hendrikx
hjohn at xs4all.nl
Mon Oct 4 08:02:03 UTC 2021
I missed this question.
There are several external libaries available to help with these kinds
of bindings. There is EasyBind, ReactFX and an attempt of my own
(https://github.com/hjohn/hs.jfx.eventstream).
They all have a different way of addressing this, but they do all have
one thing in common: they all require that you wrap ObservableValues in
their own extended variant of ObservableValue. EasyBind has
"MonadicObervableValue", ReactFX has "Val" and "Var" and my own attempt
has "ValueStream".
Effectively this means you will get two types of properties in your
JavaFX application, and you'll need to update standard properties like
ObjectProperty to the type the framework provides to get the extra
features. Interop between "old" and "new" code requires wrapping and
sometimes unwrapping.
Integrating this into JavaFX's ObservableValue directly avoids all these
wrappers and all the extra work that entails for the user of fluent
bindings.
With this base in place, external libraries can provide streams and
complicated mapping functions (ReactFX especially has an overabundance
of features, most of which too niche to include into JavaFX directly).
That's not the only advantage however. When these are integrated, JavaFX
internals can take advantage of them as well. Managing of cascading
properties (usually done manually in JavaFX code, Bindings#select is not
usually used) will be much cleaner and simpler.
Also the lazy bindings part of this MR can be used to avoid creating
listeners for properties that aren't used themselves -- this allows for
example Node to provide convience properties (like tree visibility)
without having to pre-emptively add listeners. This is not possible
currently without consuming additional memory for every Node instance.
Finally, it also would serve as a type safe replacement for
Bindings#select which is something that I think the team behind FX has
been wanting to address for quite a while now.
--John
On 12/09/2021 01:38, Tom Schindl wrote:
> I have not looked at the code yet but why does this have to be part of
> OpenJFX and can not be implemented as an external library?
>
> Tom
>
> Am 05.08.21 um 00:25 schrieb John Hendrikx:
>> Perhaps:
>>
>> Fluent bindings for ObservableValue
>> https://github.com/openjdk/jfx/pull/434
>>
>> It was received well I think, and there was some interest from Nir
>> Lisker to work on a proposal.
>>
>> --John
>>
>> On 30/07/2021 14:56, Kevin Rushforth wrote:
>>> Now that JavaFX 17 is in RDP2, we can turn more attention to bug fixes
>>> and enhancement requests for JavaFX 18. It's the summer, so there may be
>>> delays as some people are out at various times (including me), but I
>>> would like to get some of the outstanding enhancement requests moving
>>> over the next few weeks.
>>>
>>> Specifically, I'd like to see the following proceed:
>>>
>>> * Transparent backgrounds in WebView
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8090547
>>> PR: https://github.com/openjdk/jfx/pull/563
>>>
>>> * Add DirectionalLight
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8234921
>>> PR: https://github.com/openjdk/jfx/pull/548
>>>
>>> * CSS pseudoclasses :focus-visible and :focus-within
>>> https://bugs.openjdk.java.net/browse/JDK-8268225
>>> PR: https://github.com/openjdk/jfx/pull/475
>>>
>>> * Improve property system to facilitate correct usage (minus the binary
>>> incompatible API change)
>>> JBS: https://bugs.openjdk.java.net/browse/JDK-8268642
>>> PR: https://github.com/openjdk/jfx/pull/590 (Draft)
>>>
>>> And maybe the following:
>>>
>>> * Add CSS themes as a first-class concept (need a consensus on how to
>>> proceed)
>>>
>>> * Undecorated interactive stage style (still in early discussion, but
>>> the concept looks interesting and useful)
>>>
>>> There are probably others I'm forgetting.
>>>
>>> Each of the above should be discussed in their own thread on openjfx-dev
>>> rather than a reply to this thread.
>>>
>>> -- Kevin
>>>
>>>
>
More information about the openjfx-dev
mailing list