Skip to content
ConsoleMonster
Class

CellMap

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed
Attributes
DefaultMember("Item")

One cell per item of a run, in item order, flowing to the width: each state has its own symbol (✓ ✗ ▴ – ○ in Full and Basic, + x ! - . in ASCII), so outcomes read without colour; running items spin; a legend counts each state. Generic: tests, hosts, files, any list of work. Live operations: set (Key = item index, State = status word), add (State, optional), count (Value = the number of items, new ones pending).

Inheritance

Usage

Explore 50 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 24

Constructors

public CellMap(string widgetId = "cells") #

Creates a cell map.

Parameters

widgetId string = "cells" optional
The live name (default cells).

Methods

public int Add(StatusKind state = Pending) #

Adds an item.

Parameters

state ConsoleMonster.Styling.StatusKind = Pending optional
Its state (default pending).

Returns

int The new item's index.
public override void Apply(LiveEvent liveEvent) #

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent required
The event.
public CellMap Cell(string row, string column, StatusKind state) #

Sets the cell at a named row and column, adding the row (to CellMap.RowLabels) and the column (to CellMap.ColumnLabels) the first time each appears: one row per category with a cell per target, coloured by outcome. A cell no row and column pair has set yet shows StatusKind.None. The grid lays out the map's cells and sets CellMap.Columns, so do not mix it with CellMap.Add on the same map.

Parameters

row string required
The row name (a category).
column string required
The column name (a target).
state ConsoleMonster.Styling.StatusKind required
The cell's state.

Returns

CellMap This instance.
public static string CountLabel(StatusKind state, int count, RenderContext context) #

A count with the word for its state in the current language: "12 passed", "3 failed", "45 queued".

Parameters

state ConsoleMonster.Styling.StatusKind required
The state.
count int required
The count.
context ConsoleMonster.Canvas.RenderContext required
The render context (labels and culture).

Returns

string The text.
public int CountOf(StatusKind state) #

How many items are in a state.

Parameters

state ConsoleMonster.Styling.StatusKind required
The state.

Returns

int The count.
public StyledLine Legend(RenderContext context) #

The legend: each state present with its symbol and count ("✓ 12 passed ✗ 3 failed ○ 45 queued").

Parameters

context ConsoleMonster.Canvas.RenderContext required
The render context.

Returns

StyledLine The legend line.
public override 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 override 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 CellMap Resize(int count) #

Sets the number of items: new ones are pending, extra ones are removed.

Parameters

count int required
The count.

Returns

CellMap This instance.
public CellMap Set(int index, StatusKind state) #

Sets an item's state, growing the map when the index is past the end.

Parameters

index int required
The item index.
state ConsoleMonster.Styling.StatusKind required
The state.

Returns

CellMap This instance.

Properties

public int Count { get; } #

The number of items.

public int Gap { get; set; } #

The cells between symbols (default 1).

public bool ShowLegend { get; set; } #

Whether a legend line with each state's count follows the cells (default true).

public int MaxRows { get; set; } #

The most rows of cells (0 = all); a last line then counts the items not shown.

public CellWindow Window { get; set; } #

Which rows show when there are more than CellMap.MaxRows (default CellWindow.Head).

public bool SpinRunning { get; set; } #

Whether running cells spin (default true); false shows the still running symbol, when another part of the screen already spins.

public int Columns { get; set; } #

The cells per row (0 = as many as fit, the default). Set it to draw a grid, such as one row per server and one column per check; cells past the width are cut off rather than moved to the next row.

public IList<string> RowLabels { get; } #

Labels drawn muted before the rows, one per row in order (empty = none, the default); the cells start after the widest label. Together with CellMap.Columns they make a labelled grid with one legend below it.

public bool Blocks { get; set; } #

Whether each cell is a block in its state's colour rather than its symbol (default false), for a dense strip of many items. It needs colour and the Full or Basic tier and is off for an accessible profile; otherwise the cells keep their symbols, so outcomes still read without telling colours apart. Queued cells are drawn as the empty bar track.

public int LegendLines { get; set; } #

The most lines the legend wraps onto when it is wider than the map (default 1: it is cut off instead).

public StatusKind this[int index] { get; } #

The state of an item.

Parameters

index int required
The item index.
public IReadOnlyList<string> ColumnLabels { get; } #

The columns of a grid filled with CellMap.Cell, in the order they first appeared (for example the targets of a category × target map); empty for a plain map.

public bool ShowColumnLabels { get; set; } #

Whether a grid built with CellMap.Cell shows its CellMap.ColumnLabels in a header row (default false). When the names fit, each column is as wide as its name and the cell sits under it; when they do not, the columns are numbered and a key line below the map names them ("1 DC01 · 2 DC02"). When even numbered columns do not fit, the map shows the columns that do and the key ends with "+N more". A suffix all the names share (.corp.example) and a shared prefix are left out first, so the column shows what tells the names apart.

