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

public abstract Class AbstractNestedListBinding<T, U>

extends ObjectBinding<U>
Class Inheritance
Known Direct Subclasses
com.dlsc.gemsfx.binding.FlattenedNestedListStreamBinding, com.dlsc.gemsfx.binding.TransformedFlattenedNestedListStreamBinding, com.dlsc.gemsfx.binding.TransformedNestedListBinding
Type Parameters
<T>
the type of the elements in the nested observable lists
<U>
the type of the value computed by the binding, based on the nested list structure
Imports
javafx.beans.binding.ObjectBinding, javafx.collections.ListChangeListener, .ObservableList, .WeakListChangeListener, java.util.List, .Objects, java.util.stream.Stream

Provides a base for creating bindings based on a nested structure of observable lists. This abstract class handles the addition and removal of listeners to these nested observable lists to facilitate easy updates and maintenance of bindings that depend on their content.

The class uses weak listeners to prevent memory leaks and ensure that lists can be garbage collected when no longer in use. Changes in any of the nested lists will trigger an invalidation in the binding, prompting a re-computation of its value based on the specific implementation of computeValue() in the subclass.

Field Summary

Modifier and TypeField and Description
private final ListChangeListener<T>
private final ListChangeListener<ObservableList<T>>
protected final ObservableList<ObservableList<T>>
private final WeakListChangeListener<T>
private final WeakListChangeListener<ObservableList<T>>

Constructor Summary

AccessConstructor and Description
public
AbstractNestedListBinding(ObservableList<ObservableList<T>>
The observable list of observable lists that serves as the source for this binding.
source
)

Constructs an AbstractNestedListBinding with the specified source of nested observable lists.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Overrides javafx.beans.binding.ObjectBinding.dispose.

Implements javafx.beans.binding.Binding.dispose.

A default implementation of dispose() that is empty.

protected Stream<T>
protected void
initListeners()

Initializes listeners on the source list and any existing nested lists.

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

Field Detail

innerListChangeListenerback to summary
private final ListChangeListener<T> innerListChangeListener
outerListChangeListenerback to summary
private final ListChangeListener<ObservableList<T>> outerListChangeListener
sourceback to summary
protected final ObservableList<ObservableList<T>> source
weakInnerListChangeListenerback to summary
private final WeakListChangeListener<T> weakInnerListChangeListener
weakOuterListChangeListenerback to summary
private final WeakListChangeListener<ObservableList<T>> weakOuterListChangeListener

Constructor Detail

AbstractNestedListBindingback to summary
public AbstractNestedListBinding(ObservableList<ObservableList<T>> source)

Constructs an AbstractNestedListBinding with the specified source of nested observable lists.

Parameters
source:ObservableList<ObservableList<T>>

The observable list of observable lists that serves as the source for this binding.

Method Detail

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
flattenSourceback to summary
protected Stream<T> flattenSource()
initListenersback to summary
protected void initListeners()

Initializes listeners on the source list and any existing nested lists. This method should be called after subclass constructors have fully initialized any necessary fields to ensure that listeners interact with a fully initialized object.

safeAddListenerback to summary
private void safeAddListener(ObservableList<T> list)
safeRemoveListenerback to summary
private void safeRemoveListener(ObservableList<T> list)