public class IlvBufferFlatSetModel extends IlvDefaultFlatSetModel
IlvFlatSetModel
that
buffers (caches) the data of a given IlvFlatSetModel
.
It is meant to be used when the access to the original
IlvFlatSetModel
is slow.
Changes in the underlying model are propagated to this model
if the isNotifying
method returns true
.
Note: this model supports adding and removing objects
if the underlying IlvFlatSetModel
is an instance of
IlvDefaultFlatSetModel
. It supports adding and removing
columns if the underlying IlvFlatSetModel
is an instance of IlvBasicFlatSetModel
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBufferFlatSetModel(IlvFlatSetModel model)
Creates a model that is fed by and caches the data of a given
IlvFlatSetModel . |
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object object)
Adds an object to the model.
|
void |
addObject(Object object,
Object[] data)
Adds an object to the model.
|
void |
addObjects(Object[] objects)
Adds some objects to the model.
|
void |
clear()
Removes all objects from the model.
|
Object |
clone()
Returns a copy of this object.
|
void |
disconnect()
Drops references to objects to help garbage collection.
|
void |
dispose()
Cleans up this model and drops references to objects to
help garbage collection.
|
int |
getSupportedEventsMask()
Returns a bit mask denoting the optional kinds of events that are guaranteed
to be sent by this model to the registered listeners.
|
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column)
Adds a column to the model at a given index.
|
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
double[] data)
Adds a column with given data to the model at a given index.
|
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
Object[] data)
Adds a column with given data to the model at a given index.
|
boolean |
isNotifying()
Returns
true when this model is a dynamically updated cache
of the underlying model. |
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
void |
removeObject(Object object)
Removes an object from the model.
|
void |
removeObjects(Object[] objects)
Removes some objects from the model.
|
void |
setColumnCount(int columnCount)
Sets the number of columns in the model.
|
protected boolean |
setDoubleAtInternal(double value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt() . |
void |
setNotifying(boolean dynamic)
Determines whether this model is a dynamically updated cache of the
underlying event (and therefore also sends events when the underlying
model changes).
|
void |
setObjects(Collection objects)
Replaces the set of objects in the model.
|
protected boolean |
setValueAtInternal(Object value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
getDoubleAt, getObjects, getValueAt, setDoubleAt, setValueAt
addColumn, addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns, setColumn, setColumns
addFlatSetModelListener, convertToDouble, endBatch, removeFlatSetModelListener, startBatch
public IlvBufferFlatSetModel(IlvFlatSetModel model)
IlvFlatSetModel
.protected boolean setValueAtInternal(Object value, Object object, int columnIndex, boolean forReal)
setValueAt()
. Instead of notifying, it simply returns
a boolean
indicating whether notification should be done.
If forReal is false
, the value is not actually set, but the
method still returns the same Boolean, specifying whether the given value is
different from the previous one.
setValueAtInternal
in class IlvDefaultFlatSetModel
protected boolean setDoubleAtInternal(double value, Object object, int columnIndex, boolean forReal)
setDoubleAt()
. Instead of notifying, it simply returns
a boolean
indicating whether notification should be done.
If forReal is false
, the value is not actually set, but the
method still returns the same Boolean, specifying whether the given value is
different from the previous one.
setDoubleAtInternal
in class IlvDefaultFlatSetModel
public int getSupportedEventsMask()
This implementation returns
BEFORE_DATA_CHANGE_MASK | BEFORE_OBJECTS_REMOVED_MASK | BEFORE_COLUMN_REMOVED_MASK
.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatSetModel
getSupportedEventsMask
in class IlvDefaultFlatSetModel
IlvFlatSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatSetModel.BEFORE_COLUMN_REMOVED_MASK
public void setObjects(Collection objects)
setObjects
in class IlvDefaultFlatSetModel
public void addObject(Object object)
addObject
in class IlvDefaultFlatSetModel
public void addObjects(Object[] objects)
addObjects
in class IlvDefaultFlatSetModel
public void addObject(Object object, Object[] data)
addObject
in class IlvDefaultFlatSetModel
data
- The initial data of this object, must be an array of
getColumnCount()
elements.public void removeObject(Object object)
removeObject
in class IlvDefaultFlatSetModel
public void removeObjects(Object[] objects)
removeObjects
in class IlvDefaultFlatSetModel
public void clear()
clear
in class IlvDefaultFlatSetModel
public void setColumnCount(int columnCount)
columnCount
and greater are discarded.setColumnCount
in class IlvBasicFlatSetModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
insertColumn
in class IlvBasicFlatSetModel
columnIndex
- The new column desired index. It must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, Object[] data)
insertColumn
in class IlvBasicFlatSetModel
columnIndex
- The new column desired index. It must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.data
- The initial data of this column. This should be an array
of at least getObjects().size()
elements. Not used
if the column is a computed column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, double[] data)
insertColumn
in class IlvBasicFlatSetModel
columnIndex
- The new column desired index. It must be >= 0 and
<= getColumnCount()
.column
- The metainformation of this column.data
- The initial data of this column. This should be an array
of at least getObjects().size()
elements. Not used
if the column is a computed column.public void removeColumn(int columnIndex)
removeColumn
in class IlvBasicFlatSetModel
columnIndex
- The column index. It must be >= 0 and
< getColumnCount()
.public boolean isNotifying()
true
when this model is a dynamically updated cache
of the underlying model. Returns false
when this model is
a snapshot buffer of the underlying model.setNotifying(boolean)
public void setNotifying(boolean dynamic)
Note: If setNotifying(true)
is called, after the notification was
turned off, it has the effect of bringing the entire cache up to date;
this can be an expensive operation.
isNotifying()
public void dispose()
Note: after calling this function, this model is no longer functional.
dispose
in class IlvDefaultFlatSetModel
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying model or columns, this model is no longer functional.
disconnect
in class IlvBasicFlatSetModel
public Object clone()
clone
in class IlvDefaultFlatSetModel
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.