TableRow

io.worxbend.tui.widgets.TableRow
See theTableRow companion object
final case class TableRow(cells: Seq[Source], height: Int = ..., topMargin: Int = ..., bottomMargin: Int = ..., style: Option[Style] = ...)

One row of a Table, with the vertical room it takes and the style it is drawn in.

A Table's rows accepts either a bare sequence of cells — one terminal line tall, which is all a row could ever be before this type existed — or a TableRow, and the two may be mixed in one table. The union follows the shape ListView already uses for its String | Line items: a caller who wants none of this pays no ceremony for it, and every table written against the older signature still compiles and still draws the same thing.

What the extra room buys is spacing a table could not express at all. bottomMargin = 1 on the last header-like row puts a blank line under it; height = 2 gives a row breathing space in a sparse table; topMargin opens a gap above a group of rows.

Value parameters

bottomMargin

blank lines below the row. Negative counts clamp to zero.

cells

the row's cells, laid out on the table's solved column widths. A cell is either a bare Line, which occupies one column, or a TableCell, which can span several. Extra cells beyond the last column are dropped, as they always were.

height

how many terminal lines the row occupies. A cell is a single line of text, so the cells are drawn on the first of those lines and the rest are left blank — this reserves vertical room, it does not wrap text. Clamped to at least one: a zero-height row would draw nothing while still being walked, which is exactly the shape that lets a ten-thousand-row table scan itself looking for something to show.

style

the style this row is drawn in, layered over the table's own style, or None to use the table's style unchanged. This is the per-row level the reference implementations have between the table style and the cell style: before it, a table applied one style to every row and a caller who wanted to tint one of them — a failing check, a stale record — had to restyle every io.worxbend.tui.core.Span in it by hand.

topMargin

blank lines above the row. Negative counts clamp to zero.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def contentHeight: Int

The row's height as the renderer spends it: at least one line for the content.

The row's height as the renderer spends it: at least one line for the content.

Attributes

def totalHeight: Int

Every line the row occupies, margins included — what the render loop advances y by.

Every line the row occupies, margins included — what the render loop advances y by.

Attributes

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product