|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap
nl.knowledgeplaza.util.collection.ObservableMap
public class ObservableMap
The ObservableMap subclasses the HashMap and overrides all the functions that change the internally stored collection. In the overridden function, it simply calls the super class's function and fires a CollectionEvent to let observers know the collection has changed.
| Field Summary | |
|---|---|
protected java.util.ArrayList |
listeners
the observers of this collection |
| Constructor Summary | |
|---|---|
ObservableMap()
Constructs an empty HashMap with the default initial capacity (16) and the default load factor (0.75). |
|
ObservableMap(int initialCapacity)
Constructs an empty HashMap with the specified initial capacity and the default load factor (0.75). |
|
ObservableMap(int initialCapacity,
float loadFactor)
Constructs an empty HashMap with the specified initial capacity and load factor. |
|
ObservableMap(java.util.Map m)
Constructs a new HashMap with the same mappings as the specified Map. |
|
| Method Summary | |
|---|---|
void |
addCollectionListener(CollectionListener l)
Adds a listener to this collection. |
void |
clear()
Calls the super class's corresponding method and fires a CollectionEvent. |
protected void |
fireCollectionEvent(CollectionEvent e)
Fires a CollectionEvent to all listeners. |
java.lang.Object |
getObservedCollection()
To access the collection that is being observed. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
putAll(java.util.Map t)
Calls the super class's corresponding method and fires a CollectionEvent. |
java.lang.Object |
remove(java.lang.Object key)
Calls the super class's corresponding method and fires a CollectionEvent. |
void |
removeCollectionListener(CollectionListener l)
Removes the listener from this collection. |
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
protected java.util.ArrayList listeners
| Constructor Detail |
|---|
public ObservableMap(int initialCapacity,
float loadFactor)
initialCapacity - The initial capacity.loadFactor - The load factor.public ObservableMap(int initialCapacity)
initialCapacity - the initial capacity.public ObservableMap()
public ObservableMap(java.util.Map m)
m - the map whose mappings are to be placed in this map.| Method Detail |
|---|
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
put in interface java.util.Mapput in class java.util.HashMappublic java.lang.Object remove(java.lang.Object key)
remove in interface java.util.Mapremove in class java.util.HashMappublic void putAll(java.util.Map t)
putAll in interface java.util.MapputAll in class java.util.HashMappublic void clear()
clear in interface java.util.Mapclear in class java.util.HashMappublic void addCollectionListener(CollectionListener l)
addCollectionListener in interface ObservableCollectionl - the CollectionListenerpublic void removeCollectionListener(CollectionListener l)
removeCollectionListener in interface ObservableCollectionl - the CollectionListenerprotected void fireCollectionEvent(CollectionEvent e)
e - the CollectionEventpublic java.lang.Object getObservedCollection()
getObservedCollection in interface ObservableCollection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||