Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
com.jgoodies.binding.beans.Model
com.jgoodies.binding.value.AbstractValueModel
com.jgoodies.binding.value.DelayedReadValueModel
public final class DelayedReadValueModel
extends AbstractValueModel
javax.swing.Timer
Field Summary |
Fields inherited from class com.jgoodies.binding.value.AbstractValueModel | |
PROPERTYNAME_VALUE |
Constructor Summary | |
| |
|
Method Summary | |
int |
|
Object |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class com.jgoodies.binding.value.AbstractValueModel | |
addValueChangeListener , booleanValue , doubleValue , fireValueChange , fireValueChange , fireValueChange , fireValueChange , fireValueChange , fireValueChange , fireValueChange , floatValue , getString , intValue , longValue , removeValueChangeListener , setValue , setValue , setValue , setValue , setValue , toString |
public DelayedReadValueModel(ValueModel subject, int delay)
Constructs a DelayedReadValueModel for the given subject ValueModel and the specified Timer delay in milliseconds with coalescing disabled.
- Parameters:
subject
- the underlying (or wrapped) ValueModeldelay
- the milliseconds to wait before a change shall be committed
public DelayedReadValueModel(ValueModel subject, int delay, boolean coalesce)
Constructs a DelayedReadValueModel for the given subject ValueModel and the specified Timer delay in milliseconds using the given coalesce mode.
- Parameters:
subject
- the underlying (or wrapped) ValueModeldelay
- the milliseconds to wait before a change shall be committedcoalesce
-true
to coalesce all pending changes,false
to fire changes with the delay when an update has been received
- See Also:
setCoalesce(boolean)
public int getDelay()
Returns the delay, in milliseconds, that is used to defer value change notifications.
- Returns:
- the delay, in milliseconds, that is used to defer value change notifications
- See Also:
setDelay(int)
public Object getValue()
Returns the subject's value or in case of a pending commit, the pending new value.
- Specified by:
- getValue in interface ValueModel
- Returns:
- the subject's current or future value.
public boolean isCoalesce()
Returns if this model coalesces all pending changes or not.
- Returns:
true
if all pending changes will be coalesced,false
if pending changes are fired with a delay when an update has been received.
- See Also:
setCoalesce(boolean)
public void setCoalesce(boolean b)
Sets if this model shall coalesce all pending changes or not. In this case, a change event will be fired first, if no updates have been received for this model's delay. If coalesce isfalse
, a change event will be fired with this model's delay when an update has been received. The default value isfalse
. Note that this value is not the #coalesce value of this model's internal Swing timer.
- Parameters:
b
-true
to coalesce,false
to fire separate changes
public void setDelay(int delay)
Sets the delay, in milliseconds, that is used to defer value change notifications.
- Parameters:
delay
- the delay, in milliseconds, that is used to defer value change notifications
- See Also:
getDelay()
public void setValue(Object newValue)
Sets the given new value immediately as the subject's new value. Note that change notifications from the subject are deferred by this model. Therefore listeners registered with this model will be notified after this model's delay.
- Specified by:
- setValue in interface ValueModel
- Parameters:
newValue
- the value to set
public void stop()
Stops a running timer - if any. The last pending change won't be performed by theValueUpdateListener
.
- Since:
- 1.2