Interface TreeModel

The tree - an abstract data type.

interface TreeModel {
    onChanged: Event<void>;
    onDidChangeBusy: Event<TreeNode>;
    onDidUpdate: Event<TreeNode[]>;
    onExpansionChanged: Event<Readonly<ExpandableTreeNode>>;
    onNodeRefreshed: Event<Readonly<CompositeTreeNode> & WaitUntilEvent>;
    onOpenNode: Event<Readonly<TreeNode>>;
    onSelectionChanged: Event<readonly Readonly<SelectableTreeNode>[]>;
    root: undefined | TreeNode;
    selectedNodes: readonly Readonly<SelectableTreeNode>[];
    addSelection(selectionOrTreeNode): void;
    canNavigateBackward(): boolean;
    canNavigateForward(): boolean;
    clearSelection(): void;
    collapseAll(node?): Promise<boolean>;
    collapseNode(node?): Promise<boolean>;
    dispose(): void;
    expandNode(node?): Promise<undefined | Readonly<ExpandableTreeNode>>;
    getFocusedNode(): undefined | SelectableTreeNode;
    getNextNode(node?): undefined | TreeNode;
    getNextSelectableNode(node?): undefined | SelectableTreeNode;
    getNode(id): undefined | TreeNode;
    getPrevNode(node?): undefined | TreeNode;
    getPrevSelectableNode(node?): undefined | SelectableTreeNode;
    markAsBusy(node, ms, token): Promise<void>;
    markAsChecked(node, checked): void;
    navigateBackward(): Promise<void>;
    navigateForward(): Promise<void>;
    navigateTo(nodeOrId): Promise<undefined | TreeNode>;
    openNode(node?): void;
    refresh(): Promise<undefined | Readonly<CompositeTreeNode>>;
    refresh(parent): Promise<undefined | Readonly<CompositeTreeNode>>;
    restoreState(state): void;
    selectNext(): void;
    selectNextNode(type?): void;
    selectNode(node): void;
    selectParent(): void;
    selectPrev(): void;
    selectPrevNode(type?): void;
    selectRange(node): void;
    storeState(): object;
    toggleNode(node): void;
    toggleNodeExpansion(node?): Promise<void>;
    validateNode(node): undefined | TreeNode;
}

Hierarchy (view full)

Implemented by

Properties

onChanged: Event<void>

Emit when the tree is changed.

onDidChangeBusy: Event<TreeNode>

Emits when the busy state of the given node is changed.

onDidUpdate: Event<TreeNode[]>

An update to the tree node occurred, but the tree structure remains unchanged

onExpansionChanged: Event<Readonly<ExpandableTreeNode>>

Emit when the node is expanded or collapsed.

onNodeRefreshed: Event<Readonly<CompositeTreeNode> & WaitUntilEvent>

Emit when the children of the given node are refreshed.

onOpenNode: Event<Readonly<TreeNode>>

Event when a node should be opened.

onSelectionChanged: Event<readonly Readonly<SelectableTreeNode>[]>

Emitted when the selection has changed in the tree.

root: undefined | TreeNode

A root node of this tree. Undefined if there is no root node. Setting a root node refreshes the tree.

selectedNodes: readonly Readonly<SelectableTreeNode>[]

The tree selection, representing the selected nodes from the tree. If nothing is selected, the result will be empty.

Methods

  • Navigates to the given node if it is defined. This method accepts both the tree node and its ID as an argument. Navigation sets a node as a root node and expand it. Resolves to the node if the navigation was successful. Otherwise, resolves to undefined.

    Parameters

    • nodeOrId: undefined | string | Readonly<TreeNode>

    Returns Promise<undefined | TreeNode>

  • Opens the given node or the currently selected on if the argument is undefined. If multiple nodes are selected, open the most recently selected node.

    Parameters

    Returns void

  • Selects a range of tree nodes. The target of the selection range is the argument, the from tree node is the previous selected node. If no node was selected previously, invoking this method does nothing.

    Parameters

    Returns void