Skip to content
ConsoleMonster
Class

RecordView

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

One record (or a few) as a readable sheet: a summary header line, sections and groups, aligned label/value fields that hide when empty, and nested widgets such as tables. It is the console counterpart of a record drawer, the fallback a table uses for a single row, the layout of record cards, and the view of the object inspector.

Inheritance

  • object
  • RecordView

Usage

Explore 33 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 12

Constructors

public RecordView(string? title = null) #

Creates a record view.

Parameters

title string? = null optional
The title (markup) shown on the summary header line, or null.

Methods

Field 2 overloads
public RecordView Field(string label, object? value, ICellPresenter? presenter = null, IReadOnlyList<RoleRule>? rules = null) #

Adds a field with a raw value, formatted by a presenter.

Parameters

label string required
The label (plain text).
value object? required
The value.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optional
The presenter, or null for automatic.
rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.RoleRule>? = null optional
Role rules, or null.

Returns

RecordView This instance.
public RecordView Field(string label, TableCell cell, ICellPresenter? presenter = null, IReadOnlyList<RoleRule>? rules = null) #

Adds a field with a cell (markup, status or raw value).

Parameters

label string required
The label (plain text).
cell ConsoleMonster.Widgets.TableCell required
The cell.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optional
The presenter for raw values, or null for automatic.
rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.RoleRule>? = null optional
Role rules, or null.

Returns

RecordView This instance.
public RecordView FieldAt(int level, string label, TableCell cell, ICellPresenter? presenter = null) #

Adds a field at an explicit level (used by the object inspector for nested members).

Parameters

level int required
The level.
label string required
The label.
cell ConsoleMonster.Widgets.TableCell required
The cell.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optional
The presenter, or null.

Returns

RecordView This instance.
public RecordView Field<T>(string label, T? value, ICellPresenter? presenter = null, IReadOnlyList<RoleRule>? rules = null) #

Adds a strongly typed raw value, preserving literal strings instead of implicitly converting them to markup cells.

Type Parameters

T
The value type.

Parameters

label string required
The label (plain text).
value T? required
The raw value.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optional
The presenter, or null for automatic.
rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.RoleRule>? = null optional
Role rules, or null.

Returns

RecordView This instance.
public RecordView Group(string title, string? note = null) #

Adds a group heading under the current section; following fields belong to it.

Parameters

title string required
The heading (markup).
note string? = null optional
An optional muted note, or null.

Returns

RecordView This instance.
public RecordView Heading(string title, int level, ThemeToken? role = null, string? note = null) #

Adds a heading at a nesting level (0 = section, 1 = group, deeper for nested objects).

Parameters

title string required
The heading (markup).
level int required
The level.
role ConsoleMonster.Styling.ThemeToken? = null optional
An optional tone, or null.
note string? = null optional
An optional muted note, or null.

Returns

RecordView This instance.
public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public void Render(Region region, RenderContext context) #

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.
public RecordView Section(string title, ThemeToken? role = null, string? note = null) #

Adds a top-level section heading; following fields belong to it.

Parameters

title string required
The heading (markup).
role ConsoleMonster.Styling.ThemeToken? = null optional
An optional tone (for example the record's status), or null.
note string? = null optional
An optional muted note after the heading, or null.

Returns

RecordView This instance.
public RecordView Widget(IWidget widget) #

Adds a nested widget (a table, a list) under the current heading.

Parameters

widget ConsoleMonster.Layout.IWidget required
The widget.

Returns

RecordView This instance.
public RecordView WidgetAt(int level, IWidget widget) #

Adds a nested widget at an explicit level.

Parameters

level int required
The level.
widget ConsoleMonster.Layout.IWidget required
The widget.

Returns

RecordView This instance.

Properties

public IReadOnlyList<IWidget> Children { get; } #

Embedded widgets, including value fields, for live discovery and recording replay.

public string? Title { get; set; } #

The title (markup) on the summary header line, or null.

public string? Summary { get; set; } #

A muted summary after the title (12 targets · 4 failing), or null.

public bool HideEmpty { get; set; } #

Whether null, empty and missing values are left out (default true).

public int IndentWidth { get; set; } #

Cells each nesting level indents (default 2).

public double MaxLabelFraction { get; set; } #

The widest a label column may be, as a fraction of the width (default 0.4).

public PresentationOptions Presentation { get; set; } #

Culture, clock and time zone for raw values.

public IReadOnlyList<RecordItem> Items { get; } #

The items in order.

Extension Methods

public static RecordView HideEmpty(RecordView recordView, bool value = true) #

Sets RecordView.HideEmpty: Whether null, empty and missing values are left out (default true).

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value bool = true optional
The value; true when omitted.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Widgets.RecordView { HideEmpty = value };    recordView.HideEmpty(value);
public static RecordView IndentWidth(RecordView recordView, int value) #

Sets RecordView.IndentWidth: Cells each nesting level indents (default 2).

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value int required
The value.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Widgets.RecordView { IndentWidth = value };    recordView.IndentWidth(value);
public static RecordView MaxLabelFraction(RecordView recordView, double value) #

Sets RecordView.MaxLabelFraction: The widest a label column may be, as a fraction of the width (default 0.4).

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value double required
The value.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                                  // C# fluent
new global::ConsoleMonster.Widgets.RecordView { MaxLabelFraction = value };    recordView.MaxLabelFraction(value);
Presentation 2 overloads
public static RecordView Presentation(RecordView recordView, PresentationOptions value) #

Sets RecordView.Presentation: Culture, clock and time zone for raw values.

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value ConsoleMonster.Presenters.PresentationOptions required
The value.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                              // C# fluent
new global::ConsoleMonster.Widgets.RecordView { Presentation = value };    recordView.Presentation(value);
public static RecordView Presentation(RecordView recordView, Action<PresentationOptions> configure) #

Configures RecordView.Presentation in place (creating it when not set): Culture, clock and time zone for raw values.

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
configure System.Action<ConsoleMonster.Presenters.PresentationOptions> required
Configures the value.

Returns

RecordView The same instance.
public static RecordView Summary(RecordView recordView, string? value) #

Sets RecordView.Summary: A muted summary after the title (12 targets · 4 failing), or null.

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value string? required
The value.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Widgets.RecordView { Summary = value };    recordView.Summary(value);
public static RecordView Title(RecordView recordView, string? value) #

Sets RecordView.Title: The title (markup) on the summary header line, or null.

Parameters

recordView ConsoleMonster.Widgets.RecordView required
The instance.
value string? required
The value.

Returns

RecordView The same instance.

Examples

// C# initializer or property                                       // C# fluent
new global::ConsoleMonster.Widgets.RecordView { Title = value };    recordView.Title(value);