|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.tree.DefaultMutableTreeNode com.dlsc.flexgantt.model.treetable.DefaultMutableTreeTableNode<T>
T
- the object type of the user objectpublic class DefaultMutableTreeTableNode<T>
A default implementation for the ITreeTableNode
interface.
DefaultMutableTreeTableNode
provides operations for examining and
modifying a node's parent and children and also operations for examining the
tree that the node is a part of. A node's tree is the set of all nodes that
can be reached by starting at the node and following all the possible links
to parents and children. A node with no parent is the root of its tree; a
node with no children is a leaf. A tree may consist of many subtrees, each
node acting as the root for its own subtree.
This class provides enumerations for efficiently traversing a tree or subtree
in various orders or for following the path between two nodes. A
DefaultMutableTreeTableNode
may also hold a reference to a user
object, the use of which is left to the user. Asking a
DefaultMutableTreeTableNode
for its string representation with
DefaultMutableTreeNode.toString()
returns the string representation of its user object.
Field Summary |
---|
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
Constructor Summary | |
---|---|
DefaultMutableTreeTableNode()
Creates a tree node that has no parent and no children, but which allows children. |
|
DefaultMutableTreeTableNode(boolean allowsChildren)
Creates a tree table node with no parent, no children, no user object, which allows children only if specified. |
|
DefaultMutableTreeTableNode(T userObject)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object. |
|
DefaultMutableTreeTableNode(T userObject,
boolean allowsChildren)
Creates a tree table node with no parent, no children, initialized with the specified user object, and that allows children only if specified. |
Method Summary | |
---|---|
void |
add(javax.swing.tree.MutableTreeNode newChild)
|
protected int |
compare(int modelIndex,
java.lang.Object value1,
java.lang.Object value2,
boolean ascending)
Compares two values with each other via this algorithm: if value1 is NULL then return -1
if value2 is NULL then return +1
if getComparator(modelIndex) ! |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
|
java.lang.Object |
getColumnValue(int modelIndex)
Returns the value for the given model index. |
java.util.Comparator |
getComparator(int modelIndex)
Returns a comparator for comparing values stored under the given model index. |
int |
getDragActions()
Returns the drag actions that can be performed on the tree table node. |
int |
getDropActions(ITreeTableNode dropCandidate)
Returns the drop actions that can be performed on the node related to another node. |
java.lang.Object |
getKey()
Returns the node's key object. |
java.util.Comparator |
getKeyComparator()
Returns the comparator that will be used for comparing key values of tree table nodes. |
java.lang.Object |
getRowHeaderValue()
Returns a value that can be used by the row header and the row header renderer to control the rendering of the row header. |
int |
getRowHeight()
Returns the current row height of the node. |
int |
getRowHeightMaximum()
Returns the node's maximum row height. |
int |
getRowHeightMinimum()
Returns the node's minimum row height. |
java.lang.String |
getToolTipText(TreeTableColumn modelIndex)
Returns the appropriate tooltip text for the given column / model index. |
T |
getTypedUserObject()
Returns the user object. |
java.lang.Object |
getUserObject()
Deprecated. use getTypedUserObject() instead |
void |
insert(javax.swing.tree.MutableTreeNode newChild,
int childIndex)
|
boolean |
isDeletable()
Returns TRUE if the whole node can be deleted. |
boolean |
isKeyEditable()
Specifies whether or not the key value of the node can be edited / replaced. |
boolean |
isResizable()
Returns TRUE if the tree node can be resized. |
boolean |
isRowLineVisible(boolean expanded)
Returns TRUE if the horizontal grid line of the row in which the node is displayed shall be drawn or not (the answer to this question of depends on the state of the node, whether it is expanded or closed). |
boolean |
isSelectable()
Returns TRUE if the tree node can be selected. |
boolean |
isSorting()
Returns TRUE if the node sorts its children. |
boolean |
isValueEditable(int modelIndex)
Returns TRUE if the column value at the given model index can be edited. |
void |
setColumnValue(java.lang.Object value,
int modelIndex)
Sets the value for the given model index. |
void |
setComparator(int modelIndex,
java.util.Comparator comp)
Sets a comparator that will be used for comparing values stored under the given model index. |
void |
setDeletable(boolean b)
Specifies whether or not the entire node can be deleted from the tree table model. |
void |
setDragActions(int actions)
Sets the drag actions that can be performed on the tree table node. |
void |
setKey(java.lang.Object key)
Sets the node's key object. |
void |
setKeyComparator(java.util.Comparator comparator)
Sets the comparator that will be used for comparing key values of tree table nodes. |
void |
setKeyEditable(boolean b)
Specifies whether or not the key value of the node can be edited / replaced. |
void |
setResizable(boolean resizable)
Specifies whether the row height of the node is resizable. |
void |
setRowHeaderValue(java.lang.Object value)
Sets a row header value that can be used by the row ehader and the row header renderer to control the rendering of the row header. |
void |
setRowHeight(int rowHeight)
Specifies a new row height for the tree table node. |
void |
setRowHeightMaximum(int max)
Sets the maximum height that the row showing this node may have. |
void |
setRowHeightMinimum(int min)
Sets the minimum height that the row showing this node may have. |
void |
setRowLineVisible(boolean visibleExpanded,
boolean visibleCollapsed)
Specifies whether the horizontal grid line of the row in which the node gets displayed will be drawn or not. |
void |
setSelectable(boolean b)
Specifies whether the node is selectable or not. |
void |
setToolTipText(java.lang.String ttt)
Sets a tooltip text on the node. |
void |
setTypedUserObject(T userObject)
Sets a new user object on the node. |
void |
setUserObject(java.lang.Object userObject)
Deprecated. use setTypedUserObject(Object) instead |
void |
setValueEditable(int modelIndex,
boolean b)
Specifies which column values can be edited or not. |
void |
sort(int[] modelIndices,
boolean[] sortDirections)
Invokes multi-column sorting on the tree table node. |
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode |
---|
breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.swing.tree.TreeNode |
---|
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
Methods inherited from interface javax.swing.tree.MutableTreeNode |
---|
remove, remove, removeFromParent, setParent |
Methods inherited from interface javax.swing.tree.TreeNode |
---|
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public DefaultMutableTreeTableNode(T userObject, boolean allowsChildren)
userObject
- an object provided by the user that constitutes the node's
dataallowsChildren
- if TRUE, the node is allowed to have child nodes -- otherwise,
it is always a leaf nodepublic DefaultMutableTreeTableNode(T userObject)
userObject
- an object provided by the user that constitutes the node's
datapublic DefaultMutableTreeTableNode(boolean allowsChildren)
allowsChildren
- if TRUE, the node is allowed to have child nodes -- otherwise,
it is always a leaf nodepublic DefaultMutableTreeTableNode()
Method Detail |
---|
public int getRowHeight()
ITreeTableNode
getRowHeight
in interface ITreeTableNode
ITreeTableNode.getRowHeightMaximum()
,
ITreeTableNode.getRowHeightMinimum()
,
IRowPolicy.getRowHeight(Object, ITreeTableModel)
,
IRowPolicy.getRowResizeCommand(Object, ITreeTableModel, int)
,
DefaultRowResizeCommand
public void setRowHeight(int rowHeight)
ITreeTableNode
setRowHeight
in interface ITreeTableNode
rowHeight
- the new row heightIRowPolicy.isRowResizable(Object, ITreeTableModel)
,
IRowPolicy.getRowResizeCommand(Object, ITreeTableModel, int)
,
DefaultRowPolicy
,
DefaultRowResizeCommand
public int getRowHeightMaximum()
ITreeTableNode
getRowHeightMaximum
in interface ITreeTableNode
ITreeTableNode.getRowHeight()
,
ITreeTableNode.getRowHeightMinimum()
,
IRowPolicy.getRowHeightMaximum(Object, ITreeTableModel)
,
IRowPolicy.getRowResizeCommand(Object, ITreeTableModel, int)
,
DefaultRowResizeCommand
public void setRowHeightMaximum(int max)
max
- the maximum row heightsetRowHeight(int)
,
setRowHeightMinimum(int)
public int getRowHeightMinimum()
ITreeTableNode
getRowHeightMinimum
in interface ITreeTableNode
ITreeTableNode.getRowHeight()
,
ITreeTableNode.getRowHeightMaximum()
,
IRowPolicy.getRowHeightMinimum(Object, ITreeTableModel)
,
IRowPolicy.getRowResizeCommand(Object, ITreeTableModel, int)
,
DefaultRowResizeCommand
public void setRowHeightMinimum(int min)
min
- the minimum row heightsetRowHeight(int)
,
setRowHeightMaximum(int)
public java.lang.Object getColumnValue(int modelIndex)
ITreeTableNode
getColumnValue
in interface ITreeTableNode
modelIndex
- the model index provided by the column
TreeTableColumn.getModelIndex()
public void setColumnValue(java.lang.Object value, int modelIndex)
ITreeTableNode
setColumnValue
in interface ITreeTableNode
value
- the new valuemodelIndex
- the model index provided by the columnTreeTableColumn.getModelIndex()
,
DefaultChangeValueCommand
,
INodeEditPolicy.getChangeValueCommand(Object, ITreeTableModel,
Object, int)
public boolean isSelectable()
ITreeTableNode
isSelectable
in interface ITreeTableNode
IRowPolicy.isRowSelectable(Object, ITreeTableModel)
public void setSelectable(boolean b)
b
- if TRUE the user will be able to add the node to the tree
table's current selectionisSelectable()
public boolean isResizable()
ITreeTableNode
isResizable
in interface ITreeTableNode
IRowPolicy.isRowResizable(Object, ITreeTableModel)
,
IRowPolicy.getRowResizeCommand(Object, ITreeTableModel, int)
,
DefaultRowResizeCommand
,
ITreeTableNode.getRowHeight()
,
ITreeTableNode.getRowHeightMaximum()
,
ITreeTableNode.getRowHeightMinimum()
public void setResizable(boolean resizable)
resizable
- if TRUE the user will be able to change the row heightisResizable()
public boolean isRowLineVisible(boolean expanded)
ITreeTableNode
isRowLineVisible
in interface ITreeTableNode
expanded
- if TRUE the tree table node is currently expanded
IRowPolicy.isRowLineVisible(Object, boolean, ITreeTableModel)
public void setRowLineVisible(boolean visibleExpanded, boolean visibleCollapsed)
visibleExpanded
- if TRUE the horizontal grid line of the row will be visible
when the node is expandedvisibleCollapsed
- if TRUE the horizontal grid line of the row will be visible
when the node is collapsedIRowPolicy.isRowLineVisible(Object, boolean, ITreeTableModel)
public boolean isValueEditable(int modelIndex)
ITreeTableNode
isValueEditable
in interface ITreeTableNode
modelIndex
- the model index
INodeEditPolicy.isValueEditable(Object, ITreeTableModel, int)
,
INodeEditPolicy.getChangeValueCommand(Object, ITreeTableModel,
Object, int)
,
DefaultChangeValueCommand
public void setValueEditable(int modelIndex, boolean b)
modelIndex
- the model index for which editing will be enabled / disabledb
- if TRUE turns on value editing for the given model indexisValueEditable(int)
public boolean isKeyEditable()
isKeyEditable
in interface ITreeTableNode
setKeyEditable(boolean)
public void setKeyEditable(boolean b)
b
- if TRUE the key can be editedisKeyEditable()
public void setToolTipText(java.lang.String ttt)
ttt
- the tooltip text to usegetToolTipText(TreeTableColumn)
public java.lang.String getToolTipText(TreeTableColumn modelIndex)
ITreeTableNode
getToolTipText
in interface ITreeTableNode
modelIndex
- the column model index for which to return a tooltip text
IRowPolicy.getRowToolTip(Object, ITreeTableModel, TreeTableColumn)
,
DefaultRowPolicy
public void setKey(java.lang.Object key)
ITreeTableNode
setKey
in interface ITreeTableNode
key
- the node's key objectITreeTableNode.getKey()
,
DefaultChangeKeyCommand
,
INodeEditPolicy.getChangeKeyCommand(Object, ITreeTableModel, Object)
public java.lang.Object getKey()
ITreeTableNode
getKey
in interface ITreeTableNode
ITreeTableNode.setKey(Object)
,
ITreeTableModel.getKey(Object)
,
ITreeTableModel.getKey(Object)
,
setKey(Object)
,
getKey()
public boolean isDeletable()
ITreeTableNode
isDeletable
in interface ITreeTableNode
INodeEditPolicy.isDeletable(Object, ITreeTableModel)
,
INodeEditPolicy.getDeleteNodeCommand(Object, ITreeTableModel)
,
DefaultNodeDeleteCommand
public void setDeletable(boolean b)
b
- if TRUE the node can be deletedisDeletable()
public java.lang.Object getRowHeaderValue()
ITreeTableNode
getRowHeaderValue
in interface ITreeTableNode
IRowHeaderRenderer
,
ITreeTableModel.getRowHeaderValue(Object)
public void setRowHeaderValue(java.lang.Object value)
ITreeTableNode
setRowHeaderValue
in interface ITreeTableNode
value
- the row header valueIRowHeaderRenderer
,
ITreeTableModel.getRowHeaderValue(Object)
@Deprecated public final void setUserObject(java.lang.Object userObject)
setTypedUserObject(Object)
instead
setUserObject
in interface javax.swing.tree.MutableTreeNode
setUserObject
in class javax.swing.tree.DefaultMutableTreeNode
@Deprecated public final java.lang.Object getUserObject()
getTypedUserObject()
instead
getUserObject
in class javax.swing.tree.DefaultMutableTreeNode
public void setTypedUserObject(T userObject)
setUserObject(Object)
in order to support generics for
user objects.
userObject
- the user object to set on the nodepublic T getTypedUserObject()
getUserObject()
method in order to support generics for
user object.
public void sort(int[] modelIndices, boolean[] sortDirections)
ITreeTableNode
sort
in interface ITreeTableNode
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 columnsortDirections
- if TRUE the sort direction will be ascendingITreeTableModel.sort(Object, int[], boolean[])
public boolean isSorting()
sort(int[], boolean[])
public void add(javax.swing.tree.MutableTreeNode newChild)
add
in class javax.swing.tree.DefaultMutableTreeNode
public void insert(javax.swing.tree.MutableTreeNode newChild, int childIndex)
insert
in interface javax.swing.tree.MutableTreeNode
insert
in class javax.swing.tree.DefaultMutableTreeNode
public void setKeyComparator(java.util.Comparator comparator)
Comparable
interface implementation.
comparator
- the comparator that will be used when sorting key valuesgetKeyComparator()
public java.util.Comparator getKeyComparator()
Comparable
interface implementation.
public void setComparator(int modelIndex, java.util.Comparator comp)
modelIndex
- the model index for which to specify a comparatorcomp
- the comparator that will be used for comparing values stored
under the given model indexgetComparator(int)
,
compare(Object, Object)
public java.util.Comparator getComparator(int modelIndex)
Comparable
interface implemenation.
modelIndex
- the model index for which to return a comparator
setComparator(int, Comparator)
,
compare(int, Object, Object, boolean)
,
compare(Object, Object)
public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator
protected int compare(int modelIndex, java.lang.Object value1, java.lang.Object value2, boolean ascending)
if value1 is NULL then return -1
if value2 is NULL then return +1
if getComparator(modelIndex) != null then return result of Comparator#compare(Object, Object)
if values implement Comparable
then return Comparable#compareTo(Object)
throw IllegalArgumentException -> unable to sort
modelIndex
- the model index under which the values were stored (the index
is important for looking up the correct comparator)value1
- the first value for the comparisonvalue2
- the second value for the commparisonascending
- the sort order (ascending or descending)
getComparator(int)
,
sort(int[], boolean[])
public int getDragActions()
ITreeTableNode
DnDConstants
. Possible values are:
DnDConstants.ACTION_COPY
DnDConstants.ACTION_MOVE
DnDConstants.ACTION_COPY_OR_MOVE
ITreeTableNode.getDropActions(ITreeTableNode)
.
getDragActions
in interface ITreeTableNode
DefaultNodeDragAndDropCommand
,
INodeDragAndDropPolicy.getDragActions(Object, ITreeTableModel)
public void setDragActions(int actions)
DnDConstants
. Possible values are:
DnDConstants.ACTION_COPY
DnDConstants.ACTION_MOVE
DnDConstants.ACTION_COPY_OR_MOVE
ITreeTableNode.getDropActions(ITreeTableNode)
.
actions
- the supported drag actions (move, copy, or both)DefaultNodeDragAndDropCommand
,
INodeDragAndDropPolicy.getDragActions(Object, ITreeTableModel)
public int getDropActions(ITreeTableNode dropCandidate)
ITreeTableNode
DnDConstants
.
Possible values are:
DnDConstants.ACTION_COPY
DnDConstants.ACTION_MOVE
DnDConstants.ACTION_COPY_OR_MOVE
ITreeTableNode.getDragActions()
.
getDropActions
in interface ITreeTableNode
dropCandidate
- the node that might get dropped onto this node
DefaultNodeDragAndDropCommand
,
INodeDragAndDropPolicy.getDropActions(Object, Object,
ITreeTableModel, Object, ITreeTableModel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |