CPAsciiTable

org.cosplay.CPAsciiTable
See theCPAsciiTable companion object
class CPAsciiTable

ASCII-based table with minimal styling support. Can be used for structured logging and provides output like this:

+------------------------------------------------------+
|   Name        |               Value                  |
+===============+======================================+
| Game ID       | 52050358-d7a1-4def-b53f-db2bee8aea33 |
| Game name     | My Cool Game                         |
| Game URL      | 'null'                               |
| Description   | 'null'                               |
+------------------------------------------------------+

Attributes

Companion
object
Source
CPAsciiTable.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def #/(cells: (String, Any)*): CPAsciiTable

Adds styled header (one or more header cells).

Adds styled header (one or more header cells).

Value parameters

cells

Header cells tuples (style, text). For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def #=(cells: Any*): CPAsciiTable

Adds header (one or more header cells).

Adds header (one or more header cells).

Value parameters

cells

Header cells. For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def #=(cells: Seq[Any]): CPAsciiTable

Adds header (one or more header cells).

Adds header (one or more header cells).

Value parameters

cells

Header cells. For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def +/(cells: (String, Any)*): CPAsciiTable

Adds row (one or more row cells) with a given style.

Adds row (one or more row cells) with a given style.

Value parameters

cells

Row cells tuples (style, text). For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def +=(cells: Any*): CPAsciiTable

Adds row (one or more row cells).

Adds row (one or more row cells).

Value parameters

cells

Row cells. For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def +=(cells: Seq[Any]): CPAsciiTable

Adds row (one or more row cells).

Adds row (one or more row cells).

Value parameters

cells

Row cells. For multi-line cells - use Seq(...).

Attributes

Source
CPAsciiTable.scala
def addHeaderCell(lines: Any*): CPAsciiTable

Adds single header cell with the default style..

Adds single header cell with the default style..

Value parameters

lines

One or more cell lines.

Attributes

Source
CPAsciiTable.scala
def addHeaders(cells: List[Any]): CPAsciiTable

Adds headers.

Adds headers.

Value parameters

cells

Header cells.

Attributes

Source
CPAsciiTable.scala
def addRow(cells: List[Any]): CPAsciiTable

Adds row.

Adds row.

Value parameters

cells

Row cells.

Attributes

Source
CPAsciiTable.scala
def addRowCell(lines: Any*): CPAsciiTable

Adds single row cell with the default style.

Adds single row cell with the default style.

Value parameters

lines

One or more row cells. Multiple lines will be printed on separate lines.

Attributes

Source
CPAsciiTable.scala

Adds horizontal separator row to the table.

Adds horizontal separator row to the table.

Attributes

Source
CPAsciiTable.scala
def addStyledHeaderCell(style: String, lines: Any*): CPAsciiTable

Adds single header cell with the default style..

Adds single header cell with the default style..

Value parameters

lines

One or more cell lines.

style

Style to use. If empty string is given, then default header style CPAsciiTable.DFLT_HEADER_STYLE will be used. Style string is a comma-separated list of one of the following styles:

  • leftPad: x - left padding of x characters.
  • rightPad: x - right padding of x characters.
  • maxWidth: x - maximum width of x characters.
  • align: {left|center|right} - left, center or right alignment.

Attributes

Source
CPAsciiTable.scala
def addStyledHeaders(style: String, cells: List[Any]): CPAsciiTable

Adds headers with the given style.

Adds headers with the given style.

Value parameters

cells

Header cells.

style

Style to use. If empty string is given, then default header style CPAsciiTable.DFLT_HEADER_STYLE will be used. Style string is a comma-separated list of one of the following styles:

  • leftPad: x - left padding of x characters.
  • rightPad: x - right padding of x characters.
  • maxWidth: x - maximum width of x characters.
  • align: {left|center|right} - left, center or right alignment.

Attributes

Source
CPAsciiTable.scala
def addStyledRowCell(style: String, lines: Any*): CPAsciiTable

Adds single row cell with the default style.

Adds single row cell with the default style.

Value parameters

lines

One or more row cells. Multiple lines will be printed on separate lines.

style

Style to use. If empty string is given, then default header style CPAsciiTable.DFLT_HEADER_STYLE will be used. Style string is a comma-separated list of one of the following styles:

  • leftPad: x - left padding of x characters.
  • rightPad: x - right padding of x characters.
  • maxWidth: x - maximum width of x characters.
  • align: {left|center|right} - left, center or right alignment.

Attributes

Source
CPAsciiTable.scala
def debug(log: CPLog, header: Option[String]): Unit

Renders this table to log as debug.

Renders this table to log as debug.

Value parameters

header

Optional header.

log

Logger.

Attributes

Source
CPAsciiTable.scala
def endRow(): Unit

Ends data row.

Ends data row.

Attributes

Source
CPAsciiTable.scala
def error(log: CPLog, header: Option[String]): Unit

Renders this table to log as error.

Renders this table to log as error.

Value parameters

header

Optional header.

log

Logger.

Attributes

Source
CPAsciiTable.scala
def info(log: CPLog, header: Option[String]): Unit

Renders this table to log as info.

Renders this table to log as info.

Value parameters

header

Optional header.

log

Logger.

Attributes

Source
CPAsciiTable.scala
def margin(top: Int, right: Int, bottom: Int, left: Int): CPAsciiTable

Sets table's margin.

Sets table's margin.

Value parameters

bottom

Bottom margin.

left

Left margin.

right

Right margin.

top

Top margin.

Attributes

Source
CPAsciiTable.scala
def render(ps: PrintStream): Unit

Renders this table to output stream.

Renders this table to output stream.

Value parameters

ps

Output stream.

Attributes

Source
CPAsciiTable.scala
def render(path: String): Unit

Renders this table to file.

Renders this table to file.

Value parameters

path

File path.

Attributes

Source
CPAsciiTable.scala
def render(file: File): Unit

Renders this table to file.

Renders this table to file.

Value parameters

file

File.

Attributes

Source
CPAsciiTable.scala
def startRow(): Unit

Starts data row.

Starts data row.

Attributes

Source
CPAsciiTable.scala
def toImage(skin: Char => CPPixel): CPImage

Renders this table as an image.

Renders this table as an image.

Value parameters

skin

Skin function. The functions takes character and return a new pixel.

Attributes

Source
CPAsciiTable.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
CPAsciiTable.scala
def trace(log: CPLog, header: Option[String]): Unit

Renders this table to log as trace.

Renders this table to log as trace.

Value parameters

header

Optional header.

log

Logger.

Attributes

Source
CPAsciiTable.scala
def warn(log: CPLog, header: Option[String]): Unit

Renders this table to log as warn.

Renders this table to log as warn.

Value parameters

header

Optional header.

log

Logger.

Attributes

Source
CPAsciiTable.scala

Concrete fields

var breakUpByWords: Boolean

If lines exceeds the style's maximum width it will be broken up either by nearest space (by whole words) or mid-word. Default value is true.

If lines exceeds the style's maximum width it will be broken up either by nearest space (by whole words) or mid-word. Default value is true.

Attributes

Source
CPAsciiTable.scala
var insideBorder: Boolean

Global flag indicating whether or not to draw inside horizontal lines between individual rows. Default value is false.

Global flag indicating whether or not to draw inside horizontal lines between individual rows. Default value is false.

Attributes

Source
CPAsciiTable.scala
var multiLineAutoBorder: Boolean

Global Flag indicating whether of not to automatically draw horizontal lines for multiline rows. Default value is true.

Global Flag indicating whether of not to automatically draw horizontal lines for multiline rows. Default value is true.

Attributes

Source
CPAsciiTable.scala