This class is designed to work with a stable source of ObservableLists provided by the itemToListFunction.
It is crucial for the correct operation of this binding that the same instance of ObservableList is returned for any given item in the lifecycle of that item.
Changing the underlying ObservableList instances during the lifecycle can lead to unpredictable behavior and potential memory leaks.
Important Considerations:
itemToListFunction must consistently return the same ObservableList instance for any given item
throughout its lifecycle. If the lists are stored in properties such as javafx.beans.property.ObjectProperty or javafx.beans.property.SimpleListProperty ,
ensure that these properties do not get reassigned to new lists as this can disrupt the behavior of the binding and lead to memory leaks.itemToListFunction
has listeners appropriately added or removed. This may require overriding property setters or employing property change listeners to manage list listeners when the property's value changes.| Modifier and Type | Field and Description |
|---|---|
| private final Function | |
| 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 | GeneralAggregatedListBinding(ObservableList<T>
The observable list of source items. This list should be stable during the lifecycle of the binding,
meaning that elements should not be replaced with different instances to ensure reliable behavior. source, Function<T, ObservableList<S>> A function that maps each element of the source list, T, to an observable list of S.
This function must consistently return the same instance of ObservableList for any given item
throughout its lifecycle to avoid erratic behavior and potential memory leaks. itemToListFunction, Function<List<S>, U> A function that aggregates a list of S into an intermediate result U, based on the current data
in those lists. aggregationFunction, Function<Stream<U>, R> A function that aggregates a list of intermediate results U into the final result R, which represents
the aggregate of the entire structure. finalAggregationFunction)Constructs a new GeneralAggregatedListBinding. |
| 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<List<S>, U> aggregationFunction | |
| finalAggregationFunction | back to summary |
|---|---|
| private final Function<Stream<U>, R> finalAggregationFunction | |
| 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 | |
| GeneralAggregatedListBinding | back to summary |
|---|---|
| public GeneralAggregatedListBinding(ObservableList<T> source, Function<T, ObservableList<S>> itemToListFunction, Function<List<S>, U> aggregationFunction, Function<Stream<U>, R> finalAggregationFunction) Constructs a new GeneralAggregatedListBinding. This constructor initializes the binding based on a source list, a function to map each element of the source to an observable list, and two aggregation functions. It sets up listeners on the source list and all nested lists, allowing the binding to react dynamically to changes within these lists.
| |
| 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) | |