public class Tree extends WidgetGroup
The preferred size of the tree is determined by the preferred size of the actors for the expanded nodes.
ChangeListener.ChangeEvent is fired when the selected node changes.
| Modifier and Type | Class and Description |
|---|---|
static class |
Tree.Node |
static class |
Tree.TreeStyle
The style for a
Tree. |
| Constructor and Description |
|---|
Tree(Skin skin) |
Tree(Skin skin,
java.lang.String styleName) |
Tree(Tree.TreeStyle style) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Tree.Node node) |
void |
addSelection(Tree.Node node) |
void |
clearChildren()
Removes all tree nodes.
|
void |
clearSelection() |
void |
collapseAll() |
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or
WidgetGroup.validate() should be called to ensure the widget group is laid
out. |
void |
expandAll() |
Tree.Node |
findNode(java.lang.Object object)
Returns the node with the specified object, or null.
|
ClickListener |
getClickListener()
Returns the click listener the tree uses for clicking on nodes and the over node.
|
Tree.Node |
getNodeAt(float y) |
Array<Tree.Node> |
getNodes() |
Tree.Node |
getOverNode() |
float |
getPrefHeight() |
float |
getPrefWidth() |
Array<Tree.Node> |
getRootNodes() |
Array<Tree.Node> |
getSelection() |
Tree.TreeStyle |
getStyle() |
void |
insert(int index,
Tree.Node node) |
void |
invalidate()
Invalidates this actor's layout, causing
Layout.layout() to happen the next time Layout.validate() is called. |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls
Layout.invalidate() any each child whose width or height has changed, and calls Layout.validate() on each child. |
void |
remove(Tree.Node node) |
void |
setIconSpacing(float iconSpacing)
Sets the amount of horizontal space between the node actors and icons.
|
void |
setMultiSelect(boolean multiSelect) |
void |
setOverNode(Tree.Node overNode) |
void |
setPadding(float padding)
Sets the amount of horizontal space between the nodes and the left/right edges of the tree.
|
void |
setSelection(Array<Tree.Node> nodes) |
void |
setSelection(Tree.Node node) |
void |
setStyle(Tree.TreeStyle style) |
void |
setYSpacing(float ySpacing)
Sets the amount of vertical space between nodes.
|
childrenChanged, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validateact, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, clear, computeTransform, drawChildren, findActor, getChildren, hit, isTransform, localToDescendantCoordinates, removeActor, resetTransform, setCullingArea, setStage, setTransform, swapActor, swapActoraddAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getWidth, getX, getY, getZIndex, hasParent, isAscendantOf, isDescendantOf, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotate, scale, scale, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setParent, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translatepublic Tree(Skin skin)
public Tree(Skin skin, java.lang.String styleName)
public Tree(Tree.TreeStyle style)
public void setStyle(Tree.TreeStyle style)
public void add(Tree.Node node)
public void insert(int index,
Tree.Node node)
public void remove(Tree.Node node)
public void clearChildren()
clearChildren in class Grouppublic void invalidate()
LayoutLayout.layout() to happen the next time Layout.validate() is called. This
method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred,
maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).invalidate in interface Layoutinvalidate in class WidgetGrouppublic void layout()
LayoutLayout.invalidate() any each child whose width or height has changed, and calls Layout.validate() on each child.
This method should almost never be called directly, instead Layout.validate() should be used.layout in interface Layoutlayout in class WidgetGrouppublic void draw(SpriteBatch batch, float parentAlpha)
WidgetGroupWidgetGroup.validate() should be called to ensure the widget group is laid
out.draw in class WidgetGroupparentAlpha - Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.public Tree.Node getNodeAt(float y)
public void setSelection(Tree.Node node)
public void addSelection(Tree.Node node)
public void clearSelection()
public Tree.TreeStyle getStyle()
public Tree.Node getOverNode()
public void setOverNode(Tree.Node overNode)
public void setPadding(float padding)
public void setYSpacing(float ySpacing)
public void setIconSpacing(float iconSpacing)
public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class WidgetGrouppublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class WidgetGrouppublic Tree.Node findNode(java.lang.Object object)
public void collapseAll()
public void expandAll()
public ClickListener getClickListener()
public void setMultiSelect(boolean multiSelect)