public abstract class IlvBasicFlatListModel extends IlvAbstractFlatListModel implements Cloneable
IlvFlatListModel
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 IlvFlatListModel
where the
attribute values are stored locally in each object, it is sufficient to
create a subclass of IlvBasicFlatListModel
that defines
the methods IlvFlatListModel.getObjects()
,
IlvFlatListModel.getValueAt(java.lang.Object, int)
,
IlvFlatListModel.setValueAt(java.lang.Object, java.lang.Object, int)
.
Defining the methods IlvFlatListModel.getDoubleAt(java.lang.Object, int)
,
IlvFlatListModel.setDoubleAt(double, java.lang.Object, int)
should also be considered
because 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
FlatListModelEvent
and call
IlvAbstractFlatListModel.fireModelEvent(ilog.views.chart.datax.flat.list.event.FlatListModelEvent)
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBasicFlatListModel()
Creates a model with zero columns.
|
IlvBasicFlatListModel(IlvDataColumnInfo[] columns)
Creates a model with the given columns.
|
IlvBasicFlatListModel(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,
double[] data)
Adds a column with given data to the model.
|
void |
addColumn(IlvDataColumnInfo column,
Object[] 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(FlatListModelEvent 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,
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.
|
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.
|
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.
|
addFlatListModelListener, convertToDouble, endBatch, removeFlatListModelListener, startBatch
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDoubleAt, getObjects, getValueAt, setDoubleAt, setValueAt
public IlvBasicFlatListModel()
public IlvBasicFlatListModel(int numColumns)
public IlvBasicFlatListModel(IlvDataColumnInfo[] columns)
public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount
in interface IlvFlatListModel
getColumnCount
in interface IlvModelWithColumns
public IlvDataColumnInfo getColumn(int columnIndex)
getColumn
in interface IlvFlatListModel
getColumn
in interface IlvModelWithColumns
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 IlvFlatListModel
getSupportedEventsMask
in class IlvAbstractFlatListModel
IlvFlatListModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatListModel.BEFORE_COLUMN_REMOVED_MASK
public void fireModelEvent(FlatListModelEvent event)
fireModelEvent
in class IlvAbstractFlatListModel
public void setColumnCount(int columnCount)
columnCount
and greater are discarded.columnCount
- The new number of columns.public void addColumn(IlvDataColumnInfo column)
column
- The metainformation of this column.public void addColumn(IlvDataColumnInfo column, Object[] data)
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 addColumn(IlvDataColumnInfo column, double[] data)
column
- The meta information 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)
columnIndex
- The new column desired index, must be >= 0 and
<= getColumnCount()
column
- The metainformation of this column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, Object[] data)
columnIndex
- The new column desired index, 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)
columnIndex
- the new column desired index, 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)
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public List<IlvDataColumnInfo> getColumns()
IlvDataColumnInfo
.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 IlvAbstractFlatListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.