Class ListListenerHelperEx<E>
java.lang.Object
org.eclipse.gef.common.collections.ListListenerHelperEx<E>
- Type Parameters:
E- The element type of theObservableList.
- Direct Known Subclasses:
ListExpressionHelperEx
A utility class to support change notifications for an
ObservableList
, replacing the JavaFX-internal ListChangeListener helper class.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA simple implementation of anListChangeListener.Change.static classAn abstract elementary change of anObservableList -
Constructor Summary
ConstructorsConstructorDescriptionListListenerHelperEx(javafx.collections.ObservableList<E> source) Constructs a newListListenerHelperExfor the given sourceObservableList. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(javafx.beans.InvalidationListener listener) Adds a newInvalidationListenerto thisListListenerHelperEx.voidaddListener(javafx.collections.ListChangeListener<? super E> listener) Adds a newListChangeListenerto thisListListenerHelperEx.voidfireValueChangedEvent(javafx.collections.ListChangeListener.Change<? extends E> change) Notifies all attachedInvalidationListeners andListChangeListeners about the change.protected static <E> List<ListListenerHelperEx.ElementarySubChange<E>>getElementaryChanges(javafx.collections.ListChangeListener.Change<? extends E> change) Infers the elementary changes constituting the change of theObservableList.protected javafx.collections.ObservableList<E>Returns the sourceObservableListthisListListenerHelperExis bound to, which is used in change notifications.protected voidNotifies all registeredInvalidationListeners.protected voidnotifyListChangeListeners(javafx.collections.ListChangeListener.Change<? extends E> change) Notifies the attachedListChangeListeners about the related change.voidremoveListener(javafx.beans.InvalidationListener listener) Removes the givenInvalidationListenerfrom thisListListenerHelperEx.voidremoveListener(javafx.collections.ListChangeListener<? super E> listener) Removes the givenListChangeListenerfrom thisListListenerHelperEx.
-
Constructor Details
-
ListListenerHelperEx
Constructs a newListListenerHelperExfor the given sourceObservableList.- Parameters:
source- TheObservableListto use as source in change notifications.
-
-
Method Details
-
getElementaryChanges
protected static <E> List<ListListenerHelperEx.ElementarySubChange<E>> getElementaryChanges(javafx.collections.ListChangeListener.Change<? extends E> change) Infers the elementary changes constituting the change of theObservableList.- Type Parameters:
E- The element type of theObservableListthat was changed.- Parameters:
change- The (atomic) change to infer elementary changes from.- Returns:
- A list of elementary changes.
-
addListener
public void addListener(javafx.beans.InvalidationListener listener) Adds a newInvalidationListenerto thisListListenerHelperEx. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.- Parameters:
listener- The listener to add.
-
addListener
Adds a newListChangeListenerto thisListListenerHelperEx. If the same listener is added more than once, it will be registered more than once and will receive multiple change events.- Parameters:
listener- The listener to add.
-
fireValueChangedEvent
Notifies all attachedInvalidationListeners andListChangeListeners about the change.- Parameters:
change- The change to notify listeners about.
-
getSource
Returns the sourceObservableListthisListListenerHelperExis bound to, which is used in change notifications.- Returns:
- The source
ObservableList.
-
notifyInvalidationListeners
protected void notifyInvalidationListeners()Notifies all registeredInvalidationListeners. -
notifyListChangeListeners
protected void notifyListChangeListeners(javafx.collections.ListChangeListener.Change<? extends E> change) Notifies the attachedListChangeListeners about the related change.- Parameters:
change- The applied change.
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener) Removes the givenInvalidationListenerfrom thisListListenerHelperEx. If its was registered more than once, removes one occurrence.- Parameters:
listener- The listener to remove.
-
removeListener
Removes the givenListChangeListenerfrom thisListListenerHelperEx. If its was registered more than once, removes one occurrence.- Parameters:
listener- The listener to remove.
-