Skip to content
ConsoleMonster

API Reference

Class

RecordView

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Implements
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 31 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 System.String? = null optionalposition: 0
The title (markup) shown on the summary header line, or null.

Methods

AddField 2 overloads
public RecordView AddField(String label, Object? value, ICellPresenter? presenter = null, IReadOnlyList<ToneRule>? rules = null) #
Returns: RecordView

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

Parameters

label System.String requiredposition: 0
The label (plain text).
value System.Object? requiredposition: 1
The value.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optionalposition: 2
The presenter, or null for automatic.
rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.ToneRule>? = null optionalposition: 3
Tone rules, or null.

Returns

This instance.

public RecordView AddField(String label, TableCell cell, ICellPresenter? presenter = null, IReadOnlyList<ToneRule>? rules = null) #
Returns: RecordView

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

Parameters

label System.String requiredposition: 0
The label (plain text).
cell ConsoleMonster.Widgets.TableCell requiredposition: 1
The cell.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optionalposition: 2
The presenter for raw values, or null for automatic.
rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.ToneRule>? = null optionalposition: 3
Tone rules, or null.

Returns

This instance.

public RecordView AddFieldAt(Int32 level, String label, TableCell cell, ICellPresenter? presenter = null) #
Returns: RecordView

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

Parameters

level System.Int32 requiredposition: 0
The level.
label System.String requiredposition: 1
The label.
cell ConsoleMonster.Widgets.TableCell requiredposition: 2
The cell.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optionalposition: 3
The presenter, or null.

Returns

This instance.

public RecordView AddGroup(String title, String? note = null) #
Returns: RecordView

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

Parameters

title System.String requiredposition: 0
The heading (markup).
note System.String? = null optionalposition: 1
An optional muted note, or null.

Returns

This instance.

public RecordView AddHeading(String title, Int32 level, ThemeToken? tone = null, String? note = null) #
Returns: RecordView

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

Parameters

title System.String requiredposition: 0
The heading (markup).
level System.Int32 requiredposition: 1
The level.
tone ConsoleMonster.Styling.ThemeToken? = null optionalposition: 2
An optional tone, or null.
note System.String? = null optionalposition: 3
An optional muted note, or null.

Returns

This instance.

public RecordView AddSection(String title, ThemeToken? tone = null, String? note = null) #
Returns: RecordView

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

Parameters

title System.String requiredposition: 0
The heading (markup).
tone ConsoleMonster.Styling.ThemeToken? = null optionalposition: 1
An optional tone (for example the record's status), or null.
note System.String? = null optionalposition: 2
An optional muted note after the heading, or null.

Returns

This instance.

public RecordView AddWidget(IWidget widget) #
Returns: RecordView

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

Parameters

widget ConsoleMonster.Layout.IWidget requiredposition: 0
The widget.

Returns

This instance.

public RecordView AddWidgetAt(Int32 level, IWidget widget) #
Returns: RecordView

Adds a nested widget at an explicit level.

Parameters

level System.Int32 requiredposition: 0
The level.
widget ConsoleMonster.Layout.IWidget requiredposition: 1
The widget.

Returns

This instance.

public Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public Void Render(Region region, RenderContext context) #
Returns: Void

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

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Properties

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 Boolean HideEmpty { get; set; } #

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

public Int32 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 WithHideEmpty(RecordView recordView, Boolean value = true) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static RecordView WithIndentWidth(RecordView recordView, Int32 value) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static RecordView WithMaxLabelFraction(RecordView recordView, Double value) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value System.Double requiredposition: 1
The value.

Returns

The same instance.

WithPresentation 2 overloads
public static RecordView WithPresentation(RecordView recordView, PresentationOptions value) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value ConsoleMonster.Presenters.PresentationOptions requiredposition: 1
The value.

Returns

The same instance.

public static RecordView WithPresentation(RecordView recordView, Action<PresentationOptions> configure) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Presenters.PresentationOptions> requiredposition: 1
Configures the value.

Returns

The same instance.

public static RecordView WithSummary(RecordView recordView, String? value) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.

public static RecordView WithTitle(RecordView recordView, String? value) #
Returns: RecordView

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

Parameters

recordView ConsoleMonster.Widgets.RecordView requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.