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

com::jgoodies::binding::value::DelayedReadValueModel Class Reference

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

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 deferres updates and read-access for a specified delay. Useful to coalesce frequent changes. For example if a heavy computation shall be performed only for a "stable" selection after a series of quick selection changes.

Wraps a given subject ValueModel and observes subject value changes and forwards them to listeners of this model after a delay. If the subject value changes, a Swing Timer is used to delay the change notification. A previously started timer - if any - will be stopped before. Reading this model's value returns: a) the subject value if there's no pending update, or b) this model's old value that will be updated after the delay. If a value is set to this model, it immediately updates the subject value.

TODO: Describe how and when listeners get notified about the delayed change.

TODO: Write about the recommended delay time - above the double-click time and somewhere below a second, e.g. 100ms to 200ms.

TODO: Write about a slightly different commit handling. The current implementation defers the commit until the value is stable for the specified delay; it's a DelayUntilStableForXXXmsValueModel. Another feature is to delay for a specified time but ensure that some commits and change notifications happen. The latter is a CoalescingWriteValueModel.

TODO: Summarize the differences between the DelayedReadValueModel, the DelayedWriteValueModel, and the DelayedPropertyChangeHandler.

Author:
Karsten Lentzsch
Version:
Revision
1.7

See also:
javax.swing.Timer
Since:
1.1

Definition at line 76 of file DelayedReadValueModel.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 ()
 DelayedReadValueModel (ValueModel subject, int delay, boolean coalesce)
 DelayedReadValueModel (ValueModel subject, int delay)
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 ()
int getDelay ()
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners (String propertyName)
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners ()
String getString ()
Object getValue ()
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners (String propertyName)
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners ()
final int intValue ()
boolean isCoalesce ()
final long longValue ()
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 setCoalesce (boolean b)
void setDelay (int delay)
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 newValue)
void stop ()
String toString ()

Static Public Attributes

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 fireDelayedValueChange (PropertyChangeEvent evt)
boolean hasPendingChange ()

Private Attributes

boolean coalesce
Object oldValue
PropertyChangeEvent pendingEvt
final ValueModel subject
final Timer timer

Classes

class  SubjectValueChangeHandler
class  ValueUpdateListener

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

Generated by  Doxygen 1.6.0   Back to index