public class IlvFlatListToTreeListModel extends IlvAbstractTreeListModel
IlvTreeListModel
, based on an
IlvFlatListModel
and an IlvPartitionerFactory
that
is used to give a tree structure to the list of objects. The order of
leaf objects in the tree reflects the order in the list; the order of
clusters (non-leaf objects) in the tree is given by a comparator.BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitioner<CIT>[] partitioners,
Comparator<? super CIT> idComparator,
int nonClusterPosition)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a list of partitioners. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitioner<CIT>[] partitioners,
Comparator<? super CIT> idComparator,
int nonClusterPosition,
int eventsMaskHint)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a list of partitioners. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitioner<CIT> partitioner,
Comparator<? super CIT> idComparator,
int nonClusterPosition)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a partitioner. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitioner<CIT> partitioner,
Comparator<? super CIT> idComparator,
int nonClusterPosition,
int eventsMaskHint)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a partitioner. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitionerFactory<CIT>[] partitionerFactories,
Comparator<? super CIT> idComparator,
int nonClusterPosition)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a list of partitioner factories. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitionerFactory<CIT>[] partitionerFactories,
Comparator<? super CIT> idComparator,
int nonClusterPosition,
int eventsMaskHint)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a list of partitioner factories. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitionerFactory<CIT> partitionerFactory,
Comparator<? super CIT> idComparator,
int nonClusterPosition)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a partitioner factory. |
IlvFlatListToTreeListModel(IlvFlatListModel model,
IlvPartitionerFactory<CIT> partitionerFactory,
Comparator<? super CIT> idComparator,
int nonClusterPosition,
int eventsMaskHint)
Creates an
IlvTreeListModel from an
IlvFlatListModel and a partitioner factory. |
Modifier and Type | Method and Description |
---|---|
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.
|
List |
getChildren(Object parent)
Returns the children objects of a given object in this model.
|
IlvDataColumnInfo |
getColumn(int columnIndex)
Returns metainformation about a column.
|
int |
getColumnCount()
Returns the number of columns in the 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 |
setDoubleAt(double value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
void |
setValueAt(Object value,
Object object,
int columnIndex)
Sets the value for the attribute number
columnIndex
in the given object to the given value . |
addTreeListModelListener, clone, convertToDouble, endBatch, fireModelEvent, postOrderIterator, preOrderIterator, removeTreeListModelListener, startBatch
public IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitioner<CIT>[] partitioners, Comparator<? super CIT> idComparator, int nonClusterPosition)
IlvTreeListModel
from an
IlvFlatListModel
and a list of partitioners.
Note: It is not useful to pass the same partitioner more than once. Instead, use different partitioners or a recursive partitioner.
model
- The underlying model.partitioners
- The partitioning criteria.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.public IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitioner<CIT>[] partitioners, Comparator<? super CIT> idComparator, int nonClusterPosition, int eventsMaskHint)
IlvTreeListModel
from an
IlvFlatListModel
and a list of partitioners.
Note: It is not useful to pass the same partitioner more than once. Instead, use different partitioners or a recursive partitioner.
model
- The underlying model.partitioners
- The partitioning criteria.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.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 IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitionerFactory<CIT>[] partitionerFactories, Comparator<? super CIT> idComparator, int nonClusterPosition)
IlvTreeListModel
from an
IlvFlatListModel
and a list of partitioner factories.
Note: It is not useful to pass the same partitioner factory more than once. Instead, use different partitioner factories or factory for a recursive partitioner.
model
- The underlying model.partitionerFactories
- The partitioning criteria.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.public IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitionerFactory<CIT>[] partitionerFactories, Comparator<? super CIT> idComparator, int nonClusterPosition, int eventsMaskHint)
IlvTreeListModel
from an
IlvFlatListModel
and a list of partitioner factories.
Note: It is not useful to pass the same partitioner factory more than once. Instead, use different partitioner factories or factory for a recursive partitioner.
model
- The underlying model.partitionerFactories
- The partitioning criteria.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.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 IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitioner<CIT> partitioner, Comparator<? super CIT> idComparator, int nonClusterPosition)
IlvTreeListModel
from an
IlvFlatListModel
and a partitioner.model
- The underlying model.partitioner
- The partitioning criterion.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.public IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitioner<CIT> partitioner, Comparator<? super CIT> idComparator, int nonClusterPosition, int eventsMaskHint)
IlvTreeListModel
from an
IlvFlatListModel
and a partitioner.model
- The underlying model.partitioner
- The partitioning criterion.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.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 IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitionerFactory<CIT> partitionerFactory, Comparator<? super CIT> idComparator, int nonClusterPosition)
IlvTreeListModel
from an
IlvFlatListModel
and a partitioner factory.model
- The underlying model.partitionerFactory
- The partitioning criterion.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.public IlvFlatListToTreeListModel(IlvFlatListModel model, IlvPartitionerFactory<CIT> partitionerFactory, Comparator<? super CIT> idComparator, int nonClusterPosition, int eventsMaskHint)
IlvTreeListModel
from an
IlvFlatListModel
and a partitioner factory.model
- The underlying model.partitionerFactory
- The partitioning criterion.idComparator
- The comparator that is used to compare cluster ids, or
null
denoting a default comparator.
See IlvDefaultClusterIdComparator
.nonClusterPosition
- Determines how non-clusters are sorted: -1 means
they precede all clusters, 1 means they come at the
end, 0 means no preference.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 Object getRoot()
null
if the model
is empty.public List getChildren(Object parent)
public TreePath getPath(Object object)
getPath
in interface IlvTreeListModel
getPath
in class IlvAbstractTreeListModel
object
- An object in the model.TreePath
whose first component is
getRoot()
and whose last component is the given
object.public int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
public IlvDataColumnInfo getColumn(int columnIndex)
columnIndex
- The column.public Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.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.
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 void setValueAt(Object value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.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.
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 a mask that corresponds to the one of the
underlying model, combined with DURING_OBJECTS_REMOVED_MASK
,
intersected with the eventsMaskHint constructor argument.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvTreeListModel
getSupportedEventsMask
in class IlvAbstractTreeListModel
IlvTreeListModel.BEFORE_DATA_CHANGE_MASK
,
IlvTreeListModel.BEFORE_OBJECTS_REMOVED_MASK
,
IlvTreeListModel.BEFORE_COLUMN_REMOVED_MASK
public Object getParent(Object object)
null
if
it is the root.public void dispose()
Note: After calling this function, this model is no longer functional.
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying model or to the partitioners, this model is no longer functional.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.