public class IlvDataSourceToFlatTableModel extends IlvBasicFlatTableModel
IlvFlatTableModel
, based on an
IlvDataSource
. The x and y values (and optionally the labels)
of each data set become columns of this table. The number of rows is the
maximum number of data points across all data sets in the data source.
Note: This model does not support adding and removing rows or columns.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_ROWS_REMOVED_MASK
Constructor and Description |
---|
IlvDataSourceToFlatTableModel(IlvDataSource dataSource)
Creates a model backed by a given
IlvDataSource . |
IlvDataSourceToFlatTableModel(IlvDataSource dataSource,
boolean includingLabels)
Creates a model backed by a given
IlvDataSource . |
Modifier and Type | Method and Description |
---|---|
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.
|
double |
getDoubleAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex , as a numeric value. |
int |
getRowCount()
Returns the number of rows in the model.
|
int |
getSupportedEventsMask()
Returns a bit mask denoting the optional kind of events that is guaranteed
to be sent by this model to the registered listeners.
|
IlvDataSource |
getUnderlyingDataSource()
Returns the underlying data source.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at
columnIndex and
rowIndex . |
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column)
This method throws an
UnsupportedOperationException . |
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
double[] data)
This method throws an
UnsupportedOperationException . |
void |
insertColumn(int columnIndex,
IlvDataColumnInfo column,
Object[] data)
This method throws an
UnsupportedOperationException . |
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAtInternal and setDoubleAtInternal on a given
column have no effect. |
boolean |
isIncludingLabels()
Returns
true if the labels are included as table columns. |
void |
removeColumn(int columnIndex)
This method throws an
UnsupportedOperationException . |
void |
setColumnCount(int columnCount)
This method throws an
UnsupportedOperationException . |
void |
setDoubleAt(double value,
int rowIndex,
int columnIndex)
Sets the value in the cell at
columnIndex and
rowIndex to the given value . |
protected 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 boolean |
setValueAtInternal(Object value,
int rowIndex,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
addColumn, addColumn, addColumn, createColumnStorage, fireModelEvent, getColumn, getColumnCount, getColumns, setColumn, setColumns
addFlatTableModelListener, convertToDouble, endBatch, removeFlatTableModelListener, startBatch
public IlvDataSourceToFlatTableModel(IlvDataSource dataSource)
IlvDataSource
.
It has columns containing the x and y values of each data set.public IlvDataSourceToFlatTableModel(IlvDataSource dataSource, boolean includingLabels)
IlvDataSource
.
It has columns containing the x and y values and, if
includingLabels
is true, for the labels
of each data set.includingLabels
- whether to include columns for the labelspublic int getRowCount()
Valid row indices range from 0 to getRowCount()-1
(inclusive).
public Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.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.
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, telling whether the given value is
different from the previous one.
setValueAtInternal
in class IlvBasicFlatTableModel
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, telling whether the given value is
different from the previous one.
setDoubleAtInternal
in class IlvBasicFlatTableModel
protected boolean isColumnComputed(int columnIndex)
true
if setValueAtInternal
and setDoubleAtInternal
on a given
column have no effect.isColumnComputed
in class IlvBasicFlatTableModel
public void setValueAt(Object value, int rowIndex, int columnIndex)
columnIndex
and
rowIndex
to the given value
.setValueAt
in interface IlvFlatTableModel
setValueAt
in class IlvBasicFlatTableModel
value
- 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 IlvFlatTableModel
setDoubleAt
in class IlvBasicFlatTableModel
value
- 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 0
.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatTableModel
getSupportedEventsMask
in class IlvBasicFlatTableModel
IlvFlatTableModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatTableModel.BEFORE_ROWS_REMOVED_MASK
,
IlvFlatTableModel.BEFORE_COLUMN_REMOVED_MASK
public void setColumnCount(int columnCount)
UnsupportedOperationException
.setColumnCount
in class IlvBasicFlatTableModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
UnsupportedOperationException
.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)
UnsupportedOperationException
.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)
UnsupportedOperationException
.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)
UnsupportedOperationException
.removeColumn
in class IlvBasicFlatTableModel
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public IlvDataSource getUnderlyingDataSource()
public boolean isIncludingLabels()
true
if the labels are included as table columns.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 data source or columns, this model is no longer functional.
disconnect
in class IlvBasicFlatTableModel
public Object clone()
clone
in class IlvBasicFlatTableModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.