public class IlvFlatTableToFlatListModel extends IlvDefaultFlatListModel
IlvFlatListModel
, based on an
IlvFlatTableModel
. Every row in the
IlvFlatTableModel
becomes an element in the
IlvFlatListModel
.
Note: This model supports adding and removing objects if and only if the
underlying IlvFlatTableModel
is an instance of
IlvDefaultFlatTableModel
.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvFlatTableToFlatListModel(IlvFlatTableModel model)
Creates a model backed by a given
IlvFlatTableModel , with the same
columns. |
IlvFlatTableToFlatListModel(IlvFlatTableModel model,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
IlvFlatTableModel , with the given columns. |
IlvFlatTableToFlatListModel(IlvFlatTableModel model,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatTableModel , with the given columns. |
IlvFlatTableToFlatListModel(IlvFlatTableModel model,
int eventsMaskHint)
Creates a model backed by a given
IlvFlatTableModel , with the same
columns. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all the objects from 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 a column value.
|
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(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
List |
getObjects()
Returns the objects in this 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.
|
IlvFlatTableModel |
getUnderlyingModel()
Returns the underlying model.
|
Object |
getValueAt(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
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 |
insertObject(Object object,
int index)
Adds an object to the model at a given index.
|
void |
insertObject(Object object,
Object[] data,
int index)
Adds an object to the model at a given index.
|
void |
insertObjects(Object[] objects,
int index)
Adds some objects to the model at a given index.
|
void |
removeColumn(int columnIndex)
Removes a column from the model.
|
void |
removeObject(Object object)
Removes an object from the model.
|
void |
removeObjects(Object[] objects,
int firstIndex)
Removes some consecutive objects 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,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt() . |
void |
setObjects(Collection objects)
Replaces the set of objects in the model.
|
protected boolean |
setValueAtInternal(Object value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
addObject, addObject, getIndexOf, getObjectAt, internalObjectsAdd, internalObjectsRemove, internalObjectsSet, isColumnComputed, setDoubleAt, setValueAt
addColumn, addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns
addFlatListModelListener, convertToDouble, endBatch, removeFlatListModelListener, startBatch
public IlvFlatTableToFlatListModel(IlvFlatTableModel model)
IlvFlatTableModel
, with the same
columns.
Note: No rows can be added when this constructor is used.
model
- The underlying model.public IlvFlatTableToFlatListModel(IlvFlatTableModel model, int eventsMaskHint)
IlvFlatTableModel
, 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 IlvFlatTableToFlatListModel(IlvFlatTableModel model, IlvDataColumnInfo[] columns)
IlvFlatTableModel
, 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 IlvFlatTableToFlatListModel(IlvFlatTableModel model, IlvDataColumnInfo[] columns, int eventsMaskHint)
IlvFlatTableModel
, 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 List getObjects()
getObjects
in interface IlvFlatListModel
getObjects
in class IlvDefaultFlatListModel
public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.getValueAt
in interface IlvFlatListModel
getValueAt
in interface IlvObjectModelWithColumns
getValueAt
in class IlvDefaultFlatListModel
object
- The object (row) in which the value is to be looked up.columnIndex
- The column denoting the attribute whose value is to be
looked up.protected boolean setValueAtInternal(Object value, Object object, 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.
setValueAtInternal
in class IlvDefaultFlatListModel
public double getDoubleAt(Object object, int columnIndex)
columnIndex
in the given object.
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 IlvFlatListModel
getDoubleAt
in interface IlvObjectModelWithColumns
getDoubleAt
in class IlvDefaultFlatListModel
object
- The object (row) in which the value is to be looked up.columnIndex
- The column denoting the attribute whose value is to be
looked up.protected boolean setDoubleAtInternal(double value, Object object, 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.
setDoubleAtInternal
in class IlvDefaultFlatListModel
public int getSupportedEventsMask()
This implementation returns
BEFORE_OBJECTS_REMOVED_MASK | BEFORE_COLUMN_REMOVED_MASK
,
intersected with the eventsMaskHint constructor argument.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatListModel
getSupportedEventsMask
in class IlvDefaultFlatListModel
IlvFlatListModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatListModel.BEFORE_COLUMN_REMOVED_MASK
public void setObjects(Collection objects)
UnsupportedOperationException
.setObjects
in class IlvDefaultFlatListModel
public void insertObject(Object object, int index)
insertObject
in class IlvDefaultFlatListModel
index
- The object desired index. It must be >= 0 and
<= getObjects().size()
.public void insertObjects(Object[] objects, int index)
insertObjects
in class IlvDefaultFlatListModel
index
- The first index of the new object. It must be >= 0 and
<= getObjects().size()
.public void insertObject(Object object, Object[] data, int index)
insertObject
in class IlvDefaultFlatListModel
data
- The initial data of this object. It must be an array of
getColumnCount()
elements.index
- The index of the new object. It must be >= 0 and
<= getObjects().size()
.public void removeObject(Object object)
removeObject
in class IlvDefaultFlatListModel
public void removeObjects(Object[] objects, int firstIndex)
removeObjects
in class IlvDefaultFlatListModel
objects
- The objects that were at indices firstIndex, ...,
firstIndex+objects.length-1 of
getObjects().iterator()
.public void clear()
clear
in class IlvDefaultFlatListModel
protected ilog.views.chart.datax.flat.internal.storage.IlvColumnStorage createColumnStorage(IlvDataColumnInfo column)
IlvDefaultFlatListModel
null
if the methods
getValueAt
and getDoubleAt
do not need
backing store.createColumnStorage
in class IlvDefaultFlatListModel
public void setColumnCount(int columnCount)
IlvBasicFlatListModel
columnCount
and greater are discarded.setColumnCount
in class IlvBasicFlatListModel
columnCount
- The new number of columns.public void insertColumn(int columnIndex, IlvDataColumnInfo column)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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)
IlvBasicFlatListModel
insertColumn
in class IlvBasicFlatListModel
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)
IlvBasicFlatListModel
removeColumn
in class IlvBasicFlatListModel
columnIndex
- The column index, must be >= 0 and
< getColumnCount()
.public void setColumns(List<IlvDataColumnInfo> columns)
IlvBasicFlatListModel
setColumns
in class IlvBasicFlatListModel
columns
- A list of IlvDataColumnInfo
.public void setColumn(int i, IlvDataColumnInfo column)
IlvBasicFlatListModel
removeColumn(i)
followed by
insertColumn(i, column)
.setColumn
in class IlvBasicFlatListModel
column
- An IlvDataColumnInfo
.public IlvFlatTableModel getUnderlyingModel()
IlvFlatTableModel
passed to the constructor.public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvDefaultFlatListModel
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying model, this model is no longer functional.
disconnect
in class IlvBasicFlatListModel
public Object clone()
clone
in class IlvDefaultFlatListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.