TreeView
classin packageklyn.gui.windows
public class TreeView extends Widget
└ TreeView

Focusable tree widget backed by a TreeModel.

import klyn.gui.windows
import klyn.gui.windows.events

root = TreeNode("Database", "DB", "root")
root.add(TreeNode("Tables", "[]", "group"))
tree = TreeView(TreeModel(root))
tree.nodeActivated += lambda(event as TreeNodeEvent): print(event.node.text)
Properties
Modifier and Type Member Description
public property activateExpandableNodes
activateExpandableNodes as Boolean = false
Whether activation is emitted for nodes which also contain children.
public property emptyText
emptyText as String
Text centered in the content area when the model has no child node.
public property model
model as TreeModel
Tree model rendered by the widget.
public property rootVisible
rootVisible as Boolean
Whether the structural model root is rendered as a row.
public readonly property selectedNode
selectedNode as TreeNode
Currently selected node, or null when nothing is selected.
public property title
title as String = "Tree"
Header text painted above the tree rows.
Inherited Properties
propertyInherited Properties from Widget: accentColor, acceptFileDrops, backgroundColor, borderColor, bottom, canFocus, cornerRadius, cursor, font, foregroundColor, hasFocus, height, isEnabled, isHovered, isManaged, isPressed, isTabStop, isVisible, layoutParams, margin, maxHeight, maxWidth, minHeight, minWidth, parent, preferredHeight, preferredWidth, resolvedStyleCache, resolvedStyleCacheAppearanceMode, resolvedStyleCacheFont, resolvedStyleCacheRevision, resolvedStyleCacheStateKey, resolvedStyleCacheStyleClass, resolvedStyleCacheZoomRevision, right, size, sizePolicy, styleClass, toolTip, width, window, x, y
Events
Modifier and Type Member Description
public event nodeActivated
nodeActivated as TreeNodeEvent
Emitted when a node is activated by double-click or Enter.
public event nodeContextRequested
nodeContextRequested as TreeNodeContextEvent
Emitted when a node receives a secondary-click context request.
public event selectionChanged
selectionChanged as TreeNodeEvent
Emitted as soon as pointer or keyboard navigation selects another node.
Inherited Events
eventInherited Events from Widget: filesDropped, focusGained, focusLost, keyPressed, keyReleased, mouseMoved, mousePressed, mouseReleased, mouseWheel, paintRequested, resized
Constructors
Modifier and Type Member Description
public TreeView
TreeView(model as TreeModel = null)
Creates a tree view with an optional model.
Methods
Modifier and Type Member Description
public expandNode
expandNode(node as TreeNode, expanded as Boolean = true) as Boolean
Expands or collapses a node and refreshes the visible rows.
public override paint
paint(painter as Painter) as Void
No summary.
public refreshRows
refreshRows() as Void
Rebuilds the visible row cache after external code changed nodes.
public selectNode
selectNode(node as TreeNode) as Boolean
Selects a visible node and scrolls vertically to reveal it.
Inherited Methods
methodInherited Methods from Widget: applyThemeMetrics, blur, containsPoint, emitFilesDropped, emitFocusGained, emitFocusLost, emitKeyPressed, emitKeyReleased, emitMouseMoved, emitMousePressed, emitMouseReleased, emitMouseWheel, handleTabKey, notifyPaintRequested, paint, paintClipped, paintForeground, paintOverlay, preferredSizeIncludesContentZoom, repaint, requestFocus, resolvePreferredHeight, resolvePreferredWidth, resolvedFont, setBounds