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
public class ListListenerHelperEx<E> extends java.lang.Object
A utility class to support change notifications for anObservableList
, replacing the JavaFX-internalListChangeListener
helper class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ListListenerHelperEx.AtomicChange<E>
A simple implementation of anListChangeListener.Change
.static class
ListListenerHelperEx.ElementarySubChange<E>
An abstract elementary change of anObservableList
-
Constructor Summary
Constructors Constructor Description ListListenerHelperEx(javafx.collections.ObservableList<E> source)
Constructs a newListListenerHelperEx
for the given sourceObservableList
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(javafx.beans.InvalidationListener listener)
Adds a newInvalidationListener
to thisListListenerHelperEx
.void
addListener(javafx.collections.ListChangeListener<? super E> listener)
Adds a newListChangeListener
to thisListListenerHelperEx
.void
fireValueChangedEvent(javafx.collections.ListChangeListener.Change<? extends E> change)
Notifies all attachedInvalidationListener
s andListChangeListener
s about the change.protected static <E> java.util.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>
getSource()
Returns the sourceObservableList
thisListListenerHelperEx
is bound to, which is used in change notifications.protected void
notifyInvalidationListeners()
Notifies all registeredInvalidationListener
s.protected void
notifyListChangeListeners(javafx.collections.ListChangeListener.Change<? extends E> change)
Notifies the attachedListChangeListener
s about the related change.void
removeListener(javafx.beans.InvalidationListener listener)
Removes the givenInvalidationListener
from thisListListenerHelperEx
.void
removeListener(javafx.collections.ListChangeListener<? super E> listener)
Removes the givenListChangeListener
from thisListListenerHelperEx
.
-
-
-
Constructor Detail
-
ListListenerHelperEx
public ListListenerHelperEx(javafx.collections.ObservableList<E> source)
Constructs a newListListenerHelperEx
for the given sourceObservableList
.- Parameters:
source
- TheObservableList
to use as source in change notifications.
-
-
Method Detail
-
getElementaryChanges
protected static <E> java.util.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 theObservableList
that 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 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
public void addListener(javafx.collections.ListChangeListener<? super E> listener)
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
public void fireValueChangedEvent(javafx.collections.ListChangeListener.Change<? extends E> change)
Notifies all attachedInvalidationListener
s andListChangeListener
s about the change.- Parameters:
change
- The change to notify listeners about.
-
getSource
protected javafx.collections.ObservableList<E> 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
protected void notifyListChangeListeners(javafx.collections.ListChangeListener.Change<? extends E> change)
Notifies the attachedListChangeListener
s about the related change.- Parameters:
change
- The applied change.
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener)
Removes the givenInvalidationListener
from thisListListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
removeListener
public void removeListener(javafx.collections.ListChangeListener<? super E> listener)
Removes the givenListChangeListener
from thisListListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
-