public class IlvBatchingDataSetListener extends Object implements DataSetListener, Serializable
When an instance of this class is installed as a listener to a data set,
it will accept events from this data set, process them, and forward
them in a summarized way to the given DataSetListener
.
The event processing is as follows:
BEFORE_DATA_CHANGED
and AFTER_DATA_CHANGED
events are combined to DATA_CHANGED
events.
DATA_CHANGED
events are combined if possible.
DATA_ADDED
events are combined if possible.
FULL_UPDATE
events cause earlier events to be dropped.
combineAll
is true
and still more than
one event remains at the end of the batch, all events are combined
into a single FULL_UPDATE
event, and
BATCH_BEGIN
and BATCH_END
events are
dropped.DataSetPropertyEvent
s are always forwarded immediately
without change.
While this listener wrapper forwards no content events after it has seen a
BATCH_BEGIN
event but before it has received the corresponding
BATCH_END
event, it also loses some fine-grained information
about the changes that have occurred in the data set. Such fine-grained
information is needed, however, for optimized redrawing or optimized
incremental changes.
This class is useful when a data source is being modified very frequently,
and reacting on a FULL_UPDATE
event is not very expensive.
This class is not useful if the reaction on a
FULL_UPDATE
event takes significantly longer than the reaction
on a pair of BEFORE_DATA_CHANGED
/AFTER_DATA_CHANGED
events.
Note: An instance of this class assumes that events that are sent to it come a single data set only. It cannot batch a multiplexed stream of events from different data sets.
Constructor and Description |
---|
IlvBatchingDataSetListener(DataSetListener listener,
boolean combineAll)
Creates an instance of this listener wrapper.
|
Modifier and Type | Method and Description |
---|---|
void |
dataSetContentsChanged(DataSetContentsEvent event)
Invoked when the content of a data set is modified in some way (data added,
data updated, ...)
|
void |
dataSetPropertyChanged(DataSetPropertyEvent event)
Invoked when a property of a data set has been modified.
|
public IlvBatchingDataSetListener(DataSetListener listener, boolean combineAll)
listener
- The listener to which this listener shall forward its
events.combineAll
- If true
, the resulting instance will do
everything possible to combine multiple events into
a single event.public void dataSetContentsChanged(DataSetContentsEvent event)
dataSetContentsChanged
in interface DataSetListener
DataSetContentsEvent
public void dataSetPropertyChanged(DataSetPropertyEvent event)
dataSetPropertyChanged
in interface DataSetListener
DataSetPropertyEvent
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.