core/treeview/node.go
Functions
func IsLeaf
func (n *TreeNode) IsLeaf() bool {
return len(n.Children) == 0
}
func String
String returns a human-readable name for the selection mode.
func (m SelectionMode) String() string {
switch m {
case SelectionNone:
return "None"
case SelectionSingle:
return "Single"
default:
return "Unknown"
}
}
Structs
type TreeNode struct
TreeNode represents a node in the hierarchical tree.
Each node has a unique ID, a display label, optional children, and an
Expanded flag controlling child visibility. The Data field carries
arbitrary user payloads.
Nodes form a tree: a node with non-nil Children is a branch node;
one with nil or empty Children is a leaf.
type TreeNode struct {
// ID uniquely identifies this node within the tree.
// Must be unique across all nodes.
ID string
// Label is the display text for this node.
Label string
// Children are this node's child nodes. Nil or empty means leaf.
Children []*TreeNode
// Expanded controls whether this node's children are visible.
// Only meaningful for branch nodes (len(Children) > 0).
Expanded bool
// Data carries an arbitrary user payload.
Data interface{}
}
IsLeaf reports whether this node has no children.