public class TreeTableNode extends Object
TreeTable
to store the
state of its tree nodes. Objects of this class wrap the actual model nodes.
The class caches its children so that the nodes in the tree keep their expand
/ collapse state even when new nodes are inserted.Modifier and Type | Field and Description |
---|---|
protected TreeTableNode[] |
children
The array of children entries.
|
protected TreeTableNode |
parent
Reference to the parent table entry.
|
Modifier | Constructor and Description |
---|---|
protected |
TreeTableNode(TreeTable table,
Object modelNode)
Constructs a new tree table node.
|
Modifier and Type | Method and Description |
---|---|
protected void |
collapse()
Tells the entry to be closed.
|
protected void |
expand()
Tells the entry to be open.
|
Object |
getChildAt(int index)
Returns the child for the given child index.
|
int |
getChildCount()
Returns the total number of child nodes attached to the node.
|
TreeTableNode |
getChildNode(Object modelChildNode)
Returns the wrapping tree table node for the given model node.
|
TreeTableNode[] |
getChildren()
Returns the array of child nodes.
|
int |
getDepth()
Returns the depth of the node within the hierarchy.
|
int |
getHeight()
Returns the row height of the node.
|
Object |
getKey()
Returns the key value of the wrapped model node.
|
ITreeTableModel |
getModel()
Returns the model to which the node (or the wrapped model node) belongs.
|
Object |
getModelNode()
Returns the model node object that is wrapped by the tree table node.
|
Object |
getNewParentForIndentation()
Returns the model node that will be the new parent of this node when it
gets indented.
|
Object |
getNewParentForOutdentation()
Returns the model node that will be the new parent of this node when it
gets outdentend.
|
TreeTableNode |
getParentNode()
Returns the parent node of the node.
|
TreePath |
getPath()
Returns a tree path for the node.
|
int |
getRow()
Returns the row of the entry inside the table.
|
int |
getTotalChildrenCount()
Calculates the total number of all children rows.
|
int |
getTotalChildrenHeight()
Calculates the total height of all children rows.
|
TreeTable |
getTreeTable()
Returns the tree table in which the node gets displayed.
|
Object |
getValueAt(int index)
Returns the column value of the wrapped model node for the given model
index.
|
int |
getY()
Returns the y-coordinate of the row in which the node gets displayed.
|
boolean |
isExpanded()
Determines if the node is currently expanded.
|
boolean |
isLeaf()
Determines if the tree node is a leaf, which means that the node does not
have any child nodes attached to it.
|
boolean |
isLoaded()
Determines if the node has already loaded its child elements.
|
boolean |
isNewEntryPlaceholder()
Determines if the node is the one that gets used to create new nodes.
|
boolean |
isSelected()
Determines if the node is currently selected.
|
protected void |
load()
Loads the children nodes from the model, wraps each one of them and adds
them to this node.
|
protected void |
load(Map<Object,TreeTableNode> tableCache)
Loads the children nodes from the model, wraps each one of them and adds
them to this node.
|
protected void |
resetTotals()
Resets the totals for the cached values "children height" and
"children count".
|
protected void |
setDepth(int depth)
Sets the depth of the node within the hierarchy.
|
protected void |
setParent(TreeTableNode parent)
Sets the node's parent node.
|
protected void |
setRow(int row)
Sets the row index on the node.
|
protected void |
setY(int y)
Sets the y-coordiante of the row in which the node gets displayed.
|
protected TreeTableNode parent
protected TreeTableNode[] children
public boolean isNewEntryPlaceholder()
public TreeTable getTreeTable()
public ITreeTableModel getModel()
public boolean isLoaded()
protected void load()
protected void load(Map<Object,TreeTableNode> tableCache)
tableCache
- the table can provide a cache of tree table nodes that can be
reused (e.g. after drag and drop operations within the same
table)public Object getModelNode()
public TreePath getPath()
public Object getValueAt(int index)
index
- the model indexITreeTableModel.getColumnValue(Object, int)
public Object getKey()
ITreeTableModel.getKey(Object)
protected void setDepth(int depth)
depth
- the depth of the node within the hierarchygetPath()
public int getDepth()
getPath()
protected void setParent(TreeTableNode parent)
parent
- the parent node of the nodepublic TreeTableNode getParentNode()
public boolean isLeaf()
public int getChildCount()
TreeModel.getChildCount(Object)
public Object getChildAt(int index)
index
- the index for which to return the child nodeTreeModel.getChild(Object, int)
public TreeTableNode[] getChildren()
public TreeTableNode getChildNode(Object modelChildNode)
modelChildNode
- the model child node for which to return the wrapping tree
table nodeprotected void expand()
protected void collapse()
public boolean isExpanded()
public boolean isSelected()
protected void setRow(int row)
row
- the node's row indexpublic int getRow()
public int getHeight()
protected void setY(int y)
y
- the y-coordinate of the node's rowpublic int getY()
public int getTotalChildrenHeight()
public int getTotalChildrenCount()
protected void resetTotals()
public Object getNewParentForIndentation()
public Object getNewParentForOutdentation()
Copyright © 2006–2016 Dirk Lemmermann Software & Consulting. All rights reserved.