vitro.util
Class ObservableMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by vitro.util.ObservableMap<K,V>
All Implemented Interfaces:
Map<K,V>, ObservableCollection<Map.Entry<K,V>>
Direct Known Subclasses:
ReversibleMap

public class ObservableMap<K,V>
extends AbstractMap<K,V>
implements ObservableCollection<Map.Entry<K,V>>

An ObservableCollection implementing the Map interface by way of extending AbstractMap and wrapping an internal Map.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ObservableMap()
          Create a new, empty Map.
ObservableMap(Map<? extends K,? extends V> c)
          Create a new Map with the same elements as another Map.
ObservableMap(Map<? extends K,? extends V> c, ObservableCollection host)
          Create a new Map with the same elements as another Map.
 
Method Summary
 void addObserver(CollectionObserver<Map.Entry<K,V>> o)
          Register a CollectionObserver with this Collection.
 Set<Map.Entry<K,V>> entrySet()
           
 V put(K key, V value)
           
 Map<K,V> store()
          Obtain a reference to the backing store used by this Map.
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObservableMap

public ObservableMap()
Create a new, empty Map.


ObservableMap

public ObservableMap(Map<? extends K,? extends V> c)
Create a new Map with the same elements as another Map.

Parameters:
c - the source Map.

ObservableMap

public ObservableMap(Map<? extends K,? extends V> c,
                     ObservableCollection host)
Create a new Map with the same elements as another Map. Update notifications will be sent to observers as if originating at the supplied host ObservableCollection.

Parameters:
c - the source Collection.
host - the host ObservableCollection
Method Detail

addObserver

public void addObserver(CollectionObserver<Map.Entry<K,V>> o)
Description copied from interface: ObservableCollection
Register a CollectionObserver with this Collection. The callbacks provided in the CollectionObserver interface will be fired whenever elements are added to or removed from this Collection.

Specified by:
addObserver in interface ObservableCollection<Map.Entry<K,V>>
Parameters:
o - the CollectionObserver to register.

store

public Map<K,V> store()
Obtain a reference to the backing store used by this Map. Changes to the backing store will not trigger calls to any observers of this collection.

Returns:
the internal Map.

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>
Specified by:
entrySet in class AbstractMap<K,V>

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>
Overrides:
put in class AbstractMap<K,V>