Eclipse Platform
Release 3.3

org.eclipse.core.databinding.observable.map
Class ObservableMap

java.lang.Object
  extended by org.eclipse.core.databinding.observable.AbstractObservable
      extended by org.eclipse.core.databinding.observable.map.ObservableMap
All Implemented Interfaces:
java.util.Map, IObservable, IObservableMap
Direct Known Subclasses:
BidirectionalMap, WritableMap

public class ObservableMap
extends AbstractObservable
implements IObservableMap

This class is thread safe. All state accessing methods must be invoked from the current realm. Methods for adding and removing listeners may be invoked from any thread.

Since:
1.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
protected  java.util.Map wrappedMap
           
 
Constructor Summary
ObservableMap(java.util.Map wrappedMap)
           
ObservableMap(Realm realm, java.util.Map wrappedMap)
           
 
Method Summary
protected  void addListener(java.lang.Object listenerType, IObservablesListener listener)
           
 void addMapChangeListener(IMapChangeListener listener)
           
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.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.
 java.util.Set entrySet()
           
protected  void fireEvent(ObservableEvent event)
           
protected  void fireMapChange(MapDiff diff)
           
protected  void firstListenerAdded()
           
 java.lang.Object get(java.lang.Object key)
           
 Realm getRealm()
           
protected  void getterCalled()
           
protected  boolean hasListeners()
           
 boolean isEmpty()
           
 boolean isStale()
          Returns the stale state.
 java.util.Set keySet()
           
protected  void lastListenerRemoved()
           
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 void putAll(java.util.Map arg0)
           
 java.lang.Object remove(java.lang.Object key)
           
protected  void removeListener(java.lang.Object listenerType, IObservablesListener listener)
           
 void removeMapChangeListener(IMapChangeListener listener)
           
 void setStale(boolean stale)
          Sets the stale state.
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class org.eclipse.core.databinding.observable.AbstractObservable
addChangeListener, addStaleListener, checkRealm, fireChange, fireStale, removeChangeListener, removeStaleListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.databinding.observable.map.IObservableMap
equals, hashCode
 
Methods inherited from interface org.eclipse.core.databinding.observable.IObservable
addChangeListener, addStaleListener, getRealm, removeChangeListener, removeStaleListener
 

Field Detail

wrappedMap

protected java.util.Map wrappedMap
Constructor Detail

ObservableMap

public ObservableMap(java.util.Map wrappedMap)
Parameters:
wrappedMap -

ObservableMap

public ObservableMap(Realm realm,
                     java.util.Map wrappedMap)
Parameters:
realm -
wrappedMap -
Method Detail

addMapChangeListener

public void addMapChangeListener(IMapChangeListener listener)
Specified by:
addMapChangeListener in interface IObservableMap

removeMapChangeListener

public void removeMapChangeListener(IMapChangeListener listener)
Specified by:
removeMapChangeListener in interface IObservableMap

getterCalled

protected void getterCalled()

fireMapChange

protected void fireMapChange(MapDiff diff)

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
Specified by:
containsKey in interface IObservableMap

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map
Specified by:
containsValue in interface IObservableMap

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in interface IObservableMap

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
Specified by:
get in interface IObservableMap

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
Specified by:
isEmpty in interface IObservableMap

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
Specified by:
keySet in interface IObservableMap

size

public int size()
Specified by:
size in interface java.util.Map
Specified by:
size in interface IObservableMap

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map
Specified by:
values in interface IObservableMap

isStale

public boolean isStale()
Returns the stale state. Must be invoked from the current realm.

Specified by:
isStale in interface IObservable
Returns:
stale state

setStale

public void setStale(boolean stale)
Sets the stale state. Must be invoked from the current realm.

Parameters:
stale - The stale state to set. This will fire a stale event if the given boolean is true and this observable set was not already stale.

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
Specified by:
put in interface IObservableMap

remove

public java.lang.Object remove(java.lang.Object key)
Specified by:
remove in interface java.util.Map
Specified by:
remove in interface IObservableMap

clear

public void clear()
Specified by:
clear in interface java.util.Map

putAll

public void putAll(java.util.Map arg0)
Specified by:
putAll in interface java.util.Map

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 interface IObservable
Overrides:
dispose in class AbstractObservable

addListener

protected void addListener(java.lang.Object listenerType,
                           IObservablesListener listener)
Parameters:
listenerType -
listener -

removeListener

protected void removeListener(java.lang.Object listenerType,
                              IObservablesListener listener)
Parameters:
listenerType -
listener -

hasListeners

protected boolean hasListeners()

fireEvent

protected void fireEvent(ObservableEvent event)

firstListenerAdded

protected void firstListenerAdded()

lastListenerRemoved

protected void lastListenerRemoved()

getRealm

public Realm getRealm()
Returns:
Returns the realm.

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.