One node in a UITreeView model: a label, an ordered list of children, and an expanded flag. depth is derived by the tree during flattening; treat it as read-only.

Constructor

@:value({ expanded : false })new(label:String, ?children:Array<UITreeNode>, expanded:Bool = false)

Parameters:

label

the displayed text

children

optional child nodes

expanded

start expanded (default collapsed)

Variables

children:Array<UITreeNode>

Ordered child nodes (empty for a leaf).

@:value(null)data:Any = null

Optional user payload carried with the node.

@:value(0)depth:Int = 0

Depth from the roots (0 at top); set by the owning tree while flattening.

expanded:Bool

Whether this branch is expanded (ignored for leaves).

read onlyhasChildren:Bool

Whether this node has any children.

@:value(null)icons:Array<UIGlyph> = null

Optional small glyph badges drawn before the label (e.g. a pin or a lock).

label:String

The displayed text.

Methods

add(child:UITreeNode):UITreeNode

Appends a child and returns it (for fluent tree building).