public class IlvDefaultFlatSetModel extends IlvBasicFlatSetModel implements Cloneable
IlvFlatSetModel
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 |
---|
IlvDefaultFlatSetModel()
Creates an empty model with no objects and zero columns.
|
IlvDefaultFlatSetModel(Collection objects,
IlvDataColumnInfo[] columns)
Creates a model with the given objects and the given columns.
|
IlvDefaultFlatSetModel(IlvDataColumnInfo[] columns)
Creates an empty model with no objects and the given columns.
|
IlvDefaultFlatSetModel(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 model.
|
void |
addObject(Object object,
Object[] data)
Adds an object to the model.
|
void |
addObjects(Object[] objects)
Adds some objects to the model.
|
void |
clear()
Removes all objects from the model.
|
Object |
clone()
Returns a copy of this object.
|
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. |
Collection |
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 |
removeObject(Object object)
Removes an object from the model.
|
void |
removeObjects(Object[] objects)
Removes some 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
addFlatSetModelListener, convertToDouble, endBatch, removeFlatSetModelListener, startBatch
public IlvDefaultFlatSetModel()
public IlvDefaultFlatSetModel(int numColumns)
public IlvDefaultFlatSetModel(IlvDataColumnInfo[] columns)
public IlvDefaultFlatSetModel(Collection objects, IlvDataColumnInfo[] columns)
public Collection getObjects()
getObjects
in interface IlvFlatSetModel
public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.getValueAt
in interface IlvFlatSetModel
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 IlvFlatSetModel
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.
public void setValueAt(Object value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.setValueAt
in interface IlvFlatSetModel
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 IlvFlatSetModel
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 IlvFlatSetModel
getSupportedEventsMask
in class IlvBasicFlatSetModel
IlvFlatSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvFlatSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvFlatSetModel.BEFORE_COLUMN_REMOVED_MASK
public void setObjects(Collection objects)
public void addObject(Object object)
public void addObjects(Object[] objects)
public void addObject(Object object, Object[] data)
data
- The initial data of this object, must be an array of
getColumnCount()
elements.public void removeObject(Object object)
public void removeObjects(Object[] objects)
public void clear()
public void dispose()
Note: after calling this function, this model is no longer functional.
dispose
in class IlvBasicFlatSetModel
public Object clone()
clone
in class IlvBasicFlatSetModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.