public class IlvFlatListToFlatTableModel extends IlvDefaultFlatTableModel
IlvFlatTableModel
, based on an
IlvFlatListModel
.
The table columns are the attributes of the objects, plus a synthetic column called "object".
Note: This model supports adding and removing rows only if the
underlying IlvFlatListModel
is an instance of
IlvDefaultFlatListModel
. Adding rows furthermore
requires the use of a constructor taking an IlvObjectFactory
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_ROWS_REMOVED_MASK
Constructor and Description |
---|
IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model,
IlvObjectFactory creator)
Creates a model backed by a given
IlvFlatListModel , with the ability to add
rows, and with the same columns. |
IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model,
IlvObjectFactory creator,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
IlvFlatListModel , with the ability to add
rows, and with the given columns. |
IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model,
IlvObjectFactory creator,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatListModel , with the ability to add
rows, and with the given columns. |
IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model,
IlvObjectFactory creator,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatListModel , with the ability to add
rows, and with the same columns. |
IlvFlatListToFlatTableModel(IlvFlatListModel model)
Creates a model backed by a given
IlvFlatListModel , with the same
columns. |
IlvFlatListToFlatTableModel(IlvFlatListModel model,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
IlvFlatListModel , with the given columns. |
IlvFlatListToFlatTableModel(IlvFlatListModel model,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatListModel , with the given columns. |
IlvFlatListToFlatTableModel(IlvFlatListModel model,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatListModel , with the same
columns. |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a copy of this object.
|
protected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage |
createColumnStorage(IlvDataColumnInfo column)
Creates the backing storage for column values.
|
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.
|
double |
getDoubleAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex , as a numeric value. |
int |
getIndexOf(Object object)
Returns the index of a model object in
getUnderlyingModel().getObjects() . |
Object |
getObjectAt(int index)
Returns the object at a given index in
getUnderlyingModel().getObjects() . |
int |
getRowCount()
Returns the number of rows in the model.
|
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.
|
IlvFlatListModel |
getUnderlyingModel()
Returns the underlying model.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
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 |
insertRow(int rowIndex,
Object[] rowData)
Adds a row to the model at a given index.
|
void |
insertRows(int rowIndex,
int count)
Adds some rows to the model at a given index.
|
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAtInternal and setDoubleAtInternal have no effect on a given
column. |
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
void |
removeRows(int rowIndex,
int count)
Removes some rows 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.
|
protected boolean |
setDoubleAtInternal(double value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt() . |
void |
setRowCount(int rowCount)
Sets the number of rows in the model.
|
protected boolean |
setValueAtInternal(Object value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
addRow, addRow, insertRow, removeRow
addColumn, addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns, setDoubleAt, setValueAt
addFlatTableModelListener, convertToDouble, endBatch, removeFlatTableModelListener, startBatch
public IlvFlatListToFlatTableModel(IlvFlatListModel model)
IlvFlatListModel
, with the same
columns.
Note: No rows can be added when this constructor is used.
model
- The underlying model.public IlvFlatListToFlatTableModel(IlvFlatListModel model, int eventsMaskHint)
IlvFlatListModel
, with the same
columns.
Note: No rows can be added when this constructor is used.
model
- The underlying model.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model, IlvObjectFactory creator)
IlvFlatListModel
, with the ability to add
rows, and with the same columns.model
- The underlying model.creator
- Factory for new objects in the model.public IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model, IlvObjectFactory creator, int eventsMaskHint)
IlvFlatListModel
, with the ability to add
rows, and with the same columns.model
- The underlying model.creator
- Factory for new objects in the model.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public IlvFlatListToFlatTableModel(IlvFlatListModel model, IlvDataColumnInfo[] columns)
IlvFlatListModel
, with the given columns.
Note: No rows can be added when this constructor is used.
model
- The underlying model.columns
- The initial list of columns of this model.public IlvFlatListToFlatTableModel(IlvFlatListModel model, IlvDataColumnInfo[] columns, int eventsMaskHint)
IlvFlatListModel
, with the given columns.
Note: No rows can be added when this constructor is used.
model
- The underlying model.columns
- The initial list of columns of this model.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model, IlvObjectFactory creator, IlvDataColumnInfo[] columns)
IlvFlatListModel
, with the ability to add
rows, and with the given columns.model
- The underlying model.creator
- Factory for new objects in the model.columns
- The initial list of columns of this model.public IlvFlatListToFlatTableModel(IlvDefaultFlatListModel model, IlvObjectFactory creator, IlvDataColumnInfo[] columns, int eventsMaskHint)
IlvFlatListModel
, with the ability to add
rows, and with the given columns.model
- The underlying model.creator
- Factory for new objects in the model.columns
- The initial list of columns of this model.eventsMaskHint
- Desired events mask. This is just a hint; there is
no guarantee that the event types designated by the
mask are supported by this model.public int getRowCount()
Valid row indices range from 0 to getRowCount()-1
(inclusive).
getRowCount
in interface IlvFlatTableModel
getRowCount
in class IlvDefaultFlatTableModel
public Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.getValueAt
in interface IlvFlatTableModel
getValueAt
in class IlvDefaultFlatTableModel
public double getDoubleAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
, as a numeric value.
This method should only be used for columns whose type is
Double. For other types of columns, this method will do a conversion
from the object returned by getValueAt
, which may be
inefficient or inaccurate or raise exceptions.
getDoubleAt
in interface IlvFlatTableModel
getDoubleAt
in class IlvDefaultFlatTableModel
protected boolean setValueAtInternal(Object value, int rowIndex, 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 IlvDefaultFlatTableModel
protected boolean setDoubleAtInternal(double value, int rowIndex, 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 IlvDefaultFlatTableModel
protected boolean isColumnComputed(int columnIndex)
true
if setValueAtInternal
and setDoubleAtInternal
have no effect on a given
column.isColumnComputed
in class IlvBasicFlatTableModel
public int getSupportedEventsMask()
This implementation returns a mask that corresponds to the one of the underlying model, intersected with the eventsMaskHint constructor argument. It ought to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatTableModel
getSupportedEventsMask
in class IlvDefaultFlatTableModel
IlvFlatTableModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatTableModel.BEFORE_ROWS_REMOVED_MASK
,
IlvFlatTableModel.BEFORE_COLUMN_REMOVED_MASK
public void setRowCount(int rowCount)
rowCount
and greater are discarded.setRowCount
in class IlvDefaultFlatTableModel
rowCount
- The new number of rows.public void insertRows(int rowIndex, int count)
insertRows
in class IlvDefaultFlatTableModel
rowIndex
- The first new row desired index, must be >= 0 and
<= getRowCount()
.count
- The number of rows to be inserted.public void insertRow(int rowIndex, Object[] rowData)
insertRow
in class IlvDefaultFlatTableModel
rowIndex
- The new row desired index, must be >= 0 and
<= getRowCount()
.rowData
- The initial data of this row, must be an array of
getColumnCount()
elements.public void removeRows(int rowIndex, int count)
removeRows
in class IlvDefaultFlatTableModel
rowIndex
- The first old row index, must be >= 0 and
<= getRowCount()
- count.count
- The number of rows to be removed.protected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage createColumnStorage(IlvDataColumnInfo column)
IlvBasicFlatTableModel
null
if the methods
getValueAt
and getDoubleAt
do not need
backing store.createColumnStorage
in class IlvBasicFlatTableModel
public void setColumnCount(int columnCount)
IlvBasicFlatTableModel
columnCount
and greater are discarded.setColumnCount
in class IlvBasicFlatTableModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
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)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
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 getRowCount()
elements. Unused if
the column is a computed column.public void insertColumn(int columnIndex, IlvDataColumnInfo column, double[] data)
IlvBasicFlatTableModel
insertColumn
in class IlvBasicFlatTableModel
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 getRowCount()
elements. Unused if
the column is a computed column.public void removeColumn(int columnIndex)
IlvBasicFlatTableModel
removeColumn
in class IlvBasicFlatTableModel
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public void setColumns(List<IlvDataColumnInfo> columns)
IlvBasicFlatTableModel
setColumns
in class IlvBasicFlatTableModel
columns
- A list of IlvDataColumnInfo
.public void setColumn(int i, IlvDataColumnInfo column)
IlvBasicFlatTableModel
removeColumn(i)
followed by
insertColumn(i, column)
.setColumn
in class IlvBasicFlatTableModel
column
- An IlvDataColumnInfo
.public IlvFlatListModel getUnderlyingModel()
IlvFlatListModel
passed to the constructor.public Object getObjectAt(int index)
getUnderlyingModel().getObjects()
.IllegalArgumentException
- If the index is out of range.public int getIndexOf(Object object)
getUnderlyingModel().getObjects()
.IllegalArgumentException
- If the object is not contained in the
model.public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvBasicFlatTableModel
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 IlvBasicFlatTableModel
public Object clone()
clone
in class IlvDefaultFlatTableModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.