Represents a node in a tree structure.

表示树结构中的一个节点。

构造函数

属性

data: any

The data associated with this tree node.

与此树节点关联的数据。

onExpanded?: ((expand: boolean) => void)

The function called when the node is expanded or collapsed.

当节点被展开或折叠时调用的函数。

访问器

方法

  • 参数

    • child: GTreeNode

      The child node to add.

    • index: number

      The index at which to add the child node. If the index is equal to the number of children, the child will be added at the end.

    返回 GTreeNode

    The added child node.

    Add a child node at a specific index.

    在特定索引处添加一个子节点。

  • 参数

    • 可选tree: GTree

      If the tree node is not yet part of a tree, you can pass the tree instance to create the widget.

    返回 void

    Create a widget for this tree node.

    为此树节点创建一个小部件。

  • 返回 void

    Expand this tree node and all its parent nodes up to the root.

    展开此树节点及其所有父节点直到根节点。

  • 参数

    • child: GTreeNode

      The child node to find the index of.

    返回 number

    The index of the specified child node, or -1 if not found.

    Get the index of a specific child node.

  • 返回 GTreeNode

    The last visible descendant node, or null if there are no visible descendants.

    Get the last visible descendant node of this tree node.

    获取此树节点的最后一个可见子孙节点。

  • 参数

    • index: number

      The index of the child node to remove.

    返回 GTreeNode

    The removed child node.

    Remove a child node at a specific index.

    从此树节点中移除指定索引处的子节点。

  • 参数

    • 可选beginIndex: number

      The starting index of the range to remove. Defaults to 0

    • 可选endIndex: number

      The ending index of the range to remove. If not provided, it will remove all children from the beginning index to the end of the list.

    返回 void

    Remove a range of children from this tree node.

    从此树节点中移除一系列子节点。

  • 参数

    • child: GTreeNode

      The child node whose index is to be set.

    • index: number

      The new index for the child node. If the index is less than 0, it will be set to 0; if greater than the number of children, it will be set to the number of children.

    返回 void

    Set the index of a child node within this tree node.

    设置此树节点中子节点的索引。

  • 参数

    • child1: GTreeNode

      The first child node to swap.

    • child2: GTreeNode

      The second child node to swap.

    返回 void

    Swap the positions of two child nodes within this tree node.

    在此树节点中交换两个子节点的位置。

  • 参数

    • index1: number

      The index of the first child node to swap.

    • index2: number

      The index of the second child node to swap.

    返回 void

    Swap the positions of two child nodes at specific indices within this tree node.

    在此树节点中交换两个子节点在特定索引处的位置。