Class DecoratingObservableMap<K,V>
java.lang.Object
org.eclipse.core.databinding.observable.AbstractObservable
org.eclipse.core.databinding.observable.DecoratingObservable
org.eclipse.core.databinding.observable.map.DecoratingObservableMap<K,V>
- Type Parameters:
K
- type of the keys to the mapV
- type of the values in the map
- All Implemented Interfaces:
Map<K,
,V> IDecoratingObservable
,IObservable
,IObservableMap<K,
V>
- Direct Known Subclasses:
BidiObservableMap
public class DecoratingObservableMap<K,V>
extends DecoratingObservable
implements IObservableMap<K,V>
An observable map which decorates another observable map.
- Since:
- 1.2
- Implementation Note:
- If methods are added to the interface which this class implements then implementations of those methods must be added to this class.
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDecoratingObservableMap
(IObservableMap<K, V> decorated, boolean disposeDecoratedOnDispose) Constructs a DecoratingObservableMap which decorates the given observable. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addListener
(Object listenerType, IObservablesListener listener) void
addMapChangeListener
(IMapChangeListener<? super K, ? super V> listener) void
clear()
protected Object
clone()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) void
dispose()
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.entrySet()
boolean
protected void
protected void
fireEvent
(ObservableEvent event) protected void
fireMapChange
(MapDiff<K, V> diff) protected void
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.getRealm()
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.protected void
handleMapChange
(MapChangeEvent<? extends K, ? extends V> event) Called whenever a MapChangeEvent is received from the decorated observable.int
hashCode()
protected boolean
boolean
isEmpty()
keySet()
protected void
void
protected void
removeListener
(Object listenerType, IObservablesListener listener) void
removeMapChangeListener
(IMapChangeListener<? super K, ? super V> listener) int
size()
toString()
values()
Methods inherited from class org.eclipse.core.databinding.observable.DecoratingObservable
getDecorated, getterCalled, handleStaleEvent, isStale
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addDisposeListener, addStaleListener, checkRealm, fireStale, isDisposed, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addDisposeListener, addStaleListener, getRealm, isDisposed, isStale, removeChangeListener, removeDisposeListener, removeStaleListener
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
DecoratingObservableMap
Constructs a DecoratingObservableMap which decorates the given observable.- Parameters:
decorated
- the observable map being decorateddisposeDecoratedOnDispose
- whether the decorated observable should be disposed when the decorator is disposed
-
-
Method Details
-
addMapChangeListener
- Specified by:
addMapChangeListener
in interfaceIObservableMap<K,
V> - Parameters:
listener
- the change listener to add; notnull
-
removeMapChangeListener
- Specified by:
removeMapChangeListener
in interfaceIObservableMap<K,
V> - Parameters:
listener
- the change listener to remove; notnull
-
getKeyType
Description copied from interface:IObservableMap
Returns the element type for thekeyset
of this observable map, ornull
if the keyset is untyped.- Specified by:
getKeyType
in interfaceIObservableMap<K,
V> - Returns:
- the element type for the
keyset
of this observable map, ornull
if the keyset is untyped.
-
getValueType
Description copied from interface:IObservableMap
Returns the element type for thevalues
of this observable map, ornull
if the values collection is untyped.- Specified by:
getValueType
in interfaceIObservableMap<K,
V> - Returns:
- the element type for the
values
of this observable map, ornull
if the values collection is untyped.
-
fireMapChange
-
fireChange
protected void fireChange()- Overrides:
fireChange
in classAbstractObservable
-
firstListenerAdded
protected void firstListenerAdded()- Overrides:
firstListenerAdded
in classDecoratingObservable
-
lastListenerRemoved
protected void lastListenerRemoved()- Overrides:
lastListenerRemoved
in classDecoratingObservable
-
handleMapChange
Called whenever a MapChangeEvent is received from the decorated observable. By default, this method fires the map change event again, with the decorating observable as the event source. Subclasses may override to provide different behavior.- Parameters:
event
- the change event received from the decorated observable
-
clear
public void clear() -
containsKey
- Specified by:
containsKey
in interfaceIObservableMap<K,
V> - Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceIObservableMap<K,
V> - Specified by:
containsValue
in interfaceMap<K,
V>
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
equals
- Specified by:
equals
in interfaceIObservableMap<K,
V> - Specified by:
equals
in interfaceMap<K,
V> - Overrides:
equals
in classDecoratingObservable
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfaceIObservableMap<K,
V> - Specified by:
hashCode
in interfaceMap<K,
V> - Overrides:
hashCode
in classDecoratingObservable
-
toString
-
dispose
public void dispose()Description copied from interface:IObservable
Disposes of this observable object, removing all listeners registered with this object, and all listeners this object might have registered on other objects.- Specified by:
dispose
in interfaceIObservable
- Overrides:
dispose
in classDecoratingObservable
-
addListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to add; notnull
-
removeListener
- Parameters:
listenerType
- arbitrary object to identify a type of the listenerlistener
- the listener to remove; notnull
-
hasListeners
protected boolean hasListeners() -
fireEvent
-
getRealm
- Returns:
- Returns the realm.
-
clone
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-