Fields

public const int MaxItems #

The most items a map holds (1,000,000): live events past it are ignored, so a mistyped index cannot exhaust memory.

Value: 1000000

Extension Methods

public static CellMap Blocks(CellMap cellMap, bool value = true) #

Sets CellMap.Blocks: Whether each cell is a block in its state's colour rather than its symbol (default false), for a dense strip of many items. It needs colour and the Full or Basic tier and is off for an accessible profile; otherwise the cells keep their symbols, so outcomes still read without telling colours apart. Queued cells are drawn as the empty bar track.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value bool = true optional
The value; true when omitted.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ConsoleMonster.Widgets.CellMap { Blocks = value };    Ui.CellMap().Blocks(value);
public static CellMap Columns(CellMap cellMap, int value) #

Sets CellMap.Columns: The cells per row (0 = as many as fit, the default). Set it to draw a grid, such as one row per server and one column per check; cells past the width are cut off rather than moved to the next row.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value int required
The value.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Widgets.CellMap { Columns = value };    Ui.CellMap().Columns(value);
public static CellMap Gap(CellMap cellMap, int value) #

Sets CellMap.Gap: The cells between symbols (default 1).

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value int required
The value.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Widgets.CellMap { Gap = value };    Ui.CellMap().Gap(value);
public static CellMap LegendLines(CellMap cellMap, int value) #

Sets CellMap.LegendLines: The most lines the legend wraps onto when it is wider than the map (default 1: it is cut off instead).

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value int required
The value.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                          // C# fluent
new global::ConsoleMonster.Widgets.CellMap { LegendLines = value };    Ui.CellMap().LegendLines(value);
public static CellMap MaxRows(CellMap cellMap, int value) #

Sets CellMap.MaxRows: The most rows of cells (0 = all); a last line then counts the items not shown.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value int required
The value.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Widgets.CellMap { MaxRows = value };    Ui.CellMap().MaxRows(value);
public static CellMap RowLabel(CellMap cellMap, string item) #

Adds an item to CellMap.RowLabels: Labels drawn muted before the rows, one per row in order (empty = none, the default); the cells start after the widest label. Together with CellMap.Columns they make a labelled grid with one legend below it.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
item string required
The item.

Returns

CellMap The same instance.
public static CellMap RowLabels(CellMap cellMap, IEnumerable<string> items) #

Adds items to CellMap.RowLabels: Labels drawn muted before the rows, one per row in order (empty = none, the default); the cells start after the widest label. Together with CellMap.Columns they make a labelled grid with one legend below it.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
items System.Collections.Generic.IEnumerable<string> required
The items, in order.

Returns

CellMap The same instance.
public static CellMap ShowColumnLabels(CellMap cellMap, bool value = true) #

Sets CellMap.ShowColumnLabels: Whether a grid built with CellMap.Cell shows its CellMap.ColumnLabels in a header row (default false). When the names fit, each column is as wide as its name and the cell sits under it; when they do not, the columns are numbered and a key line below the map names them ("1 DC01 · 2 DC02"). When even numbered columns do not fit, the map shows the columns that do and the key ends with "+N more". A suffix all the names share (.corp.example) and a shared prefix are left out first, so the column shows what tells the names apart.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value bool = true optional
The value; true when omitted.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                               // C# fluent
new global::ConsoleMonster.Widgets.CellMap { ShowColumnLabels = value };    Ui.CellMap().ShowColumnLabels(value);
public static CellMap ShowLegend(CellMap cellMap, bool value = true) #

Sets CellMap.ShowLegend: Whether a legend line with each state's count follows the cells (default true).

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value bool = true optional
The value; true when omitted.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Widgets.CellMap { ShowLegend = value };    Ui.CellMap().ShowLegend(value);
public static CellMap SpinRunning(CellMap cellMap, bool value = true) #

Sets CellMap.SpinRunning: Whether running cells spin (default true); false shows the still running symbol, when another part of the screen already spins.

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value bool = true optional
The value; true when omitted.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                          // C# fluent
new global::ConsoleMonster.Widgets.CellMap { SpinRunning = value };    Ui.CellMap().SpinRunning(value);
public static CellMap Window(CellMap cellMap, CellWindow value) #

Sets CellMap.Window: Which rows show when there are more than CellMap.MaxRows (default CellWindow.Head).

Parameters

cellMap ConsoleMonster.Widgets.CellMap required
The instance.
value ConsoleMonster.Widgets.CellMap.CellWindow required
The value.

Returns

CellMap The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ConsoleMonster.Widgets.CellMap { Window = value };    Ui.CellMap().Window(value);