public class IlvBufferTreeSetModel extends IlvDefaultTreeSetModel
IlvTreeSetModel
that
buffers (caches) the data of a given IlvTreeSetModel
.
It is meant to be used when the access to the original
IlvTreeSetModel
is slow.
Changes in the underlying model are propagated to this model if and
only if the isNotifying
method returns true
.
Note: This model supports adding and removing objects if and only
if the underlying IlvTreeSetModel
is an instance of
IlvDefaultTreeSetModel
. It supports adding and removing
columns if and only if the underlying IlvTreeSetModel
is an instance of IlvBasicTreeSetModel
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBufferTreeSetModel(IlvTreeSetModel model)
Creates a model that is fed by and caches the data of a given
IlvTreeSetModel . |
Modifier and Type | Method and Description |
---|---|
void |
addChild(Object object,
Object parent)
Adds an object to the list of children of a parent object in the model.
|
void |
addChildren(Object[] objects,
Object parent)
Adds some objects to the list of children of a parent object in the model
at a given index.
|
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,
Map 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 |
removeAllChildren(Object parent)
Removes all children objects of a parent object in the model.
|
void |
removeChild(Object object,
Object parent)
Removes an object from the list of children of a parent object in the
model.
|
void |
removeChildren(Object[] objects,
Object parent)
Removes some children of a common parent object, and their subtrees,
from the model.
|
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
void |
setChildren(Object parent,
Collection newChildren)
Replaces the set of children of a given object in 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 |
setRoot(Object object)
Changes the root object of the model.
|
protected boolean |
setValueAtInternal(Object value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
clear, getChildren, getDoubleAt, getParent, getPath, getRoot, getValueAt, setDoubleAt, setValueAt
addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns, setColumn, setColumns
addTreeSetModelListener, convertToDouble, endBatch, postOrderIterator, preOrderIterator, removeTreeSetModelListener, startBatch
public IlvBufferTreeSetModel(IlvTreeSetModel model)
IlvTreeSetModel
.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, indicating whether the given value is
different from the previous one.
setValueAtInternal
in class IlvDefaultTreeSetModel
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, indicating whether the given value is
different from the previous one.
setDoubleAtInternal
in class IlvDefaultTreeSetModel
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 IlvTreeSetModel
getSupportedEventsMask
in class IlvDefaultTreeSetModel
IlvTreeSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvTreeSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvTreeSetModel.BEFORE_COLUMN_REMOVED_MASK
public void setRoot(Object object)
setChildren()
method.
Note: All attribute values are lost.setRoot
in class IlvDefaultTreeSetModel
object
- The new root, or null
.public void setChildren(Object parent, Collection newChildren)
setChildren()
method.
Note: All attribute values of children, grand-children and so on are lost.setChildren
in class IlvDefaultTreeSetModel
public void addChild(Object object, Object parent)
addChild
in class IlvDefaultTreeSetModel
public void addChildren(Object[] objects, Object parent)
addChildren
in class IlvDefaultTreeSetModel
public void removeChild(Object object, Object parent)
removeChild
in class IlvDefaultTreeSetModel
public void removeChildren(Object[] objects, Object parent)
removeChildren
in class IlvDefaultTreeSetModel
objects
- Some objects that were in getChildren(parent)
.public void removeAllChildren(Object parent)
removeAllChildren
in class IlvDefaultTreeSetModel
public void setColumnCount(int columnCount)
columnCount
and greater are discarded.setColumnCount
in class IlvBasicTreeSetModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
insertColumn
in class IlvBasicTreeSetModel
columnIndex
- The new columns desired index, must be >= 0 and
<= getColumnCount()
.column
- The meta information of this column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, Map data)
insertColumn
in class IlvBasicTreeSetModel
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
.column
- The meta information of this column.data
- The initial data of this column. This should be a map
that assigns a value to every object in this model.public void removeColumn(int columnIndex)
removeColumn
in class IlvBasicTreeSetModel
columnIndex
- The column index, 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: The call of setNotifying(true)
after the notification was
turned off 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 IlvDefaultTreeSetModel
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 IlvBasicTreeSetModel
public Object clone()
clone
in class IlvDefaultTreeSetModel
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.