public abstract class IlvBasicFlatSetModel extends IlvAbstractFlatSetModel implements Cloneable
IlvFlatSetModel
interface which handles the notification to the 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 IlvFlatSetModel
where the
attribute values are stored locally in each object, it is sufficient to
create a subclass of IlvBasicFlatSetModel
that defines
the methods IlvFlatSetModel.getObjects()
,
IlvFlatSetModel.getValueAt(java.lang.Object, int)
,
IlvFlatSetModel.setValueAt(java.lang.Object, java.lang.Object, int)
.
Defining the methods IlvFlatSetModel.getDoubleAt(java.lang.Object, int)
,
IlvFlatSetModel.setDoubleAt(double, java.lang.Object, int)
should also be considered
because this 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
FlatSetModelEvent
and call
IlvAbstractFlatSetModel.fireModelEvent(ilog.views.chart.datax.flat.set.event.FlatSetModelEvent)
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvBasicFlatSetModel()
Creates a model with zero columns.
|
IlvBasicFlatSetModel(IlvDataColumnInfo[] columns)
Creates a model with the given columns.
|
IlvBasicFlatSetModel(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(FlatSetModelEvent 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.
|
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.
|
addFlatSetModelListener, convertToDouble, endBatch, removeFlatSetModelListener, startBatch
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDoubleAt, getObjects, getValueAt, setDoubleAt, setValueAt
public IlvBasicFlatSetModel()
public IlvBasicFlatSetModel(int numColumns)
public IlvBasicFlatSetModel(IlvDataColumnInfo[] columns)
public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount
in interface IlvFlatSetModel
getColumnCount
in interface IlvModelWithColumns
public IlvDataColumnInfo getColumn(int columnIndex)
getColumn
in interface IlvFlatSetModel
getColumn
in interface IlvModelWithColumns
columnIndex
- The column.public int getSupportedEventsMask()
This implementation returns BEFORE_COLUMN_REMOVED_MASK
.
It ought to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatSetModel
getSupportedEventsMask
in class IlvAbstractFlatSetModel
IlvFlatSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatSetModel.BEFORE_COLUMN_REMOVED_MASK
public void fireModelEvent(FlatSetModelEvent event)
fireModelEvent
in class IlvAbstractFlatSetModel
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 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)
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)
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)
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)
columnIndex
- The column index. It 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 IlvAbstractFlatSetModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.