ObservableList of items to a computed value based on the elements of their associated nested ObservableLists.
This binding listens for changes not only in the top-level list but also in the nested lists of each item.
It aggregates or computes values dynamically as the lists change, making it ideal for applications where the data model is highly dynamic.
This class is designed to be used with a consistent source of ObservableLists provided by the itemToListFunction.
The function must return the same ObservableList instance for any given item throughout its lifecycle to ensure
correct behavior and prevent memory leaks.
Important Considerations:
itemToListFunction should not return different instances of ObservableList
over time for the same item. If the lists are stored in properties such as ObjectProperty or SimpleListProperty,
ensure that these properties are not reassigned new lists during the lifecycle of an item, as this can lead to erratic behavior and potential
memory leaks if listeners are not removed from old lists.| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| private final Function | |
| private final ListChangeListener | |
| private final ObservableList | |
| private final ListChangeListener | |
| private final WeakListChangeListener | |
| private final WeakListChangeListener |
| Access | Constructor and Description |
|---|---|
| public | AggregatedListBinding(ObservableList<T>
the observable list of source items that should be stable (not dynamically replaced). source, final Function<T, ObservableList<S>> a function to retrieve an observable list from each source item, which must consistently
return the same observable list instance for any given item throughout its lifecycle. itemToListFunction, Function<Stream<S>, R> a function to compute a result from all elements in the nested lists, based on current
data in those lists. aggregationFunction)Constructs a new AggregatedListBinding. |
| Modifier and Type | Method and Description |
|---|---|
| protected R | computeValue()
Implements abstract javafx. Calculates the current value of this binding. |
| private void | |
| private void | |
| public void | dispose()
Overrides javafx. Implements javafx. A default implementation of |
| private void | |
| private void |
| aggregationFunction | back to summary |
|---|---|
| private final Function<Stream<S>, R> aggregationFunction | |
| itemToListFunction | back to summary |
|---|---|
| private final Function<T, ObservableList<S>> itemToListFunction | |
| nestedListChangeListener | back to summary |
|---|---|
| private final ListChangeListener<Object> nestedListChangeListener | |
| source | back to summary |
|---|---|
| private final ObservableList<T> source | |
| sourceListChangeListener | back to summary |
|---|---|
| private final ListChangeListener<T> sourceListChangeListener | |
| weakNestedListChangeListener | back to summary |
|---|---|
| private final WeakListChangeListener<Object> weakNestedListChangeListener | |
| weakSourceListChangeListener | back to summary |
|---|---|
| private final WeakListChangeListener<T> weakSourceListChangeListener | |
| AggregatedListBinding | back to summary |
|---|---|
| public AggregatedListBinding(ObservableList<T> source, final Function<T, ObservableList<S>> itemToListFunction, Function<Stream<S>, R> aggregationFunction) Constructs a new AggregatedListBinding.
| |
| computeValue | back to summary |
|---|---|
| protected R computeValue() Implements abstract javafx. Doc from javafx. Calculates the current value of this binding.
Classes extending
| |
| convertToListAndSafeAddListener | back to summary |
|---|---|
| private void convertToListAndSafeAddListener(T item) | |
| convertToListAndSafeRemoveListener | back to summary |
|---|---|
| private void convertToListAndSafeRemoveListener(T item) | |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides javafx. Implements javafx. Doc from javafx. A default implementation of
| |
| safeAddListener | back to summary |
|---|---|
| private void safeAddListener(ObservableList<S> list) | |
| safeRemoveListener | back to summary |
|---|---|
| private void safeRemoveListener(ObservableList<S> list) | |