Logo Search packages:      
Sourcecode: libjgoodies-binding-java version File versions

com::jgoodies::binding::value::BufferedValueModel Class Reference

Inheritance diagram for com::jgoodies::binding::value::BufferedValueModel:

com::jgoodies::binding::value::AbstractValueModel com::jgoodies::binding::beans::Model com::jgoodies::binding::value::ValueModel com::jgoodies::binding::beans::Observable

List of all members.


Detailed Description

A ValueModel that wraps another ValueModel, the subject, and delays changes of the subject's value. Returns the subject's value until a value has been set. The buffered value is not written to the subject until the trigger channel changes to Boolean.TRUE. The buffered value can be flushed by changing the trigger channel value to Boolean.FALSE. Note that the commit and flush events are performed only if the trigger channel fires a change event. Since a plain ValueHolder fires no property change event if a value is set that has been set before, it is recommended to use a Trigger instead and invoke its triggerCommit and triggerFlush methods.

The BufferedValueModel has been designed to behave much like its subject when accessing the value. Therefore it throws all exceptions that would arise when accessing the subject directly. Hence, attempts to read or write a value while the subject is null are always rejected with a NullPointerException.

This class provides the bound read-write properties subject and triggerChannel for the subject and trigger channel and a bound read-only property buffering for the buffering state.

The BufferedValueModel registers listeners with the subject and trigger channel. It is recommended to remove these listeners by invoking release if the subject and trigger channel live much longer than this buffer. After release has been called you must not use the BufferedValueModel instance any longer. As an alternative you may use event listener lists in subjects and trigger channels that are based on WeakReferences.

If the subject value changes while this model is in buffering state this change won't show through as this model's new value. If you want to update the value whenever the subject value changes, register a listener with the subject value and flush this model's trigger.

Constraints: The subject is of type Object, the trigger channel value of type Boolean.

Author:
Karsten Lentzsch
Version:
Revision
1.6

See also:
ValueModel

ValueModel::getValue()

ValueModel::setValue(Object)

Definition at line 83 of file BufferedValueModel.java.


Public Member Functions

final synchronized void addPropertyChangeListener (String propertyName, PropertyChangeListener listener)
final synchronized void addPropertyChangeListener (PropertyChangeListener listener)
final void addValueChangeListener (PropertyChangeListener l)
final synchronized void addVetoableChangeListener (String propertyName, VetoableChangeListener listener)
final synchronized void addVetoableChangeListener (VetoableChangeListener listener)
final boolean booleanValue ()
 BufferedValueModel (ValueModel subject, ValueModel triggerChannel)
final double doubleValue ()
final void fireValueChange (float oldValue, float newValue)
final void fireValueChange (double oldValue, double newValue)
final void fireValueChange (long oldValue, long newValue)
final void fireValueChange (int oldValue, int newValue)
final void fireValueChange (boolean oldValue, boolean newValue)
final void fireValueChange (Object oldValue, Object newValue, boolean checkIdentity)
final void fireValueChange (Object oldValue, Object newValue)
final float floatValue ()
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners (String propertyName)
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners ()
String getString ()
ValueModel getSubject ()
ValueModel getTriggerChannel ()
Object getValue ()
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners (String propertyName)
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners ()
final int intValue ()
boolean isBuffering ()
final long longValue ()
void release ()
final synchronized void removePropertyChangeListener (String propertyName, PropertyChangeListener listener)
final synchronized void removePropertyChangeListener (PropertyChangeListener listener)
final void removeValueChangeListener (PropertyChangeListener l)
final synchronized void removeVetoableChangeListener (String propertyName, VetoableChangeListener listener)
final synchronized void removeVetoableChangeListener (VetoableChangeListener listener)
void setSubject (ValueModel newSubject)
void setTriggerChannel (ValueModel newTriggerChannel)
final void setValue (long l)
final void setValue (int i)
final void setValue (float f)
final void setValue (double d)
final void setValue (boolean b)
void setValue (Object newBufferedValue)
String toString ()

Static Public Attributes

static final String PROPERTYNAME_BUFFERING = "buffering"
static final String PROPERTYNAME_SUBJECT = "subject"
static final String PROPERTYNAME_TRIGGER_CHANNEL = "triggerChannel"
static final String PROPERTYNAME_VALUE = "value"

Protected Member Functions

final boolean equals (Object o1, Object o2)
final void fireMultiplePropertiesChanged ()
final void firePropertyChange (String propertyName, long oldValue, long newValue)
final void firePropertyChange (String propertyName, int oldValue, int newValue)
final void firePropertyChange (String propertyName, float oldValue, float newValue)
final void firePropertyChange (String propertyName, double oldValue, double newValue)
final void firePropertyChange (String propertyName, boolean oldValue, boolean newValue)
final void firePropertyChange (String propertyName, Object oldValue, Object newValue, boolean checkIdentity)
final void firePropertyChange (String propertyName, Object oldValue, Object newValue)
final void firePropertyChange (PropertyChangeEvent event)
final void fireVetoableChange (String propertyName, long oldValue, long newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, float oldValue, float newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, int oldValue, int newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, double oldValue, double newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, boolean oldValue, boolean newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
final void fireVetoableChange (PropertyChangeEvent event) throws PropertyVetoException

Private Member Functions

void commit ()
void flush ()
ReadAccessResult readBufferedOrSubjectValue ()
void setBuffering (boolean newValue)

Private Attributes

Object bufferedValue
ValueModel subject
final TriggerChangeHandler triggerChangeHandler
ValueModel triggerChannel
boolean valueAssigned
final ValueChangeHandler valueChangeHandler

Classes

class  ReadAccessResult
class  TriggerChangeHandler
class  ValueChangeHandler

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index