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
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. |
int |
getRowWidth() |
TableStatus |
getTableStatus()
Retrieves the
TablePrinter (TableBuilder ) status. |
void |
printHeader(String... aColumns)
Prints the table's header to the
PrintStream configured for this
PrintWriter with the content of the provided columns. |
void |
printHeaderBegin()
Prints out a header begin to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the TablePrinter.printHeader(String...) method. |
void |
printHeaderContinue(String... aColumns)
Continues to print out a begun header to the
PrintStream
configured for this PrintWriter , for convenience reasons, this is
being encapsulated by the TablePrinter.printHeader(String...) method. |
void |
printHeaderEnd()
Prints out a header end to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the TablePrinter.printHeader(String...) method. |
void |
printHeaderEnd(TableBuilder aTablePrinter)
Ends the headers of the provided
TableBuilder for this table
printer to continue to the PrintStream configured for this
PrintWriter ; 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. |
void |
printRow(String... aColumns)
Prints the table's (next) row to the
PrintStream configured for
this PrintWriter with the content of the provided columns. |
void |
printRowBegin()
Prints out a row begin to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the TablePrinter.printRow(String...) method. |
void |
printRowContinue(String... aColumns)
Continues a print out begun row to the
PrintStream configured for
this PrintWriter , for convenience reasons, this is being
encapsulated by the TablePrinter.printRow(String...) method. |
void |
printRowEnd(TableBuilder aTablePrinter)
Ends the rows of the provided
TableBuilder for this table printer
to continue to the PrintStream configured for this
PrintWriter ; 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. |
void |
printTail()
Finishes off the table by printing its closing to the
PrintStream
configured for this PrintWriter . |
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 |
withBorderEscCode(String aAnsiEscCode)
Sets an overall ANSI escape code for the borders and returns this
TableBuilder instance as of the builder pattern. |
TableBuilder |
withColumnEscCode(String aAnsiEscCode)
Sets the column's ANSI escape code for the header and the rows 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 aWidth)
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 aColumnWidth)
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 |
withEscCode(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 |
withEscCodes(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 |
withHeaderColumnEscCode(String aAnsiEscCode)
Sets the column's header ANSI escape code for the header and the rows 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 |
withHeaderEscCode(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 |
withPrintStream(PrintStream aPrintStream)
Sets the print stream to be used when using the print methods of the
TableBuilder and returns this TableBuilder instance as of
the builder pattern. |
TableBuilder |
withResetEscCode(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 |
withRowColumnEscCode(String aAnsiEscCode)
Sets the column's header ANSI escape code for the header and the rows 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 |
withRowEscCode(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 |
withTextEscCode(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. |
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 TableBuilder withPrintStream(PrintStream aPrintStream)
TableBuilder
TableBuilder
and returns this TableBuilder
instance as of
the builder pattern.withPrintStream
in interface TableBuilder
aPrintStream
- The PrintStream
to be used when printing out
the table.TableBuilder
instance to continue configuration.public TableBuilder withEscCodes(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.withEscCodes
in interface TableBuilder
isEscCodesEnabled
- True to enable, false to disable escape code
support altogether.TableBuilder
instance to continue configuration.public TableBuilder withEscCode(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.withEscCode
in interface TableBuilder
TableBuilder
instance to continue configuration.public TableBuilder withBorderEscCode(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.withBorderEscCode
in interface TableBuilder
TableBuilder
instance to continue configuration.public TableBuilder withTextEscCode(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.withTextEscCode
in interface TableBuilder
TableBuilder
instance to continue configuration.public TableBuilder withHeaderEscCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest ANSI
escape code being set wins.withHeaderEscCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping the
text.TableBuilder
instance to continue configuration.public TableBuilder withRowEscCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The latest ANSI
escape code being set wins.withRowEscCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping the
text.TableBuilder
instance to continue configuration.public TableBuilder withColumnEscCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest ANSI escape code being set wins.withColumnEscCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping the
text.TableBuilder
instance to continue configuration.public TableBuilder withHeaderColumnEscCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest ANSI escape code being set wins.withHeaderColumnEscCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping the
text.TableBuilder
instance to continue configuration.public TableBuilder withRowColumnEscCode(String aAnsiEscCode)
TableBuilder
TableBuilder
instance as of the builder pattern. The
latest ANSI escape code being set wins.withRowColumnEscCode
in interface TableBuilder
aAnsiEscCode
- The String
to be used for ANSI escaping the
text.TableBuilder
instance to continue configuration.public TableBuilder withResetEscCode(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.withResetEscCode
in interface TableBuilder
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 aWidth) 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
aWidth
- The width for the column.TableBuilder
instance to continue configuration.IllegalStateException
- in case there is none column already added.public TableBuilder withColumnWidthMetrics(ColumnWidthMetrics aColumnWidth) throws IllegalStateException
TableBuilder
TableBuilder.addColumn()
method) width and returns this TableBuilder
instance as of the builder pattern.withColumnWidthMetrics
in interface TableBuilder
aColumnWidth
- 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 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
public void printHeaderBegin()
TablePrinter
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the TablePrinter.printHeader(String...)
method. Use this method in case
you need more control on the header construction than
TablePrinter.printHeader(String...)
can provide you.printHeaderBegin
in interface TablePrinter
public void printHeaderContinue(String... aColumns)
TablePrinter
PrintStream
configured for this PrintWriter
, for convenience reasons, this is
being encapsulated by the TablePrinter.printHeader(String...)
method. Use
this method in case you need more control on the header construction than
TablePrinter.printHeader(String...)
can provide you.printHeaderContinue
in interface TablePrinter
public void printHeaderEnd(TableBuilder aTablePrinter)
TablePrinter
TableBuilder
for this table
printer to continue to the PrintStream
configured for this
PrintWriter
; 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.printHeaderEnd
in interface TablePrinter
aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's headers.public void printHeaderEnd()
TablePrinter
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the TablePrinter.printHeader(String...)
method. Use this method in case
you need more control on the header construction than
TablePrinter.printHeader(String...)
can provide you.printHeaderEnd
in interface TablePrinter
public void printRowBegin()
TablePrinter
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the TablePrinter.printRow(String...)
method. Use this method in case you
need more control on the row construction than
TablePrinter.printRow(String...)
can provide you.printRowBegin
in interface TablePrinter
public void printRowContinue(String... aColumns)
TablePrinter
PrintStream
configured for
this PrintWriter
, for convenience reasons, this is being
encapsulated by the TablePrinter.printRow(String...)
method. Use this method
in case you need more control on the header construction than
TablePrinter.printRow(String...)
can provide you.printRowContinue
in interface TablePrinter
public void printRowEnd(TableBuilder aTablePrinter)
TablePrinter
TableBuilder
for this table printer
to continue to the PrintStream
configured for this
PrintWriter
; 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.printRowEnd
in interface TablePrinter
aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's rows.public void printHeader(String... aColumns)
TablePrinter
PrintStream
configured for this
PrintWriter
with the content of the provided columns.printHeader
in interface TablePrinter
aColumns
- The columns to be used in the table's header.public void printRow(String... aColumns)
TablePrinter
PrintStream
configured for
this PrintWriter
with the content of the provided columns. Call
this method for each row to print out.printRow
in interface TablePrinter
aColumns
- The columns to be used in the (next) table's row.public void printTail()
TablePrinter
PrintStream
configured for this PrintWriter
.printTail
in interface TablePrinter
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 © 2016. All rights reserved.