Skip to content
ConsoleMonster

API Reference

Class

LiveTable

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Implements
Modifiers sealed

A table whose rows change while a live session runs: rows have stable keys and are added, updated, removed or cleared through a LiveTableHandle (thread-safe, through the update queue). The LiveTable.Table defines the columns, presenters and options; its column widths only grow (Table.StableWidths), so rows never jitter while values change. Optionally only the most recent LiveTable.MaxRows rows are kept, and rows can be kept sorted by a column. Live operations (Key = row key): add and update (Payload = the values; both insert or replace), remove, clear. A recording replays the tab-separated text form of the values.

Inheritance

Usage

Explore 16 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 8

Constructors

public LiveTable(Table table, String name = "table") #

Creates a live table.

Parameters

table ConsoleMonster.Widgets.Table requiredposition: 0
The table that defines the columns and options (its own rows are replaced).
name System.String = "table" optionalposition: 1
The live name (default table).

Methods

public override Void Apply(LiveEvent liveEvent) #
Returns: Void

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event.
public Void Clear() #
Returns: Void

Removes every row directly (column widths stay).

public override String? Describe(LiveEvent liveEvent) #
Returns: String?

Returns a line describing the event for line-based outputs (Stream/Plain), or null when the event is not worth a line (for example a single counter increment). Called after ILiveTarget.Apply.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event that was applied.

Returns

A plain line or null.

public LiveTableHandle Handle(ILiveDispatcher dispatcher) #
Returns: LiveTableHandle

A handle that changes rows through a dispatcher (a live session).

Parameters

dispatcher ConsoleMonster.Live.ILiveDispatcher requiredposition: 0
The dispatcher.

Returns

The handle.

public override 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 Boolean Remove(String key) #
Returns: Boolean

Removes a row directly (not thread-safe; use a handle while a session runs).

Parameters

key System.String requiredposition: 0
The row key.

Returns

Whether the row existed.

public override 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.
public Void Set(String key, params Object?[] values) #
Returns: Void

Adds or replaces a row directly (not thread-safe; use a handle while a session runs).

Parameters

key System.String requiredposition: 0
The row key.
values System.Object?[] requiredposition: 1
The values, one per column.
public static String TextOf(Object?[] values) #
Returns: String

The text form of row values that recordings keep (tab-separated plain text).

Parameters

values System.Object?[] requiredposition: 0
The values.

Returns

The text.

Properties

public Table Table { get; } #

The table that defines the columns, presenters and options.

public Int32 MaxRows { get; set; } #

Keeps only the most recently added rows (0, the default, keeps them all): a bounded "recent N" window.

public Int32? SortColumn { get; set; } #

The column index to keep rows sorted by, or null (default) for insertion order.

public Boolean SortDescending { get; set; } #

Whether LiveTable.SortColumn sorts from the largest value down.

public IReadOnlyList<String> Keys { get; } #

The row keys in display order.

Extension Methods

public static LiveTable WithMaxRows(LiveTable liveTable, Int32 value) #
Returns: LiveTable

Sets LiveTable.MaxRows: Keeps only the most recently added rows (0, the default, keeps them all): a bounded "recent N" window.

Parameters

liveTable ConsoleMonster.Widgets.LiveTable requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static LiveTable WithSortColumn(LiveTable liveTable, Int32? value) #
Returns: LiveTable

Sets LiveTable.SortColumn: The column index to keep rows sorted by, or null (default) for insertion order.

Parameters

liveTable ConsoleMonster.Widgets.LiveTable requiredposition: 0
The instance.
value System.Int32? requiredposition: 1
The value.

Returns

The same instance.

public static LiveTable WithSortDescending(LiveTable liveTable, Boolean value = true) #
Returns: LiveTable

Sets LiveTable.SortDescending: Whether LiveTable.SortColumn sorts from the largest value down.

Parameters

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

Returns

The same instance.

public static LiveTable WithTable(LiveTable liveTable, Action<Table> configure) #
Returns: LiveTable

Configures LiveTable.Table in place: The table that defines the columns, presenters and options.

Parameters

liveTable ConsoleMonster.Widgets.LiveTable requiredposition: 0
The instance.
configure System.Action<ConsoleMonster.Widgets.Table> requiredposition: 1
Configures the value.

Returns

The same instance.