Class MultisetListenerHelper<E>
- java.lang.Object
-
- org.eclipse.gef.common.collections.MultisetListenerHelper<E>
-
- Type Parameters:
E
- The element type of theObservableMultiset
.
- Direct Known Subclasses:
MultisetExpressionHelper
public class MultisetListenerHelper<E> extends java.lang.Object
A utility class to support change notifications for anObservableMultiset
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultisetListenerHelper.AtomicChange<E>
A simple implementation of anMultisetChangeListener.Change
.static class
MultisetListenerHelper.ElementarySubChange<E>
An elementary change related to a single element of aMultiset
.
-
Constructor Summary
Constructors Constructor Description MultisetListenerHelper(ObservableMultiset<E> source)
Constructs a newMultisetListenerHelper
for the given sourceObservableMultiset
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(javafx.beans.InvalidationListener listener)
Adds a newInvalidationListener
to thisMultisetListenerHelper
.void
addListener(MultisetChangeListener<? super E> listener)
Adds a newSetMultimapChangeListener
to thisMultisetListenerHelper
.void
fireValueChangedEvent(MultisetChangeListener.Change<? extends E> change)
Notifies all attachedInvalidationListener
s andMultisetChangeListener
s about the change.protected ObservableMultiset<E>
getSource()
Returns the sourceObservableMultiset
thisMultisetListenerHelper
is bound to, which is used in change notifications.protected void
notifyInvalidationListeners()
Notifies all registeredInvalidationListener
s.protected void
notifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)
Notifies the attachedMultisetChangeListener
s about the related change.void
removeListener(javafx.beans.InvalidationListener listener)
Removes the givenInvalidationListener
from thisMultisetListenerHelper
.void
removeListener(MultisetChangeListener<? super E> listener)
Removes the givenMultisetChangeListener
from thisMultisetListenerHelper
.
-
-
-
Constructor Detail
-
MultisetListenerHelper
public MultisetListenerHelper(ObservableMultiset<E> source)
Constructs a newMultisetListenerHelper
for the given sourceObservableMultiset
.- Parameters:
source
- TheObservableMultiset
to use as source in change notifications.
-
-
Method Detail
-
addListener
public void addListener(javafx.beans.InvalidationListener listener)
Adds a newInvalidationListener
to thisMultisetListenerHelper
. 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(MultisetChangeListener<? super E> listener)
Adds a newSetMultimapChangeListener
to thisMultisetListenerHelper
. 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(MultisetChangeListener.Change<? extends E> change)
Notifies all attachedInvalidationListener
s andMultisetChangeListener
s about the change.- Parameters:
change
- The change to notify listeners about.
-
getSource
protected ObservableMultiset<E> getSource()
Returns the sourceObservableMultiset
thisMultisetListenerHelper
is bound to, which is used in change notifications.- Returns:
- The source
ObservableMultiset
.
-
notifyInvalidationListeners
protected void notifyInvalidationListeners()
Notifies all registeredInvalidationListener
s.
-
notifyMultisetChangeListeners
protected void notifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)
Notifies the attachedMultisetChangeListener
s about the related change.- Parameters:
change
- The applied change.
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener)
Removes the givenInvalidationListener
from thisMultisetListenerHelper
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
removeListener
public void removeListener(MultisetChangeListener<? super E> listener)
Removes the givenMultisetChangeListener
from thisMultisetListenerHelper
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
-