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.ObjectA utility class to support change notifications for anObservableMultiset.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultisetListenerHelper.AtomicChange<E>A simple implementation of anMultisetChangeListener.Change.static classMultisetListenerHelper.ElementarySubChange<E>An elementary change related to a single element of aMultiset.
-
Constructor Summary
Constructors Constructor Description MultisetListenerHelper(ObservableMultiset<E> source)Constructs a newMultisetListenerHelperfor the given sourceObservableMultiset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(javafx.beans.InvalidationListener listener)Adds a newInvalidationListenerto thisMultisetListenerHelper.voidaddListener(MultisetChangeListener<? super E> listener)Adds a newSetMultimapChangeListenerto thisMultisetListenerHelper.voidfireValueChangedEvent(MultisetChangeListener.Change<? extends E> change)Notifies all attachedInvalidationListeners andMultisetChangeListeners about the change.protected ObservableMultiset<E>getSource()Returns the sourceObservableMultisetthisMultisetListenerHelperis bound to, which is used in change notifications.protected voidnotifyInvalidationListeners()Notifies all registeredInvalidationListeners.protected voidnotifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)Notifies the attachedMultisetChangeListeners about the related change.voidremoveListener(javafx.beans.InvalidationListener listener)Removes the givenInvalidationListenerfrom thisMultisetListenerHelper.voidremoveListener(MultisetChangeListener<? super E> listener)Removes the givenMultisetChangeListenerfrom thisMultisetListenerHelper.
-
-
-
Constructor Detail
-
MultisetListenerHelper
public MultisetListenerHelper(ObservableMultiset<E> source)
Constructs a newMultisetListenerHelperfor the given sourceObservableMultiset.- Parameters:
source- TheObservableMultisetto use as source in change notifications.
-
-
Method Detail
-
addListener
public void addListener(javafx.beans.InvalidationListener listener)
Adds a newInvalidationListenerto 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 newSetMultimapChangeListenerto 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 attachedInvalidationListeners andMultisetChangeListeners about the change.- Parameters:
change- The change to notify listeners about.
-
getSource
protected ObservableMultiset<E> getSource()
Returns the sourceObservableMultisetthisMultisetListenerHelperis bound to, which is used in change notifications.- Returns:
- The source
ObservableMultiset.
-
notifyInvalidationListeners
protected void notifyInvalidationListeners()
Notifies all registeredInvalidationListeners.
-
notifyMultisetChangeListeners
protected void notifyMultisetChangeListeners(MultisetChangeListener.Change<? extends E> change)
Notifies the attachedMultisetChangeListeners about the related change.- Parameters:
change- The applied change.
-
removeListener
public void removeListener(javafx.beans.InvalidationListener listener)
Removes the givenInvalidationListenerfrom 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 givenMultisetChangeListenerfrom thisMultisetListenerHelper. If its was registered more than once, removes one occurrence.- Parameters:
listener- The listener to remove.
-
-