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 |
clearChildren()
Removes all tree nodes.
|
void |
collapseAll() |
void |
draw(Batch 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. |
protected void |
drawBackground(Batch batch,
float parentAlpha)
Called to draw the background.
|
void |
expandAll() |
void |
findExpandedObjects(Array objects) |
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.
|
float |
getIndentSpacing()
Returns the amount of horizontal space for indentation level.
|
Tree.Node |
getNodeAt(float y) |
Array<Tree.Node> |
getNodes() |
Tree.Node |
getOverNode() |
java.lang.Object |
getOverObject() |
float |
getPrefHeight() |
float |
getPrefWidth() |
Array<Tree.Node> |
getRootNodes() |
Selection<Tree.Node> |
getSelection() |
Tree.TreeStyle |
getStyle() |
float |
getYSpacing() |
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() on any each child whose width or height has changed, and calls Layout.validate() on each
child. |
void |
remove(Tree.Node node) |
void |
restoreExpandedObjects(Array objects) |
void |
setIconSpacing(float left,
float right)
Sets the amount of horizontal space between the node actors and icons.
|
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 |
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, sizeChanged, validateact, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, computeTransform, debugAll, drawChildren, drawDebug, drawDebugChildren, findActor, getChildren, getCullingArea, hasChildren, hit, isTransform, localToDescendantCoordinates, removeActor, removeActor, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toStringaddAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontpublic 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() on 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(Batch 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.protected void drawBackground(Batch batch, float parentAlpha)
public Tree.Node getNodeAt(float y)
public Tree.TreeStyle getStyle()
public Tree.Node getOverNode()
public java.lang.Object getOverObject()
public void setOverNode(Tree.Node overNode)
overNode - May be null.public void setPadding(float padding)
public float getIndentSpacing()
public void setYSpacing(float ySpacing)
public float getYSpacing()
public void setIconSpacing(float left,
float right)
public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class WidgetGrouppublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class WidgetGrouppublic void findExpandedObjects(Array objects)
public void restoreExpandedObjects(Array objects)
public Tree.Node findNode(java.lang.Object object)
public void collapseAll()
public void expandAll()
public ClickListener getClickListener()