public class IlvFilterTreeListModel extends IlvAbstractTreeListModel
All the methods on this model are implemented by an indirection to the underlying model. Subclasses will override some of these methods to actually implement filtering or other additional functionalities.
An instance of this class automatically propagates notification events from the underlying model to its own listeners.
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvFilterTreeListModel()
Creates a filter model without any underlying model.
|
IlvFilterTreeListModel(IlvTreeListModel model)
Creates a filter model.
|
IlvFilterTreeListModel(int eventsMask)
Creates a filter model without any underlying model.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a copy of this object.
|
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.
|
void |
fireBeforeColumnRemoved(int column,
IlvDataColumnInfo columnInfo)
Fires a
BEFORE_COLUMN_REMOVED event. |
void |
fireBeforeDataChange(Object object,
TreePath objectPath,
boolean recursive,
int column)
Fires a
BEFORE_DATA_CHANGE event. |
void |
fireBeforeObjectsRemoved(Object parent,
TreePath parentPath,
Object[] oldObjects,
int firstIndex)
Fires a
BEFORE_OBJECTS_REMOVED event. |
void |
fireColumnAdded(int column,
IlvDataColumnInfo columnInfo)
Fires a
COLUMN_ADDED event. |
void |
fireColumnPropertyChanged(TreeListModelEvent.Type type,
int column,
Object oldValue,
Object newValue)
Fires an
EMPTY_VALUE_CHANGED or
ENUMERATED_CHANGED or ENUM_VALUES_CHANGED or
MIN_VALUE_CHANGED or MAX_VALUE_CHANGED event. |
void |
fireColumnRemoved(int column,
IlvDataColumnInfo columnInfo)
Fires a
COLUMN_REMOVED event. |
void |
fireDataChanged(Object object,
TreePath objectPath,
boolean recursive,
int column)
Fires a
DATA_CHANGED event. |
void |
fireDuringObjectsRemoved(Object parent,
TreePath parentPath,
Object[] oldObjects,
int firstIndex)
Fires a
DURING_OBJECTS_REMOVED event. |
void |
fireObjectsChanged(Object parent,
TreePath parentPath,
Object[] oldObjects,
Object[] newObjects,
int firstIndex)
Fires an
OBJECTS_CHANGED event. |
List |
getChildren(Object parent)
This method is implemented through a call to the underlying model.
|
IlvDataColumnInfo |
getColumn(int columnIndex)
This method is implemented through a call to the underlying model.
|
int |
getColumnCount()
This method is implemented through a call to the underlying model.
|
double |
getDoubleAt(Object object,
int columnIndex)
This method is implemented through a call to the underlying model.
|
IlvTreeListModel |
getFilteredModel()
Returns the underlying model.
|
TreePath |
getPath(Object object)
This method is implemented through a call to the underlying model.
|
Object |
getRoot()
This method is implemented through a call to the underlying 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)
This method is implemented through a call to the underlying model.
|
void |
noteBeforeColumnRemoved(int column,
IlvDataColumnInfo columnInfo)
Reacts on a
BEFORE_COLUMN_REMOVED event from the underlying model. |
void |
noteBeforeDataChange(Object object,
TreePath objectPath,
boolean recursive,
int column)
Reacts on a
BEFORE_DATA_CHANGE event from the underlying model. |
void |
noteBeforeObjectsRemoved(Object parent,
TreePath parentPath,
Object[] oldObjects,
int firstIndex)
Reacts on a
BEFORE_OBJECTS_REMOVED event from the underlying model. |
void |
noteColumnAdded(int column,
IlvDataColumnInfo columnInfo)
Reacts on a
COLUMN_ADDED event from the underlying model. |
void |
noteColumnPropertyChanged(TreeListModelEvent.Type type,
int column,
Object oldValue,
Object newValue)
Reacts on a
EMPTY_VALUE_CHANGED or
ENUMERATED_CHANGED or ENUM_VALUES_CHANGED or
MIN_VALUE_CHANGED or MAX_VALUE_CHANGED event
from the underlying model. |
void |
noteColumnRemoved(int column,
IlvDataColumnInfo columnInfo)
Reacts on a
COLUMN_REMOVED event from the underlying model. |
void |
noteDataChanged(Object object,
TreePath objectPath,
boolean recursive,
int column)
Reacts on a
DATA_CHANGED event from the underlying model. |
void |
noteDuringObjectsRemoved(Object parent,
TreePath parentPath,
Object[] oldObjects,
int firstIndex)
Reacts on a
DURING_OBJECTS_REMOVED event from the underlying model. |
void |
noteObjectsChanged(Object parent,
TreePath parentPath,
Object[] oldObjects,
Object[] newObjects,
int firstIndex)
Reacts on a
OBJECTS_CHANGED event from the underlying model. |
void |
setDoubleAt(double value,
Object object,
int columnIndex)
This method is implemented through a call to the underlying model.
|
void |
setFilteredModel(IlvTreeListModel model)
Sets the underlying model.
|
void |
setValueAt(Object value,
Object object,
int columnIndex)
This method is implemented through a call to the underlying model.
|
addTreeListModelListener, convertToDouble, endBatch, fireModelEvent, postOrderIterator, preOrderIterator, removeTreeListModelListener, startBatch
public IlvFilterTreeListModel()
setFilteredModel
in order to specify the
underlying model.public IlvFilterTreeListModel(int eventsMask)
setFilteredModel
in order to specify the
underlying model.eventsMask
- Required supported events mask for any underlying model.public IlvFilterTreeListModel(IlvTreeListModel model)
model
- The underlying model.public Object getRoot()
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()
public Object getValueAt(Object object, int columnIndex)
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)
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 double getDoubleAt(Object object, int columnIndex)
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 setDoubleAt(double value, Object object, int columnIndex)
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 IlvDataColumnInfo getColumn(int columnIndex)
columnIndex
- The column.public int getSupportedEventsMask()
This implementation returns the event mask given at construction time. 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 void fireDataChanged(Object object, TreePath objectPath, boolean recursive, int column)
DATA_CHANGED
event.object
- The object whose attributes have changed.objectPath
- The path from the root to the object.recursive
- true
if the attributes of the entire subtree have
changed, false
for a change affecting only the single
object.column
- Column that changed, or -1 for all columns.public void fireBeforeDataChange(Object object, TreePath objectPath, boolean recursive, int column)
BEFORE_DATA_CHANGE
event.object
- The object whose attributes will change.objectPath
- The path from the root to the object.recursive
- true
if the attributes of the entire subtree will
change, false
for a change affecting only the single
object.column
- Column that will change, or -1 for all columns.public void fireObjectsChanged(Object parent, TreePath parentPath, Object[] oldObjects, Object[] newObjects, int firstIndex)
OBJECTS_CHANGED
event.parent
- The parent object of the set of objects that were changed,
added or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that was in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.newObjects
- The set of objects that is in place after the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index after adding or
before removing the objects) in
source.getChildren(parent)
. The second
object is/was at firstIndex+1
, and so on.public void fireBeforeObjectsRemoved(Object parent, TreePath parentPath, Object[] oldObjects, int firstIndex)
BEFORE_OBJECTS_REMOVED
event.parent
- The parent object of the set of objects that will be changed
or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that is in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index
before removing the objects) in
source.getChildren(parent)
. The second
object is at firstIndex+1
, and so on.public void fireDuringObjectsRemoved(Object parent, TreePath parentPath, Object[] oldObjects, int firstIndex)
DURING_OBJECTS_REMOVED
event.parent
- The parent object of the set of objects that will be changed
or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that is in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index
before removing the objects) in
source.getChildren(parent)
. The second
object is at firstIndex+1
, and so on.public void fireColumnAdded(int column, IlvDataColumnInfo columnInfo)
COLUMN_ADDED
event.column
- The column that was added (index after adding).columnInfo
- The IlvDataColumnInfo
of the column that was
added.public void fireColumnRemoved(int column, IlvDataColumnInfo columnInfo)
COLUMN_REMOVED
event.column
- The column that was removed (index before removing).columnInfo
- The IlvDataColumnInfo
of the column that was
removed.public void fireBeforeColumnRemoved(int column, IlvDataColumnInfo columnInfo)
BEFORE_COLUMN_REMOVED
event.column
- The column that will be removed (index before removing).columnInfo
- The IlvDataColumnInfo
of the column that
will be removed.public void fireColumnPropertyChanged(TreeListModelEvent.Type type, int column, Object oldValue, Object newValue)
EMPTY_VALUE_CHANGED
or
ENUMERATED_CHANGED
or ENUM_VALUES_CHANGED
or
MIN_VALUE_CHANGED
or MAX_VALUE_CHANGED
event.type
- One of EMPTY_VALUE_CHANGED
,
ENUMERATED_CHANGED
,
ENUM_VALUES_CHANGED
,
MIN_VALUE_CHANGED
,
MAX_VALUE_CHANGED
.column
- The affected column.oldValue
- The old value.newValue
- The new Value.public void noteDataChanged(Object object, TreePath objectPath, boolean recursive, int column)
DATA_CHANGED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireDataChanged
.
object
- The object whose attributes have changed.objectPath
- The path from the root to the object.recursive
- true
if the attributes of the entire subtree have
changed, false
for a change affecting only the single
object.column
- Column that changed, or -1 for all columns.public void noteBeforeDataChange(Object object, TreePath objectPath, boolean recursive, int column)
BEFORE_DATA_CHANGE
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireBeforeDataChange
.
object
- The object whose attributes will change.objectPath
- The path from the root to the object.recursive
- true
if the attributes of the entire subtree will
change, false
for a change affecting only the single
object.column
- Column that will change, or -1 for all columns.public void noteObjectsChanged(Object parent, TreePath parentPath, Object[] oldObjects, Object[] newObjects, int firstIndex)
OBJECTS_CHANGED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireObjectsChanged
.
parent
- The parent object of the set of objects that were changed,
added or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that was in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.newObjects
- The set of objects that is in place after the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index after adding or
before removing the objects) in
source.getChildren(parent)
. The second
object is/was at firstIndex+1
, and so on.public void noteBeforeObjectsRemoved(Object parent, TreePath parentPath, Object[] oldObjects, int firstIndex)
BEFORE_OBJECTS_REMOVED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireBeforeObjectsRemoved
.
parent
- The parent object of the set of objects that will be changed
or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that are in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index
before removing the objects) in
source.getChildren(parent)
. The second
object is at firstIndex+1
, and so on.public void noteDuringObjectsRemoved(Object parent, TreePath parentPath, Object[] oldObjects, int firstIndex)
DURING_OBJECTS_REMOVED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireDuringObjectsRemoved
.
parent
- The parent object of the set of objects that will be changed
or removed, or null
for a root change.parentPath
- The path from the root to the parent object, or
null
for a root change.oldObjects
- The set of objects that are in place before the change
(together with their entire subtrees), in the same order
as in source.getChildren(parent)
.firstIndex
- The index of the first object (index
before removing the objects) in
source.getChildren(parent)
. The second
object is at firstIndex+1
, and so on.public void noteColumnAdded(int column, IlvDataColumnInfo columnInfo)
COLUMN_ADDED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireColumnAdded
.
column
- The column that was added (index after adding).columnInfo
- The IlvDataColumnInfo
of the column that was
added.public void noteColumnRemoved(int column, IlvDataColumnInfo columnInfo)
COLUMN_REMOVED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireColumnRemoved
.
column
- The column that was removed (index before removing).columnInfo
- The IlvDataColumnInfo
of the column that was
removed.public void noteBeforeColumnRemoved(int column, IlvDataColumnInfo columnInfo)
BEFORE_COLUMN_REMOVED
event from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireBeforeColumnRemoved
.
column
- The column that will be removed (index before removing).columnInfo
- The IlvDataColumnInfo
of the column that
will be removed.public void noteColumnPropertyChanged(TreeListModelEvent.Type type, int column, Object oldValue, Object newValue)
EMPTY_VALUE_CHANGED
or
ENUMERATED_CHANGED
or ENUM_VALUES_CHANGED
or
MIN_VALUE_CHANGED
or MAX_VALUE_CHANGED
event
from the underlying model.
This method is meant to be overridden in subclasses. The default
implementation here calls fireColumnPropertyChanged
.
type
- One of EMPTY_VALUE_CHANGED
,
ENUMERATED_CHANGED
,
ENUM_VALUES_CHANGED
,
MIN_VALUE_CHANGED
,
MAX_VALUE_CHANGED
.column
- The affected column.oldValue
- The old value.newValue
- The new Value.public IlvTreeListModel getFilteredModel()
public void setFilteredModel(IlvTreeListModel model)
model
- The data model that this model shall refer to.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, this model is no longer functional.
public Object clone()
clone
in class IlvAbstractTreeListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.