Class MapListenerHelperEx<K,V>
java.lang.Object
org.eclipse.gef.common.collections.MapListenerHelperEx<K,V>
- Type Parameters:
K
- The key type of theObservableMap
.V
- The value type of theObservableMap
.
- Direct Known Subclasses:
MapExpressionHelperEx
A utility class to support change notifications for an
ObservableMap
, replacing the JavaFX-internal MapChangeListener
helper class.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A simple implementation of anMapChangeListener.Change
. -
Constructor Summary
ConstructorsConstructorDescriptionMapListenerHelperEx
(ObservableMap<K, V> source) Constructs a newMapListenerHelperEx
for the given sourceObservableMap
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(InvalidationListener listener) Adds a newInvalidationListener
to thisMapListenerHelperEx
.void
addListener
(MapChangeListener<? super K, ? super V> listener) Adds a newMapChangeListener
to thisMapListenerHelperEx
.void
fireValueChangedEvent
(MapChangeListener.Change<? extends K, ? extends V> change) Notifies all attachedInvalidationListener
s andMapChangeListener
s about the change.protected ObservableMap<K,
V> Returns the sourceObservableMap
thisMapListenerHelperEx
is bound to, which is used in change notifications.protected void
Notifies all registeredInvalidationListener
s.protected void
notifyMapChangeListeners
(MapChangeListener.Change<? extends K, ? extends V> change) Notifies the attachedMapChangeListener
s about the related change.void
removeListener
(InvalidationListener listener) Removes the givenInvalidationListener
from thisMapListenerHelperEx
.void
removeListener
(MapChangeListener<? super K, ? super V> listener) Removes the givenMapChangeListener
from thisMapListenerHelperEx
.
-
Constructor Details
-
MapListenerHelperEx
Constructs a newMapListenerHelperEx
for the given sourceObservableMap
.- Parameters:
source
- TheObservableMap
to use as source in change notifications.
-
-
Method Details
-
addListener
Adds a newInvalidationListener
to thisMapListenerHelperEx
. 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 newMapChangeListener
to thisMapListenerHelperEx
. 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 andMapChangeListener
s about the change.- Parameters:
change
- The change to notify listeners about.
-
getSource
Returns the sourceObservableMap
thisMapListenerHelperEx
is bound to, which is used in change notifications.- Returns:
- The source
ObservableMap
.
-
notifyInvalidationListeners
protected void notifyInvalidationListeners()Notifies all registeredInvalidationListener
s. -
notifyMapChangeListeners
Notifies the attachedMapChangeListener
s about the related change.- Parameters:
change
- The applied change.
-
removeListener
Removes the givenInvalidationListener
from thisMapListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-
removeListener
Removes the givenMapChangeListener
from thisMapListenerHelperEx
. If its was registered more than once, removes one occurrence.- Parameters:
listener
- The listener to remove.
-