AbstractTable

public abstract class AbstractTable implements Table

An abstract base class for implementing data tables.

Author:Manoel Campos da Silva Filho

Constructors

AbstractTable

public AbstractTable()

AbstractTable

public AbstractTable(String title)

Creates an Table

Parameters:
  • title – Title of the table

Methods

addColumn

public final TableColumn addColumn(String columnTitle)

addColumn

public final TableColumn addColumn(String columnTitle, String columnSubTitle)

addColumn

public final TableColumn addColumn(int index, TableColumn column)

addColumn

public final TableColumn addColumn(TableColumn column)

addColumnList

public final Table addColumnList(String... columnTitles)

getColumnSeparator

public String getColumnSeparator()

getColumns

public List<TableColumn> getColumns()
Returns:the list of columns of the table

getPrintStream

protected PrintStream getPrintStream()

Gets the PrintStream used to print the generated table.

Returns:the PrintStream

getRows

protected List<List<Object>> getRows()
Returns:The data to be printed, where each row contains a list of data columns.

getTitle

public String getTitle()

newRow

public List<Object> newRow()

print

public void print()

printColumnHeaders

protected void printColumnHeaders()

printRowClosing

protected abstract void printRowClosing()

Prints the string to close a row.

printRowOpening

protected abstract void printRowOpening()

Prints the string that has to precede each printed row.

printTableClosing

protected abstract void printTableClosing()

Prints the string to close the table.

printTableOpening

protected abstract void printTableOpening()

Prints the string to open the table.

printTitle

protected abstract void printTitle()

Prints the table title.

setColumnSeparator

public final Table setColumnSeparator(String columnSeparator)

setPrintStream

public void setPrintStream(PrintStream printStream)

Sets the PrintStream used to print the generated table.

Parameters:

setTitle

public final Table setTitle(String title)