public abstract class IlvBasicFlatTableModel extends IlvAbstractFlatTableModel implements Cloneable
IlvFlatTableModel
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 values stored in the model or of their attributes.
In order to implement an IlvFlatTableModel where the
attribute values are stored locally in each object, it is sufficient to
create a subclass of IlvBasicFlatTableModel that defines
the methods IlvFlatTableModel.getRowCount(),
IlvFlatTableModel.getValueAt(int, int),
setValueAtInternal(java.lang.Object, int, int, boolean).
Defining the methods IlvFlatTableModel.getDoubleAt(int, int) and setDoubleAtInternal(double, int, int, boolean)
can save the allocation of a Double object at each
invocation. When the value of a table cell changes, the model should
construct an appropriate FlatTableModelEvent and call
IlvAbstractFlatTableModel.fireModelEvent(ilog.views.chart.datax.flat.table.event.FlatTableModelEvent).
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_ROWS_REMOVED_MASK| Constructor and Description |
|---|
IlvBasicFlatTableModel()
Creates an empty model with zero columns.
|
IlvBasicFlatTableModel(IlvDataColumnInfo[] columns)
Creates a model with the given columns.
|
IlvBasicFlatTableModel(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.
|
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.
|
void |
fireModelEvent(FlatTableModelEvent 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 setValueAtInternal and setDoubleAtInternal 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.
|
void |
setDoubleAt(double value,
int rowIndex,
int columnIndex)
Sets the value in the cell at
columnIndex and
rowIndex to the given value. |
protected abstract boolean |
setDoubleAtInternal(double value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt(). |
void |
setValueAt(Object value,
int rowIndex,
int columnIndex)
Sets the value in the cell at
columnIndex and
rowIndex to the given value. |
protected abstract boolean |
setValueAtInternal(Object value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt(). |
addFlatTableModelListener, convertToDouble, endBatch, removeFlatTableModelListener, startBatchequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDoubleAt, getRowCount, getValueAtpublic IlvBasicFlatTableModel()
public IlvBasicFlatTableModel(int numColumns)
public IlvBasicFlatTableModel(IlvDataColumnInfo[] columns)
public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount in interface IlvFlatTableModelgetColumnCount in interface IlvModelWithColumnspublic IlvDataColumnInfo getColumn(int columnIndex)
getColumn in interface IlvFlatTableModelgetColumn in interface IlvModelWithColumnscolumnIndex - The column.protected boolean isColumnComputed(int columnIndex)
true if setValueAtInternal and setDoubleAtInternal on a given
column have no effect.protected abstract 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, specifying whether the given value is
different from the previous one.
protected abstract 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, specifying whether the given value is
different from the previous one.
public void setValueAt(Object value, int rowIndex, int columnIndex)
columnIndex and
rowIndex to the given value.setValueAt in interface IlvFlatTableModelvalue - The new value.rowIndex - The row containing the cell whose value is to be changed.columnIndex - The column containing the cell whose value is to be
changed.public void setDoubleAt(double value,
int rowIndex,
int columnIndex)
columnIndex and
rowIndex to the given value.
This method should only be used for columns whose type is Double. For other types of columns, this method will do a conversion to the column type, which may be inefficient or inaccurate or raise exceptions.
setDoubleAt in interface IlvFlatTableModelvalue - The new value.rowIndex - The row containing the cell whose value is to be changed.columnIndex - The column containing the cell whose value is to be
changed.public int getSupportedEventsMask()
This implementation returns
BEFORE_DATA_CHANGE_MASK | BEFORE_COLUMN_REMOVED_MASK. It
ought to be overridden in subclasses.
getSupportedEventsMask in interface IlvFlatTableModelgetSupportedEventsMask in class IlvAbstractFlatTableModelIlvFlatTableModel.BEFORE_DATA_CHANGE_MASK,
IlvFlatTableModel.BEFORE_ROWS_REMOVED_MASK,
IlvFlatTableModel.BEFORE_COLUMN_REMOVED_MASKpublic void fireModelEvent(FlatTableModelEvent event)
fireModelEvent in class IlvAbstractFlatTableModelprotected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage createColumnStorage(IlvDataColumnInfo column)
null if the methods
getValueAt and getDoubleAt do not need
backing store.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 getRowCount() elements. Unused 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 getRowCount() elements. Unused 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 getRowCount() elements. Unused 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 getRowCount() elements. Unused 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 IlvAbstractFlatTableModel© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.