Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: TreeItem

[12:7] extends: FxObj

Wraps JavaFX TreeItem, a single node in a TreeView hierarchy that holds a value and an optional set of child TreeItems. Items can be nested to any depth by calling add() with a child TreeItem or a list of them. Each item can carry an optional graphic node such as an icon. The setExpanded() method controls whether the item's children are visible in the tree by default.

Methods

  • TreeItem (Val = null)

    Creates a new TreeItem with an optional value.

    • @p Val is the item value, or null for an empty item.
  • add (Items)

    Adds child TreeItems.

    • @p Items is a TreeItem or a list of TreeItems.
    • @r this object for chaining
  • setExpanded (bool Expanded)

    Sets whether this item is expanded.

    • @p Expanded is a bool with true to expand.
    • @r this object for chaining
  • getValue ()

    Gets the item value.

    • @r The item value.
  • setValue (Val)

    Sets the item value.

    • @p Val is the value to set.
    • @r this object for chaining
  • getChildren ()

    Returns the list of child TreeItems belonging to this item.

    • @r A list with the child TreeItem objects.
  • getGraphic ()

    Gets the graphic node associated with this tree item.

    • @r A Node with the graphic, or null if none is set.
  • isExpanded ()

    Returns whether this tree item is currently expanded.

    • @r A bool with true if the item is expanded.
  • setGraphic (object Graphic)

    Sets a graphic (icon) for the tree item.

    • @p Graphic is a Node object.
    • @r this object for chaining
  • valueProperty ()

    Returns the ObjectProperty backing the value of this tree item.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • graphicProperty ()

    Returns the ObjectProperty backing the graphic node of this tree item.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • expandedProperty ()

    Returns the BooleanProperty backing whether this tree item is expanded.

    • @r An AJO wrapping javafx.beans.property.BooleanProperty.
  • isLeaf ()

    Returns whether this tree item is a leaf (has no children).

    • @r A bool; true when the item has no children.
  • leafProperty ()

    Returns the read-only BooleanProperty backing the leaf flag.

    • @r An AJO wrapping javafx.beans.property.ReadOnlyBooleanProperty.
  • getParent ()

    Returns the parent TreeItem of this item, or null when this is the root.

    • @r An AJO wrapping the parent javafx.scene.control.TreeItem, or null.
  • parentProperty ()

    Returns the read-only ObjectProperty backing the parent reference.

    • @r An AJO wrapping javafx.beans.property.ReadOnlyObjectProperty<TreeItem>.
  • previousSibling (object Anchor = null)

    Returns the previous sibling TreeItem. With no anchor this returns the sibling that immediately precedes this item. With an anchor it returns the sibling that precedes the given anchor TreeItem.

    • @p Anchor is an optional TreeItem used as the lookup anchor.
    • @r An AJO wrapping the previous sibling TreeItem, or null.
  • nextSibling (object Anchor = null)

    Returns the next sibling TreeItem. With no anchor this returns the sibling that immediately follows this item. With an anchor it returns the sibling that follows the given anchor TreeItem.

    • @p Anchor is an optional TreeItem used as the lookup anchor.
    • @r An AJO wrapping the next sibling TreeItem, or null.
  • buildEventDispatchChain (Chain)

    Appends this TreeItem onto the given event dispatch chain so events traverse from this item up through its ancestors.

    • @p Chain is an AJO wrapping a javafx.event.EventDispatchChain.
    • @r An AJO wrapping the augmented javafx.event.EventDispatchChain.