public abstract class IlvBasicTreeListModel extends IlvAbstractTreeListModel implements Cloneable
IlvTreeListModel
interface which handles the notification to listeners of the model and
the management of the columns.
However, it does not constrain the nature of the objects stored in the model or of their attributes.
In order to implement an IlvTreeListModel
where the
attribute values are stored locally in each object, it is sufficient to
create a subclass of IlvBasicTreeListModel
that defines
the methods IlvTreeListModel.getRoot()
,
IlvTreeListModel.getChildren(java.lang.Object)
,
IlvTreeListModel.getValueAt(java.lang.Object, int)
,
IlvTreeListModel.setValueAt(java.lang.Object, java.lang.Object, int)
.
The definition of the methods IlvTreeListModel.getDoubleAt(java.lang.Object, int)
,
IlvTreeListModel.setDoubleAt(double, java.lang.Object, int)
can save the allocation of a Double
object at each
invocation. When the set of objects changes, or when the value of an
attribute of an object changes, the model should construct an appropriate
TreeListModelEvent
and call
IlvAbstractTreeListModel.fireModelEvent(ilog.views.chart.datax.tree.list.event.TreeListModelEvent)
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBasicTreeListModel()
Creates a model with zero columns.
|
IlvBasicTreeListModel(IlvDataColumnInfo[] columns)
Creates a model with the given columns.
|
IlvBasicTreeListModel(int numColumns)
Creates a model with the given number of columns.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(IlvDataColumnInfo column)
Adds a column to the model.
|
void |
addColumn(IlvDataColumnInfo column,
Map data)
Adds a column with given data to the model.
|
protected void |
addColumnStorage(int columnIndex,
int insertedColumnCount)
Adds storage for new columns.
|
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.
|
void |
fireModelEvent(TreeListModelEvent event)
Notifies the listeners of a model event.
|
IlvDataColumnInfo |
getColumn(int columnIndex)
Returns metainformation about a column.
|
int |
getColumnCount()
Returns the number of columns in the model.
|
List<IlvDataColumnInfo> |
getColumns()
Returns the list of columns.
|
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.
|
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAt and setDoubleAt on a given column have no
effect. |
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
protected void |
removeColumnStorage(int columnIndex,
int removedColumnCount)
Removes storage for columns that have been dropped.
|
void |
setColumn(int i,
IlvDataColumnInfo column)
Replaces or adds a column.
|
void |
setColumnCount(int columnCount)
Sets the number of columns in the model.
|
void |
setColumns(List<IlvDataColumnInfo> columns)
Sets the list of columns.
|
addTreeListModelListener, convertToDouble, endBatch, getPath, postOrderIterator, preOrderIterator, removeTreeListModelListener, startBatch
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildren, getDoubleAt, getRoot, getValueAt, setDoubleAt, setValueAt
public IlvBasicTreeListModel()
public IlvBasicTreeListModel(int numColumns)
public IlvBasicTreeListModel(IlvDataColumnInfo[] columns)
public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount
in interface IlvModelWithColumns
getColumnCount
in interface IlvTreeListModel
public IlvDataColumnInfo getColumn(int columnIndex)
getColumn
in interface IlvModelWithColumns
getColumn
in interface IlvTreeListModel
columnIndex
- The column.protected boolean isColumnComputed(int columnIndex)
true
if setValueAt
and setDoubleAt
on a given column have no
effect.public int getSupportedEventsMask()
This implementation returns BEFORE_COLUMN_REMOVED_MASK
.
It ought to be overridden in subclasses.
getSupportedEventsMask
in interface IlvTreeListModel
getSupportedEventsMask
in class IlvAbstractTreeListModel
IlvTreeListModel.BEFORE_DATA_CHANGE_MASK
,
IlvTreeListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvTreeListModel.BEFORE_COLUMN_REMOVED_MASK
public void fireModelEvent(TreeListModelEvent event)
fireModelEvent
in class IlvAbstractTreeListModel
protected void addColumnStorage(int columnIndex, int insertedColumnCount)
protected void removeColumnStorage(int columnIndex, int removedColumnCount)
public void setColumnCount(int columnCount)
columnCount
and greater are discarded.columnCount
- the new number of columnspublic void addColumn(IlvDataColumnInfo column)
column
- The meta information of this column.public void addColumn(IlvDataColumnInfo column, Map data)
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 insertColumn(int columnIndex, IlvDataColumnInfo column)
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
.column
- The meta information of this column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, Map data)
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)
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public List<IlvDataColumnInfo> getColumns()
IlvDataColumnInfo
that cannot be modified.public void setColumns(List<IlvDataColumnInfo> columns)
columns
- A list of IlvDataColumnInfo
.public void setColumn(int i, IlvDataColumnInfo column)
removeColumn(i)
followed by
insertColumn(i, column)
.column
- An IlvDataColumnInfo
.public void dispose()
Note: After calling this function, this model is no longer functional.
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying columns, this model is no longer functional.
public Object clone()
clone
in class IlvAbstractTreeListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.