Class AbstractNestedListBinding<T,U>

java.lang.Object
javafx.beans.binding.ObjectExpression<U>
javafx.beans.binding.ObjectBinding<U>
com.dlsc.gemsfx.binding.AbstractNestedListBinding<T,U>
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
All Implemented Interfaces:
javafx.beans.binding.Binding<U>, javafx.beans.Observable, javafx.beans.value.ObservableObjectValue<U>, javafx.beans.value.ObservableValue<U>
Direct Known Subclasses:
FlattenedNestedListStreamBinding, TransformedFlattenedNestedListStreamBinding, TransformedNestedListBinding

public abstract class AbstractNestedListBinding<T,U> extends javafx.beans.binding.ObjectBinding<U>
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 ObjectBinding.computeValue() in the subclass.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final javafx.collections.ObservableList<javafx.collections.ObservableList<T>>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractNestedListBinding(javafx.collections.ObservableList<javafx.collections.ObservableList<T>> source)
    Constructs an AbstractNestedListBinding with the specified source of nested observable lists.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected Stream<T>
     
    protected void
    Initializes listeners on the source list and any existing nested lists.

    Methods inherited from class javafx.beans.binding.ObjectBinding

    addListener, addListener, allowValidation, bind, computeValue, get, getDependencies, invalidate, isObserved, isValid, onInvalidating, removeListener, removeListener, toString, unbind

    Methods inherited from class javafx.beans.binding.ObjectExpression

    asString, asString, asString, getValue, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotNull, isNull, objectExpression

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.beans.Observable

    subscribe

    Methods inherited from interface javafx.beans.value.ObservableValue

    flatMap, getValue, map, orElse, subscribe, subscribe, when
  • Field Details

    • source

      protected final javafx.collections.ObservableList<javafx.collections.ObservableList<T>> source
  • Constructor Details

    • AbstractNestedListBinding

      public AbstractNestedListBinding(javafx.collections.ObservableList<javafx.collections.ObservableList<T>> source)
      Constructs an AbstractNestedListBinding with the specified source of nested observable lists.
      Parameters:
      source - The observable list of observable lists that serves as the source for this binding.
  • Method Details

    • initListeners

      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.
    • flattenSource

      protected Stream<T> flattenSource()
    • dispose

      public void dispose()
      Specified by:
      dispose in interface javafx.beans.binding.Binding<T>
      Overrides:
      dispose in class javafx.beans.binding.ObjectBinding<U>