public interface IlvTreeListModel extends IlvTreeModelWithColumns, IlvBatchable
The data consists of a tree of objects, where each object has an ordered set of children objects. Each object has a value for a given set of attributes. The attributes are called columns; in this perspective, the objects correspond to rows of a tree-table.
The columns have some metainformation, like the column number, name, value type, and so on.
In implementations of this model that are only connected to the
JViews Chart component, you can implement the setValueAt
and
setDoubleAt
methods as empty: these methods are not
invoked by the JViews Charts view.
IlvDataColumnInfo
,
IlvAbstractTreeListModel
,
IlvDefaultTreeListModel
,
TreeListModelEvent
,
TreeListModelListener
Modifier and Type | Field and Description |
---|---|
static int |
BEFORE_COLUMN_REMOVED_MASK
Bit mask that, when returned by
getSupportedEventsMask() ,
denotes that a
TreeListModelEvent.Type.BEFORE_COLUMN_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.COLUMN_REMOVED
event. |
static int |
BEFORE_DATA_CHANGE_MASK
Bit mask that, when returned by
getSupportedEventsMask() ,
denotes that a
TreeListModelEvent.Type.BEFORE_DATA_CHANGE
event is guaranteed to be fired before every
TreeListModelEvent.Type.DATA_CHANGED
event. |
static int |
BEFORE_OBJECTS_REMOVED_MASK
Bit mask that, when returned by
getSupportedEventsMask() ,
denotes that a
TreeListModelEvent.Type.BEFORE_OBJECTS_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.OBJECTS_CHANGED
event that has a non-empty set of "old objects". |
static int |
DURING_OBJECTS_REMOVED_MASK
Bit mask that, when returned by
getSupportedEventsMask() ,
denotes that a
TreeListModelEvent.Type.DURING_OBJECTS_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.OBJECTS_CHANGED
event that has a non-empty set of "old objects". |
Modifier and Type | Method and Description |
---|---|
void |
addTreeListModelListener(TreeListModelListener listener)
Adds a listener.
|
void |
endBatch()
Terminates a group of modifications.
|
List<? extends Object> |
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. |
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 |
removeTreeListModelListener(TreeListModelListener listener)
Removes a listener.
|
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 . |
void |
startBatch()
Starts a group of modifications.
|
static final int BEFORE_DATA_CHANGE_MASK
getSupportedEventsMask()
,
denotes that a
TreeListModelEvent.Type.BEFORE_DATA_CHANGE
event is guaranteed to be fired before every
TreeListModelEvent.Type.DATA_CHANGED
event.getSupportedEventsMask()
,
Constant Field Valuesstatic final int BEFORE_OBJECTS_REMOVED_MASK
getSupportedEventsMask()
,
denotes that a
TreeListModelEvent.Type.BEFORE_OBJECTS_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.OBJECTS_CHANGED
event that has a non-empty set of "old objects".getSupportedEventsMask()
,
Constant Field Valuesstatic final int DURING_OBJECTS_REMOVED_MASK
getSupportedEventsMask()
,
denotes that a
TreeListModelEvent.Type.DURING_OBJECTS_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.OBJECTS_CHANGED
event that has a non-empty set of "old objects".getSupportedEventsMask()
,
Constant Field Valuesstatic final int BEFORE_COLUMN_REMOVED_MASK
getSupportedEventsMask()
,
denotes that a
TreeListModelEvent.Type.BEFORE_COLUMN_REMOVED
event is guaranteed to be fired before every
TreeListModelEvent.Type.COLUMN_REMOVED
event.getSupportedEventsMask()
,
Constant Field ValuesObject getRoot()
null
if the model
is empty.List<? extends Object> getChildren(Object parent)
TreePath getPath(Object object)
object
- An object in the model.TreePath
whose first component is
getRoot()
and whose last component is the given
object.int getColumnCount()
Valid column indices range from 0 to getColumnCount()-1
(inclusive).
getColumnCount
in interface IlvModelWithColumns
Object getValueAt(Object object, int columnIndex)
columnIndex
in the given object.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.void setValueAt(Object value, Object object, int columnIndex)
columnIndex
in the given object to the given value
.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.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
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.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
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.IlvDataColumnInfo getColumn(int columnIndex)
getColumn
in interface IlvModelWithColumns
columnIndex
- The column.void startBatch()
startBatch
in interface IlvBatchable
void endBatch()
endBatch
in interface IlvBatchable
void addTreeListModelListener(TreeListModelListener listener)
void removeTreeListModelListener(TreeListModelListener listener)
int getSupportedEventsMask()
It is always safe to implement this method by returning 0.
If a given model does not support the events that you need, you can
wrap the model in an IlvBufferTreeListModel
: the wrapped model will
support all events.
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.