|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.text.base.AbstractLineWrapper
net.sf.mmm.util.text.base.DefaultLineWrapper
@Singleton @Named public class DefaultLineWrapper
This is the default implementation of the
LineWrapper interface.
| Nested Class Summary | |
|---|---|
private 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. |
| Field Summary | |
|---|---|
private HyphenatorBuilder |
hyphenatorBuilder
|
| Constructor Summary | |
|---|---|
DefaultLineWrapper()
The constructor. |
|
| Method Summary | |
|---|---|
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)
This method fills the Appendable with the given count
of filler characters. |
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. |
| Methods inherited from class net.sf.mmm.util.text.base.AbstractLineWrapper |
|---|
wrap, wrap, wrap |
| Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent |
|---|
getLogger, setLogger |
| Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent |
|---|
doInitialized, getInitializationState, initialize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private HyphenatorBuilder hyphenatorBuilder
getHyphenatorBuilder()| Constructor Detail |
|---|
public DefaultLineWrapper()
| Method Detail |
|---|
protected HyphenatorBuilder getHyphenatorBuilder()
@Inject public void setHyphenatorBuilder(HyphenatorBuilder hyphenatorBuilder)
hyphenatorBuilder - is the hyphenatorBuilder to setprotected void doInitialize()
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.ColumnStates.tableInfo - is the TextTableInfo containing the available
width.
public int wrap(Appendable appendable,
TextTableInfo tableInfo,
TextColumn... columns)
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.ColumnStates.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 with the given count
of filler characters.
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||