public abstract class IlvBasicTreeSetModel extends IlvAbstractTreeSetModel implements Cloneable
IlvTreeSetModel
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 IlvTreeSetModel
where the
attribute values are stored locally in each object, it is sufficient to
create a subclass of IlvBasicTreeSetModel
that defines
the methods IlvTreeSetModel.getRoot()
,
IlvTreeSetModel.getChildren(java.lang.Object)
,
IlvTreeSetModel.getValueAt(java.lang.Object, int)
,
IlvTreeSetModel.setValueAt(java.lang.Object, java.lang.Object, int)
.
The definition of the methods IlvTreeSetModel.getDoubleAt(java.lang.Object, int)
and
IlvTreeSetModel.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
TreeSetModelEvent
and call
IlvAbstractTreeSetModel.fireModelEvent(ilog.views.chart.datax.tree.set.event.TreeSetModelEvent)
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBasicTreeSetModel()
Creates a model with zero columns.
|
IlvBasicTreeSetModel(IlvDataColumnInfo[] columns)
Creates a model with the given columns.
|
IlvBasicTreeSetModel(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.
|
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(TreeSetModelEvent 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.
|
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
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.
|
addTreeSetModelListener, convertToDouble, endBatch, getPath, postOrderIterator, preOrderIterator, removeTreeSetModelListener, startBatch
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getChildren, getDoubleAt, getRoot, getValueAt, setDoubleAt, setValueAt
public IlvBasicTreeSetModel()
public IlvBasicTreeSetModel(int numColumns)
public IlvBasicTreeSetModel(IlvDataColumnInfo[] columns)
public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount
in interface IlvModelWithColumns
getColumnCount
in interface IlvTreeSetModel
public IlvDataColumnInfo getColumn(int columnIndex)
getColumn
in interface IlvModelWithColumns
getColumn
in interface IlvTreeSetModel
columnIndex
- The column.public int getSupportedEventsMask()
This implementation returns BEFORE_COLUMN_REMOVED_MASK
.
It ought to be overridden in subclasses.
getSupportedEventsMask
in interface IlvTreeSetModel
getSupportedEventsMask
in class IlvAbstractTreeSetModel
IlvTreeSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvTreeSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvTreeSetModel.BEFORE_COLUMN_REMOVED_MASK
public void fireModelEvent(TreeSetModelEvent event)
fireModelEvent
in class IlvAbstractTreeSetModel
public void setColumnCount(int columnCount)
columnCount
and greater are discarded.columnCount
- The new number of columns.public 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 columns 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
- A 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 IlvAbstractTreeSetModel
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.