CPAsciiTable

org.cosplay.CPAsciiTable
See theCPAsciiTable companion object

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

Concise view

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).

Attributes

cells

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

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

Adds header (one or more header cells).

Adds header (one or more header cells).

Attributes

cells

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

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

Adds header (one or more header cells).

Adds header (one or more header cells).

Attributes

cells

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

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.

Attributes

cells

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

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

Adds row (one or more row cells).

Adds row (one or more row cells).

Attributes

cells

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

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

Adds row (one or more row cells).

Adds row (one or more row cells).

Attributes

cells

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

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

Adds single header cell with the default style..

Adds single header cell with the default style..

Attributes

lines

One or more cell lines.

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

Adds headers.

Adds headers.

Attributes

cells

Header cells.

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

Adds row.

Adds row.

Attributes

cells

Row cells.

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

Adds single row cell with the default style.

Adds single row cell with the default style.

Attributes

lines

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

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..

Attributes

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.
Source:
CPAsciiTable.scala
def addStyledHeaders(style: String, cells: List[Any]): CPAsciiTable

Adds headers with the given style.

Adds headers with the given style.

Attributes

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.
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.

Attributes

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.
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.

Attributes

header

Optional header.

log

Logger.

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.

Attributes

header

Optional header.

log

Logger.

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.

Attributes

header

Optional header.

log

Logger.

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

Sets table's margin.

Sets table's margin.

Attributes

bottom

Bottom margin.

left

Left margin.

right

Right margin.

top

Top margin.

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

Renders this table to output stream.

Renders this table to output stream.

Attributes

ps

Output stream.

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

Renders this table to file.

Renders this table to file.

Attributes

path

File path.

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

Renders this table to file.

Renders this table to file.

Attributes

file

File.

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.

Attributes

skin

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

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.

Attributes

header

Optional header.

log

Logger.

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.

Attributes

header

Optional header.

log

Logger.

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