|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.glaivestone.mv.AbstractValueHolder
Abstract superclass for typed implementations of models which hold an observed value. A value change event is fired to notify interested observers when the value has been changed.
Clients update the value using the setValue
message.
To update the value without triggering a value-change notification,
clients should use the setValueAttribute
message.
Suppressing the value change event notification is sometimes necessary
to avoid update cycles among multiple observers.
The owner of the value holder can configure the order in which listeners are notified of a value change. The default notification order is last-to-first (reverse order of registration), following the Swing convention (in constrast to the first-to-last order used in the Java bean component model for property change notofications).
Subclasses are responsible for providing value storage and implementing accessor methods and value-change detection logic.
By convention, concrete subclasses support the following services with suitable typing on the argument and return values:
getValue()
- answer the current valuesetValue(newValue)
- set the current value and trigger the change eventsetValueAttribute(newValue)
- set the current value without triggering the change eventThe value holder mechanism was inspired by mechanisms in the Visual Smalltalk event system and ApplicationModel framework. *@author Deb Lewis
Field Summary | |
static int |
DEFAULT_NOTIFICATION_ORDER
|
static int |
NOTIFY_FIRST_TO_LAST
|
static int |
NOTIFY_LAST_TO_FIRST
|
Method Summary | |
void |
addChangeListener(ValueChangeListener aListener)
Register a value change listener to receive notification of any changes to the value. |
void |
removeChangeListener(ValueChangeListener aListener)
Removes a value change listener. |
void |
setNotificationOrder(int notificationOrder)
Specify the notification order for listeners relative to their registration order. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NOTIFY_FIRST_TO_LAST
public static final int NOTIFY_LAST_TO_FIRST
public static int DEFAULT_NOTIFICATION_ORDER
Method Detail |
public void addChangeListener(ValueChangeListener aListener)
aListener
- the listenerpublic void removeChangeListener(ValueChangeListener aListener)
aListener
- the listenerpublic void setNotificationOrder(int notificationOrder)
|
GFL 1.1 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |