Package arc.scene.ui
Class TreeElement
java.lang.Object
arc.scene.Element
arc.scene.Group
arc.scene.ui.layout.WidgetGroup
arc.scene.ui.TreeElement
- All Implemented Interfaces:
Cullable
A tree widget where each node has an icon, element, and child nodes.
The preferred size of the tree is determined by the preferred size of the elements for the expanded nodes.
ChangeListener.ChangeEvent
is fired when the selected node changes.
-
Nested Class Summary
-
Field Summary
Fields inherited from class arc.scene.Group
children, cullingArea, transform
Fields inherited from class arc.scene.Element
color, cullable, fillParent, height, name, originX, originY, parent, parentAlpha, rotation, scaleX, scaleY, touchable, touchablility, translation, userObject, visibility, visible, width, x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Removes all tree nodes.void
void
draw()
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.protected void
Called to draw the background.void
void
findExpandedObjects
(Seq objects) Returns the node with the specified object, or null.Returns the click listener the tree uses for clicking on nodes and the over node.float
Returns the amount of horizontal space for indentation level.getNodeAt
(float y) getNodes()
float
float
getStyle()
float
void
insert
(int index, TreeElement.TreeElementNode node) void
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.validate()
is called.void
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child.void
void
restoreExpandedObjects
(Seq objects) void
setIconSpacing
(float left, float right) Sets the amount of horizontal space between the node elements and icons.void
setOverNode
(TreeElement.TreeElementNode overNode) void
setPadding
(float padding) Sets the amount of horizontal space between the nodes and the left/right edges of the tree.void
setStyle
(TreeElement.TreeStyle style) void
setYSpacing
(float ySpacing) Sets the amount of vertical space between nodes.Methods inherited from class arc.scene.ui.layout.WidgetGroup
childrenChanged, getMinHeight, getMinWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
Methods inherited from class arc.scene.Group
act, addChild, addChildAfter, addChildAt, addChildBefore, applyTransform, clear, computeTransform, drawChildren, fill, fill, fill, find, find, findVisible, forEach, getChildren, getCullingArea, hasChildren, hit, isTransform, localToDescendantCoordinates, removeChild, removeChild, resetTransform, setCullingArea, setScene, setTransform, swapActor, swapActor, toString
Methods inherited from class arc.scene.Element
actions, addAction, addCaptureListener, addListener, change, changed, clearActions, clearListeners, clicked, clicked, clicked, clicked, clipBegin, clipBegin, clipEnd, dragged, exited, fire, fireClick, getActions, getCaptureListeners, getHeight, getListeners, getMaxHeight, getMaxWidth, getRight, getRotation, getScene, getTop, getWidth, getX, getY, getZIndex, hasActions, hasKeyboard, hasMouse, hasParent, hasScroll, hovered, isAscendantOf, isDescendantOf, isDescendantOf, isTouchable, keepInStage, keyDown, keyDown, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, released, remove, removeAction, removeCaptureListener, removeListener, requestKeyboard, requestScroll, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, scrolled, setBounds, setColor, setColor, setHeight, setOrigin, setOrigin, setPosition, setPosition, setRotation, setRotationOrigin, setScale, setScale, setSize, setSize, setTranslation, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, tapped, toBack, toFront, touchable, update, updateVisibility, visible
-
Constructor Details
-
TreeElement
public TreeElement() -
TreeElement
-
-
Method Details
-
add
-
insert
-
remove
-
clearChildren
public void clearChildren()Removes all tree nodes.- Overrides:
clearChildren
in classGroup
-
getNodes
-
invalidate
public void invalidate()Description copied from class:Element
Invalidates this actor's layout, causingElement.layout()
to happen the next timeElement.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).- Overrides:
invalidate
in classWidgetGroup
-
layout
public void layout()Description copied from class:Element
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, callsElement.invalidate()
on any each child whose width or height has changed, and callsElement.validate()
on each child. This method should almost never be called directly, insteadElement.validate()
should be used.- Overrides:
layout
in classWidgetGroup
-
draw
public void draw()Description copied from class:WidgetGroup
If this method is overridden, the super method orWidgetGroup.validate()
should be called to ensure the widget group is laid out.- Overrides:
draw
in classWidgetGroup
-
drawBackground
protected void drawBackground()Called to draw the background. Default implementation draws the style background drawable. -
getNodeAt
- Returns:
- May be null.
-
getSelection
-
getStyle
-
setStyle
-
getRootNodes
-
getOverNode
- Returns:
- May be null.
-
setOverNode
- Parameters:
overNode
- May be null.
-
getOverObject
- Returns:
- May be null.
-
setPadding
public void setPadding(float padding) Sets the amount of horizontal space between the nodes and the left/right edges of the tree. -
getIndentSpacing
public float getIndentSpacing()Returns the amount of horizontal space for indentation level. -
getYSpacing
public float getYSpacing() -
setYSpacing
public void setYSpacing(float ySpacing) Sets the amount of vertical space between nodes. -
setIconSpacing
public void setIconSpacing(float left, float right) Sets the amount of horizontal space between the node elements and icons. -
getPrefWidth
public float getPrefWidth()- Overrides:
getPrefWidth
in classWidgetGroup
-
getPrefHeight
public float getPrefHeight()- Overrides:
getPrefHeight
in classWidgetGroup
-
findExpandedObjects
-
restoreExpandedObjects
-
findNode
Returns the node with the specified object, or null. -
collapseAll
public void collapseAll() -
expandAll
public void expandAll() -
getClickListener
Returns the click listener the tree uses for clicking on nodes and the over node.
-