A ValueModel implementation that is intended to be used as trigger channel
for instances of BufferedValueModel. API users shall trigger commit and flush
events using #triggerCommit and #triggerFlush .
This Trigger class works around an inconvenient situation when using
a general ValueHolder as trigger channel of a BufferedValueModel.
BufferedValueHolder performs commit and flush events only if the trigger
channel value reports a change. And a ValueHolder doesn't report a change
if #setValue tries to set the current value. For example
if you set Boolean.TRUE twice, the latter doesn't fire
a property change event. The methods #triggerCommit and
#triggerFlush check for the current state and guarantee
that the appropriate PropertyChangeEvent is fired.
On the other hand, the implementation minimizes the number of events
necessary to commit or flush buffered values.
Constraints: The value is of type Boolean .
The following example delays the commit of a buffered value:
ValueModel subject = new ValueHolder();
Trigger trigger = new Trigger();
BufferedValueModel buffer = new BufferedValueModel(subject, trigger);
buffer.setValue("value");
...
trigger.triggerCommit();
author: Karsten Lentzsch version: $Revision: 1.5 $ See Also: BufferedValueModel |