Interface: NVEFileTreeNode
Represents a node in the NVEFileTree hierarchy.
This class is not meant to be constructed directly. Instead, access instances via the NVEFileTree.tree getter, which provides the root nodes for the file tree structure.
Each node wraps a file or directory entry (real or virtual) and provides access to its children, selection state, and folding/collapsing state for use in UI components or programmatic traversal.
Remarks
- Use NVEFileTree.tree to obtain root nodes.
- The
direntproperty provides the underlying file or directory entry. - The
childrenproperty provides child nodes if the entry is a directory. - The
folded,collapsable, andselectedproperties manage UI state for tree views.
Example
const fs = new NVEFileSystem();
const tree = fs.asTree;
const rootNodes = tree.tree;
rootNodes.forEach((node) => {
console.log(node.dirent.name);
if (node.children) {
node.children.forEach((child) => console.log(child.dirent.name));
}
});Accessors
children
Get Signature
get children(): NVEFileTreeNode[] | undefined;The child nodes of this directory, if any. Returns undefined if not a directory.
Returns
NVEFileTreeNode[] | undefined
collapsable
Get Signature
get collapsable(): boolean;Whether this node is collapsable (i.e., a directory with 1 or fewer children).
Returns
boolean
depth
Get Signature
get depth(): number;The depth of this node in the file tree hierarchy.
The root node has a depth of 0, its children have a depth of 1, and so on.
Returns
number
dirent
Get Signature
get dirent(): NVEDirent | NVEVirtualDirent;The underlying file or directory entry for this node.
Returns
folded
Get Signature
get folded(): boolean;Whether this node is currently folded (collapsed) in the UI.
Returns
boolean
Set Signature
set folded(value: boolean): void;Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
void
selected
Get Signature
get selected(): boolean;Whether this node is currently selected in the UI.
Returns
boolean
Set Signature
set selected(value: boolean): void;Parameters
| Parameter | Type |
|---|---|
value | boolean |
Returns
void
Methods
deselect()
deselect(): void;Returns
void
fold()
fold(): void;Returns
void
select()
select(): void;Returns
void
toggleFold()
toggleFold(): void;Returns
void
toggleSelect()
toggleSelect(): void;Returns
void
unfold()
unfold(): void;Returns
void