protected static class DefaultLineWrapper.ColumnState extends TextColumn
text of
the column and its metadata. Further it holds the
current text-index and acts as some sort of
iterator of text-segments.| Modifier and Type | Field and Description |
|---|---|
private BreakIterator |
breakIterator |
private int |
breakIteratorIndex |
private DefaultLineWrapper.TextSegment |
currentSegment |
private Hyphenator |
hyphenator
The
Hyphenator to use. |
private boolean |
indent |
private DefaultLineWrapper.TextSegment |
nextSegment |
private int |
segmentIndex |
private int |
subsequentNewlineCount |
private int |
textIndex |
private int |
width |
| Constructor and Description |
|---|
ColumnState(String text,
TextColumnInfo columnInfo,
HyphenatorBuilder hyphenatorBuilder)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private static DefaultLineWrapper.TextSegmentType |
getCharacterType(char c)
This method gets the
DefaultLineWrapper.TextSegmentType corresponding to the given character. |
DefaultLineWrapper.TextSegment |
getCurrentSegment()
This method gets the current
DefaultLineWrapper.TextSegment. |
DefaultLineWrapper.TextSegment |
getNextSegment()
This method gets the next
DefaultLineWrapper.TextSegment after the current. |
int |
getSubsequentNewlineCount()
This method gets the current number of subsequent newlines.
|
int |
getTextIndex() |
int |
getWidth()
This method gets the physical
width. |
boolean |
isComplete()
This method determines if this column is complete (all
text is appended). |
boolean |
isIndent() |
private DefaultLineWrapper.TextSegment |
next(DefaultLineWrapper.TextSegment textSegment)
This method
initializes
the given DefaultLineWrapper.TextSegment with the next segment-data from the text. |
boolean |
proceedTextSegment()
This method steps on to the next
DefaultLineWrapper.TextSegment. |
void |
setIndent(boolean indent) |
void |
setTextIndex(int textIndex) |
void |
setWidth(int width) |
getColumnInfo, getTextprivate final Hyphenator hyphenator
Hyphenator to use.private final BreakIterator breakIterator
private int breakIteratorIndex
private int segmentIndex
private int textIndex
private int width
private boolean indent
private DefaultLineWrapper.TextSegment currentSegment
private DefaultLineWrapper.TextSegment nextSegment
private int subsequentNewlineCount
public ColumnState(String text, TextColumnInfo columnInfo, HyphenatorBuilder hyphenatorBuilder)
text - is the text.columnInfo - is the column-info.hyphenatorBuilder - is the HyphenatorBuilder.public DefaultLineWrapper.TextSegment getCurrentSegment()
DefaultLineWrapper.TextSegment. Initially this is the first DefaultLineWrapper.TextSegment
available.DefaultLineWrapper.TextSegment or null if all DefaultLineWrapper.TextSegments are proceeded.proceedTextSegment()public DefaultLineWrapper.TextSegment getNextSegment()
DefaultLineWrapper.TextSegment after the current. This
method exists for lookahead decisions.DefaultLineWrapper.TextSegment or null if NOT available ( current segment is the last segment or also null).public int getSubsequentNewlineCount()
current
segment is a DefaultLineWrapper.TextSegmentType.NEWLINE, this method will return the number of
DefaultLineWrapper.TextSegmentType.NEWLINE segments (including the current) that occurred since the last other
segment. Otherwise it will always return 0.DefaultLineWrapper.TextSegmentType.NEWLINE segments
including the current segment or 0 if the
current segment is no DefaultLineWrapper.TextSegmentType.NEWLINE.public boolean proceedTextSegment()
DefaultLineWrapper.TextSegment. The current segment
is set to the next segment and the next segment is
set to the next determined segment.true if a new current segment is available, false
if the entire text has been proceeded.private DefaultLineWrapper.TextSegment next(DefaultLineWrapper.TextSegment textSegment)
initializes
the given DefaultLineWrapper.TextSegment with the next segment-data from the text.textSegment - a previous DefaultLineWrapper.TextSegment that can be reused.DefaultLineWrapper.TextSegment with the next segment-data or null if the text is completed.private static DefaultLineWrapper.TextSegmentType getCharacterType(char c)
DefaultLineWrapper.TextSegmentType corresponding to the given character.c - is the character to check.DefaultLineWrapper.TextSegmentType.public int getTextIndex()
public void setTextIndex(int textIndex)
textIndex - is the textIndex to setpublic boolean isIndent()
public void setIndent(boolean indent)
indent - is the indent to setpublic int getWidth()
width. A value of
TextColumnInfo.WIDTH_AUTO_ADJUST is replaced with a physical value.width.public void setWidth(int width)
width - is the width to setpublic boolean isComplete()
text is appended).true if complete, false otherwise.Copyright © 2001–2016 mmm-Team. All rights reserved.