public class IlvDefaultTreeSetModel extends IlvBasicTreeSetModel implements Cloneable
IlvTreeSetModel
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, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvDefaultTreeSetModel()
Creates an empty model with no objects and zero columns.
|
IlvDefaultTreeSetModel(IlvDataColumnInfo[] columns)
Creates an empty model with no objects and the given columns.
|
IlvDefaultTreeSetModel(int numColumns)
Creates an empty model with no objects and the given number of columns.
|
IlvDefaultTreeSetModel(Object root,
Collection objects,
IlvDataColumnInfo[] columns)
Creates a model with the given root, the given first-level objects and
the given columns.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(Object object,
Object parent)
Adds an object to the list of children of a parent object in the model.
|
void |
addChildren(Object[] objects,
Object parent)
Adds some objects to the list of children of a parent object in the model
at a given index.
|
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.
|
Collection |
getChildren(Object parent)
Returns the set of children objects of a given object in this model.
|
double |
getDoubleAt(Object object,
int columnIndex)
Returns the value for the attribute number
columnIndex
in the given object. |
Object |
getParent(Object object)
Returns the parent object of a given object, or
null if
it is the root. |
TreePath |
getPath(Object object)
Returns the path from the root to the given object.
|
Object |
getRoot()
Returns the root object in this model, or
null if the model
is empty. |
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 |
removeAllChildren(Object parent)
Removes all children objects of a parent object in the model.
|
void |
removeChild(Object object,
Object parent)
Removes an object from the list of children of a parent object in the
model.
|
void |
removeChildren(Object[] objects,
Object parent)
Removes some children of a common parent object, and their subtrees,
from the model.
|
void |
setChildren(Object parent,
Collection newChildren)
Replaces the set of children of a given object in 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 |
setRoot(Object object)
Changes the root object of 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, disconnect, fireModelEvent, getColumn, getColumnCount, getColumns, insertColumn, insertColumn, removeColumn, setColumn, setColumnCount, setColumns
addTreeSetModelListener, convertToDouble, endBatch, postOrderIterator, preOrderIterator, removeTreeSetModelListener, startBatch
public IlvDefaultTreeSetModel()
public IlvDefaultTreeSetModel(int numColumns)
public IlvDefaultTreeSetModel(IlvDataColumnInfo[] columns)
public IlvDefaultTreeSetModel(Object root, Collection objects, IlvDataColumnInfo[] columns)
public Object getRoot()
null
if the model
is empty.getRoot
in interface IlvTreeSetModel
public Collection getChildren(Object parent)
getChildren
in interface IlvTreeSetModel
public TreePath getPath(Object object)
getPath
in interface IlvTreeSetModel
getPath
in class IlvAbstractTreeSetModel
object
- An object in the model.TreePath
whose first component is
getRoot()
and whose last component is the given
object.public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.getValueAt
in interface IlvObjectModelWithColumns
getValueAt
in interface IlvTreeSetModel
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 IlvObjectModelWithColumns
getDoubleAt
in interface IlvTreeSetModel
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 IlvObjectModelWithColumns
setValueAt
in interface IlvTreeSetModel
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 IlvObjectModelWithColumns
setDoubleAt
in interface IlvTreeSetModel
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 IlvTreeSetModel
getSupportedEventsMask
in class IlvBasicTreeSetModel
IlvTreeSetModel.BEFORE_DATA_CHANGE_MASK
,
IlvTreeSetModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvTreeSetModel.BEFORE_COLUMN_REMOVED_MASK
public Object getParent(Object object)
null
if
it is the root.public void setRoot(Object object)
setChildren()
method.
Note: All attribute values are lost.object
- The new root, or null
.public void setChildren(Object parent, Collection newChildren)
setChildren()
method.
Note: All attribute values of children, grand-children and so on are lost.public void addChild(Object object, Object parent)
public void addChildren(Object[] objects, Object parent)
public void removeChild(Object object, Object parent)
public void removeChildren(Object[] objects, Object parent)
objects
- Some objects that were in getChildren(parent)
.public void removeAllChildren(Object parent)
public void clear()
public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvBasicTreeSetModel
public Object clone()
clone
in class IlvBasicTreeSetModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.