Package com.prineside.tdi2.scene2d.ui
Class Tree.Node<N extends Tree.Node,V,A extends Actor>
java.lang.Object
com.prineside.tdi2.scene2d.ui.Tree.Node<N,V,A>
- Type Parameters:
N
- The type for the node's parent and child nodes.V
- The type for the node's value.A
- The type for the node's actor.
A
Tree
node which has an actor and value.
A subclass can be used so the generic type parameters don't need to be specified repeatedly.
- Author:
- Nathan Sweet
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
Removes all children from this node.void
Collapses all nodes under and including this node.void
Expands all nodes under and including this node.void
expandTo()
Expands all parent nodes of this node.void
findExpandedValues
(Array<V> values) Returns this node or the child node with the specified value, or null.getActor()
If the children order is changed,updateChildren()
must be called to ensure the node's actors are in the correct order.float
Returns the height of the node as calculated for layout.getIcon()
int
getLevel()
getTree()
Returns the tree this node's actor is currently in, or null.getValue()
boolean
void
boolean
isAscendantOf
(N node) Returns true if the specified node is this node or an ascendant of this node.boolean
isDescendantOf
(N node) Returns true if the specified node is this node or an descendant of this node.boolean
boolean
void
remove()
Remove this node from its parent.void
Remove the specified child node from this node.void
restoreExpandedValues
(Array<V> values) void
void
setExpanded
(boolean expanded) void
Sets an icon that will be drawn to the left of the actor.void
setSelectable
(boolean selectable) void
Sets an application specific value for this node.void
Updates the order of the actors in the tree for this node and all child nodes.
-
Constructor Details
-
Node
-
Node
public Node()Creates a node without an actor. An actor must be set usingsetActor(Actor)
before this node can be used.
-
-
Method Details
-
setExpanded
public void setExpanded(boolean expanded) -
add
-
addAll
-
insert
-
remove
public void remove()Remove this node from its parent. -
remove
Remove the specified child node from this node. Does nothing if the node is not a child of this node. -
clearChildren
public void clearChildren()Removes all children from this node. -
getTree
Returns the tree this node's actor is currently in, or null. The actor is only in the tree when all of its parent nodes are expanded. -
setActor
-
getActor
-
isExpanded
public boolean isExpanded() -
getChildren
If the children order is changed,updateChildren()
must be called to ensure the node's actors are in the correct order. That is not necessary if this node is not in the tree or is not expanded, because then the child node's actors are not in the tree. -
hasChildren
public boolean hasChildren() -
updateChildren
public void updateChildren()Updates the order of the actors in the tree for this node and all child nodes. This is useful after changing the order ofgetChildren()
.- See Also:
-
getParent
- Returns:
- May be null.
-
setIcon
Sets an icon that will be drawn to the left of the actor. -
getValue
-
setValue
Sets an application specific value for this node. -
getIcon
-
getLevel
public int getLevel() -
findNode
Returns this node or the child node with the specified value, or null. -
collapseAll
public void collapseAll()Collapses all nodes under and including this node. -
expandAll
public void expandAll()Expands all nodes under and including this node. -
expandTo
public void expandTo()Expands all parent nodes of this node. -
isSelectable
public boolean isSelectable() -
setSelectable
public void setSelectable(boolean selectable) -
findExpandedValues
-
restoreExpandedValues
-
getHeight
public float getHeight()Returns the height of the node as calculated for layout. A subclass may override and increase the returned height to create a blank space in the tree above the node, eg for a separator. -
isAscendantOf
Returns true if the specified node is this node or an ascendant of this node. -
isDescendantOf
Returns true if the specified node is this node or an descendant of this node.
-