RFR: 8290040: Provide simplified deterministic way to manage listeners [v2]

Nir Lisker nlisker at openjdk.org
Wed Aug 31 17:37:21 UTC 2022


On Fri, 15 Jul 2022 09:07:07 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename showing property to shown as it is already used in subclasses
>
> modules/javafx.base/src/main/java/javafx/beans/value/ObservableValue.java line 311:
> 
>> 309:      * @since 20
>> 310:      */
>> 311:     default ObservableValue<T> when(ObservableValue<Boolean> condition) {
> 
> Discussion: name? `when`, `conditionOn`, other suggestions?  Note that this is not the same as a possible future method `filter`, as a `filter` would still keep observing its source at all times (and would use a `Predicate` as parameter).

`when` sounds fine, but we need to be careful about its relation to the `When` class.

This reminds me also that some of the new functionality in `ObservableValue` can be used as a replacement for `When`, maybe we should note that like we did with `Bindings.select`.

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

PR: https://git.openjdk.org/jfx/pull/830


More information about the openjfx-dev mailing list