public class DefaultLineWrapper extends AbstractLineWrapper
LineWrapper
.Modifier and Type | Class and Description |
---|---|
protected static class |
DefaultLineWrapper.AutoAdjustInfo |
protected static class |
DefaultLineWrapper.CellBuffer
This inner class represents the buffer used for the text of a text-cell (a line of content inside a
column ). |
protected static class |
DefaultLineWrapper.ColumnState
This class represents the state of a text-column.
|
protected static class |
DefaultLineWrapper.TextSegment
This class represents a segment of some
text . |
protected static class |
DefaultLineWrapper.TextSegmentType
This enum contains the possbile
types of a DefaultLineWrapper.TextSegment . |
Modifier and Type | Field and Description |
---|---|
private HyphenatorBuilder |
hyphenatorBuilder |
Constructor and Description |
---|
DefaultLineWrapper()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
append(Appendable appendable,
DefaultLineWrapper.ColumnState state,
DefaultLineWrapper.CellBuffer cellBuffer)
This method appends the text of a single cell (line of a single column).
|
protected void |
appendCellBuffer(DefaultLineWrapper.ColumnState state,
DefaultLineWrapper.CellBuffer buffer)
This method fills the
DefaultLineWrapper.CellBuffer with the payload for the current cell. |
protected void |
appendWithAlignment(Appendable appendable,
DefaultLineWrapper.ColumnState state,
boolean doIndentThisLine,
DefaultLineWrapper.CellBuffer cellBuffer)
This method actually appends the text for a single line of a single column according to
alignment . |
protected void |
autoAdjustWidthOfColumns(DefaultLineWrapper.ColumnState[] columnStates,
TextTableInfo tableInfo)
This method calculates the
width of the columns to
auto-adjust . |
protected void |
doInitialize()
This method performs the actual
initialization . |
protected void |
fill(Appendable appendable,
char filler,
int count)
|
protected HyphenatorBuilder |
getHyphenatorBuilder() |
private static boolean |
isIn(char c,
char[] chars)
This method determines if the given character
c is contained in chars . |
void |
setHyphenatorBuilder(HyphenatorBuilder hyphenatorBuilder) |
private boolean |
verifyWithOfColumns(DefaultLineWrapper.ColumnState[] columnStates,
TextTableInfo tableInfo)
This method verifies that the width of the columns are sane.
|
int |
wrap(Appendable appendable,
TextTableInfo tableInfo,
TextColumn... columns)
This method is like
LineWrapper.wrap(Appendable, TextTableInfo, String, TextColumnInfo, String, TextColumnInfo, String, TextColumnInfo)
for any number of columns. |
wrap, wrap, wrap
createLogger, getLogger
doInitialized, getInitializationState, initialize
private HyphenatorBuilder hyphenatorBuilder
protected HyphenatorBuilder getHyphenatorBuilder()
@Inject public void setHyphenatorBuilder(HyphenatorBuilder hyphenatorBuilder)
hyphenatorBuilder
- is the hyphenatorBuilder to setprotected void doInitialize()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractLoggableComponent
protected void autoAdjustWidthOfColumns(DefaultLineWrapper.ColumnState[] columnStates, TextTableInfo tableInfo)
width
of the columns to
auto-adjust
.columnStates
- are the DefaultLineWrapper.ColumnState
s.tableInfo
- is the TextTableInfo
containing the available width
.public int wrap(Appendable appendable, TextTableInfo tableInfo, TextColumn... columns)
LineWrapper
LineWrapper.wrap(Appendable, TextTableInfo, String, TextColumnInfo, String, TextColumnInfo, String, TextColumnInfo)
for any number of columns. appendable
- is the target where to append
to.tableInfo
- is the TextTableInfo
for the general layout.columns
- are the columns to append
.appended
excluding the
first line. In other words the number of
line separators
that have been
appended.private boolean verifyWithOfColumns(DefaultLineWrapper.ColumnState[] columnStates, TextTableInfo tableInfo)
columnStates
- are the DefaultLineWrapper.ColumnState
s.tableInfo
- is the TextTableInfo
.true
if the width is sane, false
otherwise.private static boolean isIn(char c, char[] chars)
c
is contained in chars
.c
- is the character to check.chars
- is the array with the matching characters.true
if c
is contained in chars
, false
otherwise.protected void appendCellBuffer(DefaultLineWrapper.ColumnState state, DefaultLineWrapper.CellBuffer buffer)
DefaultLineWrapper.CellBuffer
with the payload for the current cell.state
- is the DefaultLineWrapper.ColumnState
.buffer
- is the DefaultLineWrapper.CellBuffer
.protected void append(Appendable appendable, DefaultLineWrapper.ColumnState state, DefaultLineWrapper.CellBuffer cellBuffer) throws IOException
appendable
- is the Appendable
where to append the text to.state
- the DefaultLineWrapper.ColumnState
of the current column where to fill a single cell.cellBuffer
- is the DefaultLineWrapper.CellBuffer
for the payload of the current cell.IOException
- if caused by the Appendable
.protected void appendWithAlignment(Appendable appendable, DefaultLineWrapper.ColumnState state, boolean doIndentThisLine, DefaultLineWrapper.CellBuffer cellBuffer) throws IOException
alignment
.appendable
- is where to append to.state
- is the current DefaultLineWrapper.ColumnState
.doIndentThisLine
- - true
if the current cell should be indented
, false
otherwise.cellBuffer
- is the text to align and append.IOException
- if throw by the Appendable
.protected void fill(Appendable appendable, char filler, int count) throws IOException
appendable
- is the Appendable
to fill.filler
- is the fill-character
.count
- is the number of fill-characters (filler
) to add.IOException
- if caused by the Appendable
.Copyright © 2001–2016 mmm-Team. All rights reserved.