public class IlvTreeTableToTreeListModel extends IlvDefaultTreeListModel
IlvTreeListModel
, based on a
TreeTableModel
.
There are multiple equivalent variants of TreeTableModel
, such as
the original TreeTableModel
from Sun,
the JDNC org.jdesktop.swing.treetable.TreeTableModel
from Sun,
ilog.webui.dhtml.components.IlxWTreeTableModel
(part of Rogue Wave JTGO),
the Mozilla org.mozilla.javascript.tools.debugger.TreeTableModel
.
Note: This model does not support adding and removing objects. You should
use the underlying TreeTableModel
for this purpose (assuming it is
an instance of DefaultTreeModel
and its nodes are instances
of MutableTreeNode
).
BEFORE_COLUMN_REMOVED_MASK, BEFORE_DATA_CHANGE_MASK, BEFORE_OBJECTS_REMOVED_MASK, DURING_OBJECTS_REMOVED_MASK
Constructor and Description |
---|
IlvTreeTableToTreeListModel(TreeModel model)
Creates a model backed by a given
TreeTableModel , with initially
the same columns. |
IlvTreeTableToTreeListModel(TreeModel model,
IlvDataColumnInfo[] columns)
Creates a model backed by a given
TreeTableModel , with the given columns. |
IlvTreeTableToTreeListModel(TreeModel model,
IlvDataColumnInfo[] columns,
int eventsMaskHint)
Creates a model backed by a given
TreeTableModel , with the given columns. |
IlvTreeTableToTreeListModel(TreeModel model,
int eventsMaskHint)
Creates a model backed by a given
TreeTableModel , with initially
the same columns. |
Modifier and Type | Method and Description |
---|---|
Class |
_model_getColumnClass(int column)
Returns the type for column number
column . |
int |
_model_getColumnCount()
Returns the number of available columns.
|
String |
_model_getColumnName(int column)
Returns the name for column number
column . |
Object |
_model_getValueAt(Object node,
int column)
Returns the value to be displayed for node
node ,
at column number column . |
void |
_model_setValueAt(Object newValue,
Object node,
int column)
Sets the value for node
node ,
at column number column . |
void |
addChild(Object object,
Object parent)
This method throws an
UnsupportedOperationException . |
void |
addChild(Object object,
Object[] data,
Object parent)
This method throws an
UnsupportedOperationException . |
protected void |
addColumnStorage(int columnIndex,
int insertedColumnCount)
Adds storage for new columns.
|
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.
|
List |
getChildren(Object parent)
Returns the 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 |
insertChild(Object object,
Object[] data,
Object parent,
int index)
This method throws an
UnsupportedOperationException . |
void |
insertChild(Object object,
Object parent,
int index)
This method throws an
UnsupportedOperationException . |
void |
insertChildren(Object[] objects,
Object parent,
int index)
This method throws an
UnsupportedOperationException . |
protected boolean |
isColumnComputed(int columnIndex)
Returns
true if setValueAtInternal and setDoubleAtInternal have no effect on a given
column. |
void |
removeAllChildren(Object parent)
This method throws an
UnsupportedOperationException . |
void |
removeChild(Object object,
Object parent)
This method throws an
UnsupportedOperationException . |
void |
removeChildren(Object[] objects,
Object parent,
int firstIndex)
This method throws an
UnsupportedOperationException . |
protected void |
removeColumnStorage(int columnIndex,
int removedColumnCount)
Removes storage for columns that have been dropped.
|
void |
setChildren(Object parent,
List newChildren)
This method throws an
UnsupportedOperationException . |
protected boolean |
setDoubleAtInternal(double value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setDoubleAt() . |
void |
setRoot(Object object)
This method throws an
UnsupportedOperationException . |
protected boolean |
setValueAtInternal(Object value,
Object object,
int columnIndex,
boolean forReal)
Does the equivalent of a
setValueAt() . |
clear, getChildAt, getIndexOf, setDoubleAt, setValueAt
addColumn, addColumn, fireModelEvent, getColumn, getColumnCount, getColumns, insertColumn, insertColumn, removeColumn, setColumn, setColumnCount, setColumns
addTreeListModelListener, convertToDouble, endBatch, postOrderIterator, preOrderIterator, removeTreeListModelListener, startBatch
public IlvTreeTableToTreeListModel(TreeModel model)
TreeTableModel
, with initially
the same columns.model
- A TreeTableModel
.public IlvTreeTableToTreeListModel(TreeModel model, int eventsMaskHint)
TreeTableModel
, with initially
the same columns.model
- A TreeTableModel
.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 IlvTreeTableToTreeListModel(TreeModel model, IlvDataColumnInfo[] columns)
TreeTableModel
, with the given columns.model
- A TreeTableModel
.columns
- The initial list of columns.public IlvTreeTableToTreeListModel(TreeModel model, IlvDataColumnInfo[] columns, int eventsMaskHint)
TreeTableModel
, with the given columns.model
- A TreeTableModel
.columns
- The initial list of columns.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 int _model_getColumnCount()
public String _model_getColumnName(int column)
column
.public Class _model_getColumnClass(int column)
column
.public Object _model_getValueAt(Object node, int column)
node
,
at column number column
.public void _model_setValueAt(Object newValue, Object node, int column)
node
,
at column number column
.public Object getRoot()
null
if the model
is empty.getRoot
in interface IlvTreeListModel
getRoot
in class IlvDefaultTreeListModel
public List getChildren(Object parent)
getChildren
in interface IlvTreeListModel
getChildren
in class IlvDefaultTreeListModel
public TreePath getPath(Object object)
getPath
in interface IlvTreeListModel
getPath
in class IlvDefaultTreeListModel
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 IlvTreeListModel
getValueAt
in class IlvDefaultTreeListModel
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 IlvTreeListModel
getDoubleAt
in class IlvDefaultTreeListModel
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, indicating whether the given value is
different from the previous one.
setValueAtInternal
in class IlvDefaultTreeListModel
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, indicating whether the given value is
different from the previous one.
setDoubleAtInternal
in class IlvDefaultTreeListModel
protected boolean isColumnComputed(int columnIndex)
true
if setValueAtInternal
and setDoubleAtInternal
have no effect on a given
column.isColumnComputed
in class IlvBasicTreeListModel
public int getSupportedEventsMask()
This implementation returns
DURING_OBJECTS_REMOVED_MASK | BEFORE_COLUMN_REMOVED_MASK
,
intersected with the eventsMaskHint constructor argument.
It may need to be overridden in subclasses.
getSupportedEventsMask
in interface IlvTreeListModel
getSupportedEventsMask
in class IlvDefaultTreeListModel
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.getParent
in class IlvDefaultTreeListModel
public void setRoot(Object object)
UnsupportedOperationException
.setRoot
in class IlvDefaultTreeListModel
object
- the new root, or null
public void setChildren(Object parent, List newChildren)
UnsupportedOperationException
.setChildren
in class IlvDefaultTreeListModel
public void addChild(Object object, Object parent)
UnsupportedOperationException
.addChild
in class IlvDefaultTreeListModel
object
- the child object to addparent
- specify where to insert the objectpublic void addChild(Object object, Object[] data, Object parent)
UnsupportedOperationException
.addChild
in class IlvDefaultTreeListModel
object
- object the child object to adddata
- The initial data of this object. It must be an array of
getColumnCount()
elements.parent
- specify where to insert the objectpublic void insertChild(Object object, Object parent, int index)
UnsupportedOperationException
.insertChild
in class IlvDefaultTreeListModel
object
- the child object to addparent
- specify where to insert the objectindex
- the new object's desired index, must be >= 0 and
<= parent.getChildren().size()
public void insertChild(Object object, Object[] data, Object parent, int index)
UnsupportedOperationException
.insertChild
in class IlvDefaultTreeListModel
object
- the child object to adddata
- The initial data of this object. It must be an array of
getColumnCount()
elements.parent
- specify where to insert the objectindex
- the new object's desired index, must be >= 0 and
<= parent.getChildren().size()
public void insertChildren(Object[] objects, Object parent, int index)
UnsupportedOperationException
.insertChildren
in class IlvDefaultTreeListModel
objects
- the objects to addparent
- specify where to insert the objectindex
- the first new object's desired index, must be >= 0 and
<= parent.getChildren().size()
public void removeChild(Object object, Object parent)
UnsupportedOperationException
.removeChild
in class IlvDefaultTreeListModel
public void removeChildren(Object[] objects, Object parent, int firstIndex)
UnsupportedOperationException
.removeChildren
in class IlvDefaultTreeListModel
objects
- the objects that were at indices firstIndex, ...,
firstIndex+objects.length-1 of
getChildren(parent).iterator()
parent
- where to find the objectsfirstIndex
- object to remove must be afterpublic void removeAllChildren(Object parent)
UnsupportedOperationException
.removeAllChildren
in class IlvDefaultTreeListModel
protected void addColumnStorage(int columnIndex, int insertedColumnCount)
IlvDefaultTreeListModel
addColumnStorage
in class IlvDefaultTreeListModel
protected void removeColumnStorage(int columnIndex, int removedColumnCount)
IlvDefaultTreeListModel
removeColumnStorage
in class IlvDefaultTreeListModel
public void dispose()
Note: After calling this function, this model is no longer functional.
dispose
in class IlvDefaultTreeListModel
public void disconnect()
Note: After calling this function, and after some changes occurred in the underlying model and columns, this model is no longer functional.
disconnect
in class IlvBasicTreeListModel
public Object clone()
clone
in class IlvDefaultTreeListModel
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.