com.glaivestone.mv
Class AbstractValueHolder

java.lang.Object
  |
  +--com.glaivestone.mv.AbstractValueHolder
Direct Known Subclasses:
BooleanHolder, IntegerHolder, ValueHolder

public class AbstractValueHolder
extends java.lang.Object

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).

Subclass Responsibilities

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:

Origins

The 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

NOTIFY_FIRST_TO_LAST

public static final int NOTIFY_FIRST_TO_LAST
See Also:
Constant Field Values

NOTIFY_LAST_TO_FIRST

public static final int NOTIFY_LAST_TO_FIRST
See Also:
Constant Field Values

DEFAULT_NOTIFICATION_ORDER

public static int DEFAULT_NOTIFICATION_ORDER
Method Detail

addChangeListener

public void addChangeListener(ValueChangeListener aListener)
Register a value change listener to receive notification of any changes to the value.

Parameters:
aListener - the listener

removeChangeListener

public void removeChangeListener(ValueChangeListener aListener)
Removes a value change listener.

Parameters:
aListener - the listener

setNotificationOrder

public void setNotificationOrder(int notificationOrder)
Specify the notification order for listeners relative to their registration order.


GFL 1.1 API