|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Dictionary<K,V> java.util.Hashtable org.biomoby.service.dashboard.PropertyChannel
public class PropertyChannel
PropertyChannel is a shared storage for properties created by panels and their models. It is a Hashtable but extends it because whenever a value is created or updated, it also fires an event to inform about it its listeners. In other words, this channel provides its stored properties in two ways:
Additionally, it also serves as a PropertyChangeSupport object: it
can register and deregister PropertyChangeListeners, and it can
fire an event to them on behave of other objects. The other objects
either identify themselves (see method fire(Object,String,Object)
), or use this channel for firing
anonymous messages (see method fire(String,Object)
) - in
which case the message source will be this class.
The fired events are stored here under their names. That means that you can always get the last event of a particular name.
The panels/models are sending here properties by calling method put. If we find, in the future, that sending properties here is better to do by listening to them (being a property change listener) we may re-consider this desision. At the moment, I do not see any advantage of it.
Concrete property names are of no interest for this class, but it
is good to remind that they should be collected in the class DashboardProperties
.
Constructor Summary | |
---|---|
PropertyChannel()
Default constructor. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener l)
Register listeners. |
void |
fire(Object source,
String key,
Object value)
Fire an event to any registered listeners. |
void |
fire(String key,
Object value)
Fire an event to any registered listeners. |
boolean |
getBoolean(Object key,
boolean defaultValue)
|
String |
getString(Object key)
|
Object |
put(Object key,
Object value)
Maps the specified key to the specified value in this hashtable. |
Object |
put(Object source,
Object key,
Object value)
Maps the specified key to the specified value in this hashtable. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Unregister listeners. |
Methods inherited from class java.util.Hashtable |
---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, remove, size, toString, values |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PropertyChannel()
Method Detail |
---|
public Object put(Object key, Object value)
The given value, apart from being stored, is also propagated by
firing a property change event (this is called a channel
push style). The event is anonymous. If you need to send
the source of the message to the listeners, use instead put(Object,Object,Object)
.
put
in interface Map
put
in class Hashtable
key
- the hashtable keyvalue
- the value
public Object put(Object source, Object key, Object value)
The given value, apart from being stored, is also propagated by
firing a property change event (this is called a channel
push style). The event contains also its 'source'. For
anonymously sent events, use instead put(Object,Object)
.
source
- that initiated this eventkey
- the hashtable keyvalue
- the value
public String getString(Object key)
public boolean getBoolean(Object key, boolean defaultValue)
public void fire(String key, Object value)
key
- is a name of the fired eventvalue
- is a value associated with this eventpublic void fire(Object source, String key, Object value)
source
- that initiated the eventkey
- is a name of the fired eventvalue
- is a value associated with this eventpublic void addPropertyChangeListener(PropertyChangeListener l)
public void removePropertyChangeListener(PropertyChangeListener l)
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |