Top Description Fields Constructors Methods
com.dlsc.gemsfx.binding

public Class ObservableValuesListBinding<T, U>

extends ObjectBinding<U>
Class Inheritance
Type Parameters
<T>
the type held by the ObservableValues in the source list
<U>
the type of the output value after applying the transformation function
Imports
javafx.beans.InvalidationListener, .WeakInvalidationListener, javafx.beans.binding.ObjectBinding, javafx.beans.value.ObservableValue, javafx.collections.ListChangeListener, .ObservableList, .WeakListChangeListener, java.util.Objects, java.util.function.Function, java.util.stream.Stream

This class binds to an ObservableList of ObservableValue objects and updates its value based on the current values of these ObservableValues. It reevaluates its value whenever any of the ObservableValues change. The computed value is determined by applying a transformation function to the list of current values.

Field Summary

Modifier and TypeField and Description
private final InvalidationListener
private final ListChangeListener<ObservableValue<T>>
private final ObservableList<ObservableValue<T>>
private final Function<Stream<T>, U>
private final WeakInvalidationListener
private final WeakListChangeListener<ObservableValue<T>>

Constructor Summary

AccessConstructor and Description
public
ObservableValuesListBinding(ObservableList<ObservableValue<T>>
the observable list of ObservableValue objects that is the source of the binding
source
,
Function<Stream<T>, U>
a function that transforms the list of current values into a computed value of type U
transformer
)

Constructs a new ObservableValuesListBinding.

Method Summary

Modifier and TypeMethod and Description
protected U
computeValue()

Implements abstract javafx.beans.binding.ObjectBinding.computeValue.

Calculates the current value of this binding.

public void
dispose()

Overrides javafx.beans.binding.ObjectBinding.dispose.

Implements javafx.beans.binding.Binding.dispose.

A default implementation of dispose() that is empty.

private void
private void
Inherited from javafx.beans.binding.ObjectBinding:
addListeneraddListenerallowValidationbindgetgetDependenciesinvalidateisObservedisValidonInvalidatingremoveListenerremoveListenertoStringunbind

Field Detail

elementInvalidationListenerback to summary
private final InvalidationListener elementInvalidationListener
listChangeListenerback to summary
private final ListChangeListener<ObservableValue<T>> listChangeListener
sourceback to summary
private final ObservableList<ObservableValue<T>> source
transformerback to summary
private final Function<Stream<T>, U> transformer
weakElementInvalidationListenerback to summary
private final WeakInvalidationListener weakElementInvalidationListener
weakListChangeListenerback to summary
private final WeakListChangeListener<ObservableValue<T>> weakListChangeListener

Constructor Detail

ObservableValuesListBindingback to summary
public ObservableValuesListBinding(ObservableList<ObservableValue<T>> source, Function<Stream<T>, U> transformer)

Constructs a new ObservableValuesListBinding.

Parameters
source:ObservableList<ObservableValue<T>>

the observable list of ObservableValue objects that is the source of the binding

transformer:Function<Stream<T>, U>

a function that transforms the list of current values into a computed value of type U

Method Detail

computeValueback to summary
protected U computeValue()

Implements abstract javafx.beans.binding.ObjectBinding.computeValue.

Doc from javafx.beans.binding.ObjectBinding.computeValue.

Calculates the current value of this binding.

Classes extending ObjectBinding have to provide an implementation of computeValue.

Annotations
@Override
disposeback to summary
public void dispose()

Overrides javafx.beans.binding.ObjectBinding.dispose.

Implements javafx.beans.binding.Binding.dispose.

Doc from javafx.beans.binding.ObjectBinding.dispose.

A default implementation of dispose() that is empty.

Annotations
@Override
safeAddListenerback to summary
private void safeAddListener(ObservableValue<T> item)
safeRemoveListenerback to summary
private void safeRemoveListener(ObservableValue<T> item)