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 class
A simple implementation of anListChangeListener.Change
.static class
An abstract elementary change of anObservableList
-
Constructor Summary
ConstructorsConstructorDescriptionListListenerHelperEx
(ObservableList<E> source) Constructs a newListListenerHelperEx
for the given sourceObservableList
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(InvalidationListener listener) Adds a newInvalidationListener
to thisListListenerHelperEx
.void
addListener
(ListChangeListener<? super E> listener) Adds a newListChangeListener
to thisListListenerHelperEx
.void
fireValueChangedEvent
(ListChangeListener.Change<? extends E> change) Notifies all attachedInvalidationListener
s andListChangeListener
s about the change.protected static <E> List<ListListenerHelperEx.ElementarySubChange<E>>
getElementaryChanges
(ListChangeListener.Change<? extends E> change) Infers the elementary changes constituting the change of theObservableList
.protected ObservableList<E>
Returns the sourceObservableList
thisListListenerHelperEx
is bound to, which is used in change notifications.protected void
Notifies all registeredInvalidationListener
s.protected void
notifyListChangeListeners
(ListChangeListener.Change<? extends E> change) Notifies the attachedListChangeListener
s about the related change.void
removeListener
(InvalidationListener listener) Removes the givenInvalidationListener
from thisListListenerHelperEx
.void
removeListener
(ListChangeListener<? super E> listener) Removes the givenListChangeListener
from thisListListenerHelperEx
.
-
Constructor Details
-
ListListenerHelperEx
Constructs a newListListenerHelperEx
for the given sourceObservableList
.- Parameters:
source
- TheObservableList
to use as source in change notifications.
-
-
Method Details
-
getElementaryChanges
protected static <E> List<ListListenerHelperEx.ElementarySubChange<E>> getElementaryChanges(ListChangeListener.Change<? extends E> change) Infers the elementary changes constituting the change of theObservableList
.- Type Parameters:
E
- The element type of theObservableList
that was changed.- Parameters:
change
- The (atomic) change to infer elementary changes from.- Returns:
- A list of elementary changes.
-
addListener
Adds a newInvalidationListener
to 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 newListChangeListener
to 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 attachedInvalidationListener
s andListChangeListener
s about the change.- Parameters:
change
- The change to notify listeners about.
-
getSource
Returns the sourceObservableList
thisListListenerHelperEx
is bound to, which is used in change notifications.- Returns:
- The source
ObservableList
.
-
notifyInvalidationListeners
protected void notifyInvalidationListeners()Notifies all registeredInvalidationListener
s. -
notifyListChangeListeners
Notifies the attachedListChangeListener
s about the related change.- Parameters:
change
- The applied change.
-
removeListener
Removes the givenInvalidationListener
from thisListListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
removeListener
Removes the givenListChangeListener
from thisListListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-