public class TableBuilderImpl extends Object implements TableBuilder
TableBuilder
interface.org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<B extends org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<?>>, org.refcodes.mixin.RowWidthAccessor.RowWidthMutator, org.refcodes.mixin.RowWidthAccessor.RowWidthProperty
org.refcodes.mixin.PrintStreamAccessor.PrintStreamBuilder<B extends org.refcodes.mixin.PrintStreamAccessor.PrintStreamBuilder<?>>, org.refcodes.mixin.PrintStreamAccessor.PrintStreamMutator, org.refcodes.mixin.PrintStreamAccessor.PrintStreamProperty
Constructor and Description |
---|
TableBuilderImpl() |
TableBuilderImpl(int aRowWidth)
Initializes the
TableBuilder with the given row width. |
Modifier and Type | Method and Description |
---|---|
TableBuilder |
addColumn()
Adds a column and returns this
TableBuilder instance as of the
builder pattern. |
PrintStream |
getPrintStream() |
int |
getRowWidth() |
TableStatus |
getTableStatus()
Retrieves the
TablePrinter (TableBuilder ) status. |
void |
setPrintStream(PrintStream aPrintStream) |
TableBuilder |
setTableStatus(TableStatus aTableStatus)
Set the
TablePrinter (TableBuilder ) status. |
static String[][] |
toColumns(String[][] aColumns,
VertAlignTextMode aTextBlockMode)
Creates an array of
String arrays where all the arrays are of the
same length and where the arrays are all aligned as specified by the
passed VertAlignTextMode |
int[] |
toColumnWidths()
Returns the currently calculated or configured column widths.
|
protected static int[] |
toColumnWidths(int aTotalWidth,
ColumnWidthMetrics... aColumnWidths)
Calculates the columns widths in "number of chars" according to the
provided
ColumnWidthMetricsImpl instances in relation to the
provided total (available) width; the provided column widths can be a mix
of "number of char" widths (ColumnWidthType.ABSOLUTE ) and percent
(%) widths (ColumnWidthType.RELATIVE ). |
String |
toHeader(String... aColumns)
Prints the table's header with the content of the provided columns.
|
String |
toHeaderBegin()
Begins a header, for convenience reasons, this is being encapsulated by
the
TablePrinter.toHeader(String...) method. |
String |
toHeaderContinue(String... aColumns)
Continues a begun header, for convenience reasons, this is being
encapsulated by the
TablePrinter.toHeader(String...) method. |
String |
toHeaderEnd()
Ends a header, for convenience reasons, this is being encapsulated by the
TablePrinter.toHeader(String...) method. |
String |
toHeaderEnd(TableBuilder aTablePrinter)
Ends the headers of the provided
TableBuilder for this table
printer to continue; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder s,
especially when empty columns may result in better using another column
layout making better use of the available width. |
String |
toRow(String... aColumns)
Prints the table's (next) row with the content of the provided columns.
|
String |
toRowBegin()
Begins a row, for convenience reasons, this is being encapsulated by the
TablePrinter.toRow(String...) method. |
String |
toRowContinue(String... aColumns)
Continues a begun row, for convenience reasons, this is being
encapsulated by the
TablePrinter.toRow(String...) method. |
String |
toRowEnd(TableBuilder aTablePrinter)
Ends the rows of the provided
TableBuilder for this table printer
to continue; different row widths and column widths are taken care of, so
it is a pleasure to mix different TableBuilder s, especially when
empty columns may result in better using another column layout making
better use of the available width. |
String |
toTail()
Finishes off the table by closing it.
|
TableBuilder |
withBorderEscapeCode(String aAnsiEscCode)
Sets an overall ANSI Escape-Code for the borders and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnFormatMetrics(ColumnFormatMetrics aColumnFormatMetrics)
Sets the current column's (the last added one with the
TableBuilder.addColumn() method) format (including the width) and returns
this TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets the column's alignment mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnMoreTextMode(MoreTextMode aMoreTextMode)
Sets the column's "more" mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnSplitTextMode(SplitTextMode aLineSplitMode)
Sets the column's line split mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnTextFormatMode(TextFormatMode aTableFormatMode)
Sets the column's format mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnWidth(int aColumnWidth)
Sets the current column's (the last added one with the
TableBuilder.addColumn() method) absolute width () @link
ColumnWidthType#ABSOLUTE) and returns this TableBuilder instance
as of the builder pattern. |
TableBuilder |
withColumnWidth(int aWidth,
ColumnWidthType aWidthType)
Sets the current column's (the last added one with the
TableBuilder.addColumn() method) width and returns this TableBuilder
instance as of the builder pattern. |
TableBuilder |
withColumnWidthMetrics(ColumnWidthMetrics aColumnWidthMetrics)
Sets the current column's (the last added one with the
TableBuilder.addColumn() method) width and returns this TableBuilder
instance as of the builder pattern. |
TableBuilder |
withEscapeCode(String aAnsiEscCode)
Sets an overall ANSI Escape-Code for the header, the rows as well as the
borders; and returns this
TableBuilder instance as of the builder
pattern. |
TableBuilder |
withEscapeCodes(boolean isEscCodesEnabled)
Sets an overall ANSI Escape-Code support for the
TableBuilder ,
for the rows as well as the borders; and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderColumnEscapeCode(String aAnsiEscCode)
Sets the column's header ANSI Escape-Code for the current header column
and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets the column's header alignment mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderColumnMoreTextMode(MoreTextMode aMoreTextMode)
Sets the column's header "more" mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderColumnSplitTextMode(SplitTextMode aLineSplitMode)
Sets the column's header line split mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderColumnTextFormatMode(TextFormatMode aTableFormatMode)
Sets the column's header format mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderEscapeCode(String aAnsiEscCode)
Sets an overall ANSI Escape-Code for the header and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets an overall alignment mode for the header and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderMoreTextMode(MoreTextMode aMoreTextMode)
Sets an overall "more" mode for the header and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderSplitTextMode(SplitTextMode aLineSplitMode)
Sets an overall line split mode for the header and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHeaderTextFormatMode(TextFormatMode aTableFormatMode)
Sets an overall format mode for the header and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets an overall alignment mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withLeftBorder(boolean hasLeftBorder)
Sets whether to print the left border and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withLineBreak(String aLineBreak)
Sets the required line break and returns this
TableBuilder
instance as of the builder pattern. |
TableBuilder |
withMoreTextMode(MoreTextMode aMoreTextMode)
Sets an overall "more" mode for the header and the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withResetEscapeCode(String aAnsiEscCode)
Sets the ANSI reset Escape-Code for this
TableBuilder instance as
of the builder pattern. |
TableBuilder |
withRightBorder(boolean hasRightBorder)
Sets whether to print the right border and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowColumnEscapeCode(String aAnsiEscCode)
Sets the column's header ANSI Escape-Code for the current row column and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets the column's header alignment mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowColumnMoreTextMode(MoreTextMode aMoreTextMode)
Sets the column's header "more" mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowColumnSplitTextMode(SplitTextMode aLineSplitMode)
Sets the column's header line split mode for the header and the rows and
returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowColumnTextFormatMode(TextFormatMode aTableFormatMode)
Sets the column's row format mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowEscapeCode(String aAnsiEscCode)
Sets an overall ANSI Escape-Code for the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
Sets an overall alignment mode for the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowMoreTextMode(MoreTextMode aMoreTextMode)
Sets an overall "more" mode for the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowSplitTextMode(SplitTextMode aLineSplitMode)
Sets an overall line split mode for the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowTextFormatMode(TextFormatMode aTableFormatMode)
Sets an overall format mode for the rows and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withRowWidth(int aRowWidth) |
TableBuilder |
withSplitTextMode(SplitTextMode aLineSplitMode)
Sets an overall line split mode for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withTableStyle(TableStyle aTableStyle)
Sets the
TableStyle to use when printing and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withTextColumnEscapeCode(String aAnsiEscCode)
Sets the column's ANSI Escape-Code for the current (header and row)
column and returns this
TableBuilder instance as of the builder
pattern. |
TableBuilder |
withTextEscapeCode(String aAnsiEscCode)
Sets an overall ANSI Escape-Code for the header and the rows and returns
this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withTextFormatMode(TextFormatMode aTableFormatMode)
Sets an overall format mode for the header and the rows and returns this
TableBuilder instance as of the builder pattern. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
printHeader, printHeaderBegin, printHeaderContinue, printHeaderEnd, printHeaderEnd, printRow, printRowBegin, printRowContinue, printRowEnd, printTail, withPrintStream
printHeader, printHeaderComplete, printHeaderContinue, printRow, printRowContinue, toHeader, toHeaderComplete, toHeaderContinue, toRow, toRowContinue
public TableBuilderImpl()
public TableBuilderImpl(int aRowWidth)
TableBuilder
with the given row width.aRowWidth
- The row width with which to initialize the
TableBuilder
.public int getRowWidth()
getRowWidth
in interface org.refcodes.mixin.RowWidthAccessor
public TableStatus getTableStatus()
TablePrinter
TablePrinter
(TableBuilder
) status.
The TableStatus
is required by a TablePrinter
(
TableBuilder
) to determine whether to do additional table
decoration for a print operation or to fail that operation as of an
illegal state exception. As far as possible an illegal state exception is
to be tried to be prevented by decorating the table automatically by an
operation as of the current TableStatus
.getTableStatus
in interface TablePrinter
TableStatus
.public TableBuilder setTableStatus(TableStatus aTableStatus)
TablePrinter
TablePrinter
(TableBuilder
) status.
The TableStatus
is required by a TablePrinter
(
TableBuilder
) to determine whether to do additional table
decoration for a print operation or to fail that operation as of an
illegal state exception. As far as possible an illegal state exception is
to be tried to be prevented by decorating the table automatically by an
operation as of the current TableStatus
.
Setting the status manually, you can use differently configured
TablePrinter
interfaces to print their lines according to the
status of a previous TablePrinter
.setTableStatus
in interface TablePrinter
aTableStatus
- The table's current TableStatus
to be set.public TableBuilder withLeftBorder(boolean hasLeftBorder)
TableBuilder
TableBuilder
instance as of the builder pattern.withLeftBorder
in interface TableBuilder
hasLeftBorder
- True in case a left border is to be printed, elser
falseTableBuilder
instance to continue configuration.public TableBuilder withRightBorder(boolean hasRightBorder)
TableBuilder
TableBuilder
instance as of the builder pattern.withRightBorder
in interface TableBuilder
hasRightBorder
- True in case a right border is to be printed, elser
falseTableBuilder
instance to continue configuration.public TableBuilder withRowWidth(int aRowWidth)
withRowWidth
in interface org.refcodes.mixin.RowWidthAccessor.RowWidthBuilder<TableBuilder>
public TableBuilder withTableStyle(TableStyle aTableStyle)
TableBuilder
TableStyle
to use when printing and returns this
TableBuilder
instance as of the builder pattern.withTableStyle
in interface TableBuilder
aTableStyle
- The TableStyle
defining the tables style to be
used when printing the table borders.TableBuilder
instance to continue configuration.public TableBuilder withLineBreak(String aLineBreak)
TableBuilder
TableBuilder
instance as of the builder pattern.withLineBreak
in interface TableBuilder
aLineBreak
- The line break character to use, by default the
platform specific one is used.TableBuilder
instance to continue configuration.public PrintStream getPrintStream()
getPrintStream
in interface org.refcodes.mixin.PrintStreamAccessor
public void setPrintStream(PrintStream aPrintStream)
setPrintStream
in interface org.refcodes.mixin.PrintStreamAccessor.PrintStreamMutator
public TableBuilder withEscapeCodes(boolean isEscCodesEnabled)
TableBuilder
TableBuilder
,
for the rows as well as the borders; and returns this
TableBuilder
instance as of the builder pattern. In case of being
set to Boolean.FALSE
, then an ANSI support is disabled
altogether, else it is enabled (again, if already configured). The latest
setting wins.withEscapeCodes
in interface TableBuilder
isEscCodesEnabled
- True to enable, false to disable Escape-Code
support altogether.TableBuilder
instance to continue configuration.public TableBuilder withEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder
pattern. In case an ANSI Escape-Codes is set, then an ANSI Reset-Code is
prepended to the according text being printed. The latest ANSI escape
code set wins.withEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withBorderEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. In case an ANSI
Escape-Codes is set, then the ANSI Escape-Code is prepended and an ANSI
Reset-Code is appended to the according text being printed. The latest
ANSI Escape-Code set wins.withBorderEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withTextEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. In case an
ANSI Escape-Codes is set, then the ANSI Escape-Code is prepended and an
ANSI Reset-Code is appended to the according text being printed. The
latest ANSI Escape-Code set wins.withTextEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withHeaderEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest ANSI
Escape-Code being set wins.withHeaderEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withRowEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest ANSI
Escape-Code being set wins.withRowEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withTextColumnEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder
pattern. The latest ANSI Escape-Code being set wins.withTextColumnEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern.
The latest ANSI Escape-Code being set wins.withHeaderColumnEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest ANSI Escape-Code being set wins.withRowColumnEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping.TableBuilder
instance to continue configuration.public TableBuilder withResetEscapeCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as
of the builder pattern. In case an ANSI Escape-Codes is set, then this
ANSI Reset-Code is prepended to the according text being printed.withResetEscapeCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for resetting ANSI
escaping.TableBuilder
instance to continue configuration.public TableBuilder withHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
alignment mode being set wins.withHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
alignment mode being set wins.withColumnHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest alignment mode being set wins.withHeaderColumnHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest alignment mode being set wins.withRowColumnHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
alignment mode being set wins.withHeaderHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withRowHorizAlignTextMode(HorizAlignTextMode aHorizAlignTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
alignment mode being set wins.withRowHorizAlignTextMode
in interface TableBuilder
aHorizAlignTextMode
- The HorizAlignTextMode
to be used for
aligning the text.TableBuilder
instance to continue configuration.public TableBuilder withTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
format mode being set wins.withTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withColumnTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
format mode being set wins.withColumnTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest format mode being set wins.withHeaderColumnTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
format mode being set wins.withRowColumnTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
format mode being set wins.withHeaderTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withRowTextFormatMode(TextFormatMode aTableFormatMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
format mode being set wins.withRowTextFormatMode
in interface TableBuilder
aTableFormatMode
- The TextFormatMode
to be used for
formating the text.TableBuilder
instance to continue configuration.public TableBuilder withSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
line split mode being set wins.withSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withColumnSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
line split mode being set wins.withColumnSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest line split mode being set wins.withHeaderColumnSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest line split mode being set wins.withRowColumnSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest line
split mode being set wins.withHeaderSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withRowSplitTextMode(SplitTextMode aLineSplitMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest line
split mode being set wins.withRowSplitTextMode
in interface TableBuilder
aLineSplitMode
- The SplitTextMode
to be used for aligning
the text.TableBuilder
instance to continue configuration.public TableBuilder withMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
"more" mode being set wins.withMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder withColumnMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
"more" mode being set wins.withColumnMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest "more" mode being set wins.withHeaderColumnMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest "more" mode being set wins.withRowColumnMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
"more" mode being set wins.withHeaderMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder withRowMoreTextMode(MoreTextMode aMoreTextMode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest
"more" mode being set wins.withRowMoreTextMode
in interface TableBuilder
aMoreTextMode
- The MoreTextMode
to be used for aligning the
text.TableBuilder
instance to continue configuration.public TableBuilder addColumn()
TableBuilder
TableBuilder
instance as of the
builder pattern.addColumn
in interface TableBuilder
TableBuilder
instance to continue configuration.public TableBuilder withColumnWidth(int aWidth, ColumnWidthType aWidthType) throws IllegalStateException
TableBuilder
TableBuilder.addColumn()
method) width and returns this TableBuilder
instance as of the builder pattern.withColumnWidth
in interface TableBuilder
aWidth
- The width for the column.aWidthType
- The type the width is of, e.g.
ColumnWidthType.RELATIVE
or
ColumnWidthType.ABSOLUTE
TableBuilder
instance to continue configuration.IllegalStateException
- in case there is none column already added.public TableBuilder withColumnWidth(int aColumnWidth) throws IllegalStateException
TableBuilder
TableBuilder.addColumn()
method) absolute width () @link
ColumnWidthType#ABSOLUTE) and returns this TableBuilder
instance
as of the builder pattern.
Same as calling "withColumnWidth(int, ColumnWidthType.ABSOLUTE)}"withColumnWidth
in interface TableBuilder
aColumnWidth
- The width for the column.TableBuilder
instance to continue configuration.IllegalStateException
- in case there is none column already added.public TableBuilder withColumnWidthMetrics(ColumnWidthMetrics aColumnWidthMetrics) throws IllegalStateException
TableBuilder
TableBuilder.addColumn()
method) width and returns this TableBuilder
instance as of the builder pattern.withColumnWidthMetrics
in interface TableBuilder
aColumnWidthMetrics
- The width and the ColumnWidthType
(
ColumnWidthType.RELATIVE
or
ColumnWidthType.ABSOLUTE
) of the column.TableBuilder
instance to continue configuration.IllegalStateException
- in case there is none column already added.public TableBuilder withColumnFormatMetrics(ColumnFormatMetrics aColumnFormatMetrics) throws IllegalStateException
TableBuilder
TableBuilder.addColumn()
method) format (including the width) and returns
this TableBuilder
instance as of the builder pattern.withColumnFormatMetrics
in interface TableBuilder
aColumnFormatMetrics
- The width and the ColumnWidthType
(
ColumnWidthType.RELATIVE
or
ColumnWidthType.ABSOLUTE
) of the column as well as the
format.TableBuilder
instance to continue configuration.IllegalStateException
- in case there is none column already added.public String toHeaderBegin()
TablePrinter
TablePrinter.toHeader(String...)
method. Use this method in case you need
more control on the header construction than TablePrinter.toHeader(String...)
can provide you.toHeaderBegin
in interface TablePrinter
String
including the line breaks.public String toHeaderContinue(String... aColumns)
TablePrinter
TablePrinter.toHeader(String...)
method. Use this method
in case you need more control on the header construction than
TablePrinter.toHeader(String...)
can provide you.toHeaderContinue
in interface TablePrinter
String
including the line
breaks.public String toHeaderEnd(TableBuilder aTablePrinter)
TablePrinter
TableBuilder
for this table
printer to continue; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder
s,
especially when empty columns may result in better using another column
layout making better use of the available width.toHeaderEnd
in interface TablePrinter
aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's headers.TableBuilder
's layout with this (bottom)
TableBuilder
's layout.public String toHeaderEnd()
TablePrinter
TablePrinter.toHeader(String...)
method. Use this method in case you need
more control on the header construction than TablePrinter.toHeader(String...)
can provide you.toHeaderEnd
in interface TablePrinter
String
including the line breaks.public String toRowBegin()
TablePrinter
TablePrinter.toRow(String...)
method. Use this method in case you need more
control on the row construction than TablePrinter.toRow(String...)
can
provide you.toRowBegin
in interface TablePrinter
String
including the line breaks.public String toRowContinue(String... aColumns)
TablePrinter
TablePrinter.toRow(String...)
method. Use this method in
case you need more control on the header construction than
TablePrinter.toRow(String...)
can provide you.toRowContinue
in interface TablePrinter
String
including the line breaks.public String toRowEnd(TableBuilder aTablePrinter)
TablePrinter
TableBuilder
for this table printer
to continue; different row widths and column widths are taken care of, so
it is a pleasure to mix different TableBuilder
s, especially when
empty columns may result in better using another column layout making
better use of the available width.toRowEnd
in interface TablePrinter
aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's rows.TableBuilder
's
layout with this (bottom) TableBuilder
's layout.public String toHeader(String... aColumns)
TablePrinter
toHeader
in interface TablePrinter
aColumns
- The columns to be used in the table's header.String
including line breaks as it most
probably will consist of more than one line.public String toRow(String... aColumns)
TablePrinter
toRow
in interface TablePrinter
aColumns
- The columns to be used in the (next) table's row.String
including line breaks as it most probably
will consist of more than one line.public String toTail()
TablePrinter
toTail
in interface TablePrinter
public int[] toColumnWidths()
TableBuilder
toColumnWidths
in interface TableBuilder
protected static int[] toColumnWidths(int aTotalWidth, ColumnWidthMetrics... aColumnWidths)
ColumnWidthMetricsImpl
instances in relation to the
provided total (available) width; the provided column widths can be a mix
of "number of char" widths (ColumnWidthType.ABSOLUTE
) and percent
(%) widths (ColumnWidthType.RELATIVE
). When the width is being
relative, then the total sum of all of relative widths represents 100%.
The resulting column widths add up to the total width.
The column widths for the ColumnWidthMetricsImpl
instances being
specified in percent (ColumnWidthType.RELATIVE
) are calculated
from the remainder width after all "number of char"
ColumnWidthMetricsImpl
instances (
ColumnWidthType.ABSOLUTE
) have been subtracted from the provided
total width. *aTotalWidth
- The total available width in number of chars.aColumnWidths
- The ColumnWidthMetricsImpl
instances
providing width specifications either in percent (%) or in
"number of chars".ColumnWidthMetricsImpl
instances in the order them
ColumnWidthMetricsImpl
instances have been passed; the
array species the actual column widths in "number of chars",
adding up to the total width.public static String[][] toColumns(String[][] aColumns, VertAlignTextMode aTextBlockMode)
String
arrays where all the arrays are of the
same length and where the arrays are all aligned as specified by the
passed VertAlignTextMode
aColumns
- An array of String
arrays to be equalized.aTextBlockMode
- The VertAlignTextMode
to be used when
equalizing the columns.Copyright © 2017. All rights reserved.