|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.scenes.scene2d.Actor com.badlogic.gdx.scenes.scene2d.Group com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup com.badlogic.gdx.scenes.scene2d.ui.Tree
public class Tree
A tree widget where each node has an icon, actor, and child nodes.
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.
Nested Class Summary | |
---|---|
static class |
Tree.Node
|
static class |
Tree.TreeStyle
The style for a Tree . |
Constructor Summary | |
---|---|
Tree(Skin skin)
|
|
Tree(Skin skin,
String styleName)
|
|
Tree(Tree.TreeStyle style)
|
Method Summary | |
---|---|
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()
|
void |
findExpandedObjects(Array objects)
|
Tree.Node |
findNode(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 |
restoreExpandedObjects(Array objects)
|
void |
setIconSpacing(float left,
float right)
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 |
setToggleSelect(boolean toggleSelect)
|
void |
setYSpacing(float ySpacing)
Sets the amount of vertical space between nodes. |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup |
---|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, clear, findActor, getChildren, hasChildren, hit, isTransform, localToDescendantCoordinates, print, removeActor, setCullingArea, setTransform, swapActor, swapActor |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
addAction, 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, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree(Skin skin)
public Tree(Skin skin, String styleName)
public Tree(Tree.TreeStyle style)
Method Detail |
---|
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 Group
public Array<Tree.Node> getNodes()
public void invalidate()
Layout
Layout.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 Layout
invalidate
in class WidgetGroup
public void layout()
Layout
Layout.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 Layout
layout
in class WidgetGroup
public void draw(SpriteBatch batch, float parentAlpha)
WidgetGroup
WidgetGroup.validate()
should be called to ensure the widget group is laid
out.
draw
in class WidgetGroup
parentAlpha
- Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.public Tree.Node getNodeAt(float y)
public Array<Tree.Node> getSelection()
public void setSelection(Tree.Node node)
public void setSelection(Array<Tree.Node> nodes)
public void addSelection(Tree.Node node)
public void clearSelection()
public Tree.TreeStyle getStyle()
public Array<Tree.Node> getRootNodes()
public Tree.Node getOverNode()
public void setOverNode(Tree.Node overNode)
public void setPadding(float padding)
public void setYSpacing(float ySpacing)
public void setIconSpacing(float left, float right)
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class WidgetGroup
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class WidgetGroup
public void findExpandedObjects(Array objects)
public void restoreExpandedObjects(Array objects)
public Tree.Node findNode(Object object)
public void collapseAll()
public void expandAll()
public ClickListener getClickListener()
public void setMultiSelect(boolean multiSelect)
public void setToggleSelect(boolean toggleSelect)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |