public class IlvDefaultFlatListModel extends IlvBasicFlatListModel implements Cloneable
IlvFlatListModel
interface.
It stores the objects, the data values and the column info objects locally in this instance.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvDefaultFlatListModel()
Creates an empty model with no objects and zero columns.
|
IlvDefaultFlatListModel(Collection objects,
IlvDataColumnInfo[] columns)
Creates a model with the given objects and the given columns.
|
IlvDefaultFlatListModel(IlvDataColumnInfo[] columns)
Creates an empty model with no objects and the given columns.
|
IlvDefaultFlatListModel(int numColumns)
Creates an empty model with no objects and the given number of columns.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object object)
Adds an object to the end of the model.
|
void |
addObject(Object object,
Object[] data)
Adds an object to the end of the model.
|
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 |
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. |
int |
getIndexOf(Object object)
Returns the index of a model object in
getObjects() . |
Object |
getObjectAt(int index)
Returns the object at a given index in
getObjects() . |
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.
|
Object |
getValueAt(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
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.
|
protected void |
internalObjectsAdd(int index,
Object object)
Adds an object to the list of objects internally stored in this model.
|
protected void |
internalObjectsRemove(int index)
Removes an object from the list of objects internally stored in this model.
|
protected void |
internalObjectsSet(int index,
Object object)
Replaces an object in the list of objects internally stored in this model.
|
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAt and setDoubleAt on a given column have no
effect. |
void |
removeObject(Object object)
Removes an object from the model.
|
void |
removeObjects(Object[] objects,
int firstIndex)
Removes some consecutive objects from the model.
|
void |
setDoubleAt(double value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
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.
|
void |
setValueAt(Object value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
protected boolean |
setValueAtInternal(Object value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
addColumn, addColumn, addColumn, disconnect, fireModelEvent, getColumn, getColumnCount, getColumns, insertColumn, insertColumn, insertColumn, removeColumn, setColumn, setColumnCount, setColumns
addFlatListModelListener, convertToDouble, endBatch, removeFlatListModelListener, startBatch
public IlvDefaultFlatListModel()
public IlvDefaultFlatListModel(int numColumns)
public IlvDefaultFlatListModel(IlvDataColumnInfo[] columns)
public IlvDefaultFlatListModel(Collection objects, IlvDataColumnInfo[] columns)
public List getObjects()
getObjects
in interface IlvFlatListModel
protected void internalObjectsAdd(int index, Object object)
protected void internalObjectsRemove(int index)
protected void internalObjectsSet(int index, Object object)
public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.getValueAt
in interface IlvFlatListModel
getValueAt
in interface IlvObjectModelWithColumns
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.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
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.
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.
protected boolean isColumnComputed(int columnIndex)
true
if setValueAt
and setDoubleAt
on a given column have no
effect.isColumnComputed
in class IlvBasicFlatListModel
public void setValueAt(Object value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.setValueAt
in interface IlvFlatListModel
setValueAt
in interface IlvObjectModelWithColumns
value
- The new value.object
- The object (row) in which the value is to be changed.columnIndex
- The column denoting the attribute whose value is to be
changed.public void setDoubleAt(double value, Object object, int columnIndex)
columnIndex
in the given object 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 IlvFlatListModel
setDoubleAt
in interface IlvObjectModelWithColumns
value
- The new value.object
- The object (row) in which the value is to be changed.columnIndex
- The column denoting the attribute whose value is to be
changed.public int getSupportedEventsMask()
This implementation returns
BEFORE_DATA_CHANGE_MASK | BEFORE_OBJECTS_REMOVED_MASK | BEFORE_COLUMN_REMOVED_MASK
.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvFlatListModel
getSupportedEventsMask
in class IlvBasicFlatListModel
IlvFlatListModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatListModel.BEFORE_COLUMN_REMOVED_MASK
public Object getObjectAt(int index)
getObjects()
.IllegalArgumentException
- If the index is out of range.public int getIndexOf(Object object)
getObjects()
.IllegalArgumentException
- If the object is not contained in the
model.public void setObjects(Collection objects)
public void addObject(Object object)
public void addObject(Object object, Object[] data)
data
- The initial data of this object. It must be an array of
getColumnCount()
elements.public void insertObject(Object object, int index)
index
- The object desired index. It must be >= 0 and
<= getObjects().size()
.public void insertObjects(Object[] objects, int index)
index
- The first index of the new object. It must be >= 0 and
<= getObjects().size()
.public void insertObject(Object object, Object[] data, int index)
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)
public void removeObjects(Object[] objects, int firstIndex)
objects
- The objects that were at indices firstIndex, ...,
firstIndex+objects.length-1 of
getObjects().iterator()
.public void clear()
protected 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 dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvBasicFlatListModel
public Object clone()
clone
in class IlvBasicFlatListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.