Skip to content
ConsoleMonster
Class

TreeNode

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

A node of a Tree: a label (markup), an optional status and children.

Inheritance

  • object
  • TreeNode

Usage

Explore 72 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 37

Constructors

public TreeNode(string label, StatusKind? status = null) #

Creates a node.

Parameters

label string required
The label (markup).
status ConsoleMonster.Styling.StatusKind? = null optional
An optional status marker.

Methods

Add 3 overloads
public TreeNode Add(string label, StatusKind? status = null, string? detail = null) #

Adds a child and returns it.

Parameters

label string required
The label (markup).
status ConsoleMonster.Styling.StatusKind? = null optional
An optional status.
detail string? = null optional
An optional muted detail.

Returns

TreeNode The new child.
public TreeNode Add(RichText label, StatusKind? status = null, string? detail = null) #

Adds a child with a multicolour label.

Parameters

label ConsoleMonster.Text.RichText required
The label.
status ConsoleMonster.Styling.StatusKind? = null optional
An optional status.
detail string? = null optional
An optional muted detail.

Returns

TreeNode The new child.
public TreeNode Add(TreeNode node) #

Adds an existing node as a child.

Parameters

node ConsoleMonster.Widgets.TreeNode required
The node.

Returns

TreeNode This node.

Properties

public string Label { get; set; } #

The label (markup).

public StatusKind? Status { get; set; } #

An optional status marker shown before the label.

public string? Marker { get; set; } #

An optional plain text glyph replacing the status glyph, without changing the node's status tone.

public string? BasicMarker { get; set; } #

An optional glyph used only in the Basic tier; null retains TreeNode.Marker.

public string? AsciiMarker { get; set; } #

The ASCII alternative to TreeNode.Marker; null uses that marker unchanged.

public Tone MarkerTone { get; set; } #

An optional theme tone for the marker, independent of status semantics. Null preserves the status or text tone.

public bool Bare { get; set; } #

Render a container without a guide and exclude its label from value-column sizing.

public bool MeasureBareLabel { get; set; } #

Include a bare node with values when sizing after-label value columns.

public bool TruncateLabelInMiddle { get; set; } #

Use a middle ellipsis for this identity label, independently of sibling prose labels.

public string? Detail { get; set; } #

A muted detail shown after the label (counts, values), or null.

public TableCell? Value { get; set; } #

A value shown after the label through TreeNode.Presenter (dates, sizes, statuses...), or null.

public ICellPresenter? Presenter { get; set; } #

The presenter for TreeNode.Value, or null for automatic.

public IDictionary<string, TableCell> Values { get; } #

Values keyed by TableColumn.Id for the tree's aligned value columns.

public object? Identity { get; set; } #

An optional stable identity for cycle and repeated-node detection; null uses node reference identity.

public TreeReferenceKind Reference { get; set; } #

Explicit reference and completeness markers. Cycle, repeat and collapse markers stop traversal.

public string? ReferenceSummary { get; set; } #

An optional plain text aggregate or reference detail shown with the marker.

public IReadOnlyList<TreeNode> Children { get; } #

The children.

Extension Methods

public static TreeNode AsciiMarker(TreeNode treeNode, string? value) #

Sets TreeNode.AsciiMarker: The ASCII alternative to TreeNode.Marker; null uses that marker unchanged.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.AsciiMarker = value;    treeNode.AsciiMarker(value);
public static TreeNode Bare(TreeNode treeNode, bool value = true) #

Sets TreeNode.Bare: Render a container without a guide and exclude its label from value-column sizing.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Bare = value;           treeNode.Bare(value);
public static TreeNode BasicMarker(TreeNode treeNode, string? value) #

Sets TreeNode.BasicMarker: An optional glyph used only in the Basic tier; null retains TreeNode.Marker.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.BasicMarker = value;    treeNode.BasicMarker(value);
public static TreeNode Detail(TreeNode treeNode, string? value) #

Sets TreeNode.Detail: A muted detail shown after the label (counts, values), or null.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Detail = value;         treeNode.Detail(value);
public static TreeNode Identity(TreeNode treeNode, object? value) #

Sets TreeNode.Identity: An optional stable identity for cycle and repeated-node detection; null uses node reference identity.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value object? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Identity = value;       treeNode.Identity(value);
public static TreeNode Label(TreeNode treeNode, string value) #

Sets TreeNode.Label: The label (markup).

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Label = value;          treeNode.Label(value);
public static TreeNode Marker(TreeNode treeNode, string? value) #

Sets TreeNode.Marker: An optional plain text glyph replacing the status glyph, without changing the node's status tone.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Marker = value;         treeNode.Marker(value);
public static TreeNode MarkerTone(TreeNode treeNode, Tone value) #

Sets TreeNode.MarkerTone: An optional theme tone for the marker, independent of status semantics. Null preserves the status or text tone.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value ConsoleMonster.Tone required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.MarkerTone = value;     treeNode.MarkerTone(value);
public static TreeNode MeasureBareLabel(TreeNode treeNode, bool value = true) #

Sets TreeNode.MeasureBareLabel: Include a bare node with values when sizing after-label value columns.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TreeNode The same instance.

Examples

// C# initializer or property         // C# fluent
treeNode.MeasureBareLabel = value;    treeNode.MeasureBareLabel(value);
public static TreeNode Presenter(TreeNode treeNode, ICellPresenter? value) #

Sets TreeNode.Presenter: The presenter for TreeNode.Value, or null for automatic.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value ConsoleMonster.Presenters.ICellPresenter? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Presenter = value;      treeNode.Presenter(value);
public static TreeNode Reference(TreeNode treeNode, TreeReferenceKind value) #

Sets TreeNode.Reference: Explicit reference and completeness markers. Cycle, repeat and collapse markers stop traversal.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value ConsoleMonster.Widgets.TreeReferenceKind required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Reference = value;      treeNode.Reference(value);
public static TreeNode ReferenceSummary(TreeNode treeNode, string? value) #

Sets TreeNode.ReferenceSummary: An optional plain text aggregate or reference detail shown with the marker.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value string? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property         // C# fluent
treeNode.ReferenceSummary = value;    treeNode.ReferenceSummary(value);
public static TreeNode Status(TreeNode treeNode, StatusKind? value) #

Sets TreeNode.Status: An optional status marker shown before the label.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value ConsoleMonster.Styling.StatusKind? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Status = value;         treeNode.Status(value);
public static TreeNode TruncateLabelInMiddle(TreeNode treeNode, bool value = true) #

Sets TreeNode.TruncateLabelInMiddle: Use a middle ellipsis for this identity label, independently of sibling prose labels.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TreeNode The same instance.

Examples

// C# initializer or property              // C# fluent
treeNode.TruncateLabelInMiddle = value;    treeNode.TruncateLabelInMiddle(value);
public static TreeNode Value(TreeNode treeNode, TableCell? value) #

Sets TreeNode.Value: A value shown after the label through TreeNode.Presenter (dates, sizes, statuses...), or null.

Parameters

treeNode ConsoleMonster.Widgets.TreeNode required
The instance.
value ConsoleMonster.Widgets.TableCell? required
The value.

Returns

TreeNode The same instance.

Examples

// C# initializer or property    // C# fluent
treeNode.Value = value;          treeNode.Value(value);