T
- the type of the hierarchy nodespublic class DefaultTreeTableModel<T extends ITreeTableNode> extends DefaultTreeModel implements ITreeTableModel<T>
ITreeTableModel
.asksAllowsChildren, listenerList, root
Constructor and Description |
---|
DefaultTreeTableModel(T root)
Constructs a new tree table model with the given root node.
|
DefaultTreeTableModel(T root,
boolean asksAllowsChildren)
Constructs a new tree table model.
|
Modifier and Type | Method and Description |
---|---|
void |
addTreeTableModelListener(ITreeTableModelListener l)
Adds a listener to the model, which will be informed when key or column
values get changes.
|
protected void |
fireTreeNodeKeyChanged(Object[] path,
Object oldKey,
Object newKey)
Fires a
TreeTableModelEvent when a node's key value was changed. |
protected void |
fireTreeNodeValuesChanged(Object[] path,
Object oldValue,
Object newValue,
int columnModelIndex)
Fires a
TreeTableModelEvent when a node's column value was
changed. |
Object |
getColumnValue(T node,
int index)
Returns an object for the given node that will be displayed in a tree
table column where the column's model index matches the given index.
It is very important to note the difference between the model index and a
columns index within a given column model.
|
Object |
getKey(T node)
Returns an object for the given node that will be displayed in the tree
table's key column.
|
T |
getRoot() |
Object |
getRowHeaderValue(T node)
Returns an object that will be visualized in the row header section of
the Gantt chart.
|
void |
removeTreeTableModelListener(ITreeTableModelListener l)
Removes a listener from the model.
|
void |
setColumnValue(T node,
Object newValue,
int columnModelIndex)
Sets a new column value for the given node and model index.
|
void |
setKey(T node,
Object newKey)
Sets a new object to be used as the key object for the given tree table
node.
|
void |
setRoot(T root)
Overrides the parent method in order to implement type safety via the use
of Generics.
|
void |
setRoot(TreeNode node)
Deprecated.
|
void |
setRowHeaderValue(T node,
Object value)
Sets the value used for the row header.
|
void |
sort()
Sorts the entire tree based on the key column and in ascending order.
|
void |
sort(T node)
Sorts the given node#s children based on the key column and in ascending
order.
|
void |
sort(T node,
int[] modelIndices)
Sorts the children of a node based on the given model indices and in
ascending order.
|
void |
sort(T node,
int[] modelIndices,
boolean[] sortDirection)
Invokes multi-column sorting on the tree table model.
|
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, valueForPathChanged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTreeModelListener, getChild, getChildCount, getIndexOfChild, isLeaf, removeTreeModelListener, valueForPathChanged
public DefaultTreeTableModel(T root)
root
- the model's root objectpublic DefaultTreeTableModel(T root, boolean asksAllowsChildren)
root
- the model's root objectasksAllowsChildren
- a boolean, false if any node can have children, true if each
node is asked to see if it can have childrenpublic Object getKey(T node)
ITreeTableModel
getKey
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the tree table's node for which to return a key objectITreeTableModel.setKey(Object, Object)
public void setKey(T node, Object newKey)
ITreeTableModel
setKey
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the node for which to specify a new key objectnewKey
- the node's new key objectITreeTableModel.getKey(Object)
public Object getColumnValue(T node, int index)
ITreeTableModel
getColumnValue
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the node for which to return a column value objectindex
- the column's model indexITreeTableModel.setColumnValue(Object, Object, int)
public void setColumnValue(T node, Object newValue, int columnModelIndex)
ITreeTableModel
It is very important to note the difference between the model index and a columns index within a given column model. The model index usually never changes and is used to lookup the correct piece of information from some kind of data model. The other index is simply the columns current position within the model. This index can change if the user or the application rearranges the columns.
setColumnValue
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the node that will receive a new column valuenewValue
- the new column valuecolumnModelIndex
- the model index that will get changedITreeTableModel.getColumnValue(Object, int)
,
INodeEditPolicy.isValueEditable(Object, ITreeTableModel, int)
,
INodeEditPolicy.getChangeValueCommand(Object, ITreeTableModel,
Object, int)
public Object getRowHeaderValue(T node)
ITreeTableModel
getRowHeaderValue
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the node for which to return a header valuepublic void setRowHeaderValue(T node, Object value)
node
- the tree nodevalue
- the row header valuegetRowHeaderValue(ITreeTableNode)
public void addTreeTableModelListener(ITreeTableModelListener l)
ITreeTableModel
addTreeTableModelListener
in interface ITreeTableModel<T extends ITreeTableNode>
l
- the listener to addITreeTableModel.removeTreeTableModelListener(ITreeTableModelListener)
public void removeTreeTableModelListener(ITreeTableModelListener l)
ITreeTableModel
removeTreeTableModelListener
in interface ITreeTableModel<T extends ITreeTableNode>
l
- the listener to removeITreeTableModel.addTreeTableModelListener(ITreeTableModelListener)
protected void fireTreeNodeKeyChanged(Object[] path, Object oldKey, Object newKey)
TreeTableModelEvent
when a node's key value was changed.path
- the path to the node that was changedoldKey
- the old key valuenewKey
- the new key valueprotected void fireTreeNodeValuesChanged(Object[] path, Object oldValue, Object newValue, int columnModelIndex)
TreeTableModelEvent
when a node's column value was
changed.path
- the path to the node that was changedoldValue
- the old column valuenewValue
- the new column valuecolumnModelIndex
- the column's model indexpublic void sort()
sort(ITreeTableNode)
,
sort(ITreeTableNode, int[])
,
sort(ITreeTableNode, int[], boolean[])
public void sort(T node)
node
- the parent of the nodes that will be sortedsort()
,
sort(ITreeTableNode, int[])
,
sort(ITreeTableNode, int[], boolean[])
public void sort(T node, int[] modelIndices)
node
- the parent of the nodes that will be sortedmodelIndices
- the model indices on which to sortsort()
,
sort(ITreeTableNode)
,
sort(ITreeTableNode, int[], boolean[])
public void sort(T node, int[] modelIndices, boolean[] sortDirection)
ITreeTableModel
sort
in interface ITreeTableModel<T extends ITreeTableNode>
node
- the node that is the target of the sort, the node's children
will be sorted (if the node is the root then the entire table
will be sorted)modelIndices
- the model indices that are used to determine which column
values to compare for sorting (use
KeyColumn.MODEL_INDEX
to specify a sort based on the
key columnsortDirection
- if TRUE the sort direction will be ascending@Deprecated public void setRoot(TreeNode node)
setRoot
in class DefaultTreeModel
public void setRoot(T root)
root
- the typed root objectgetRoot()
public T getRoot()
getRoot
in interface TreeModel
getRoot
in class DefaultTreeModel
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.