|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.mmm.util.text.api.TextColumnInfo
public class TextColumnInfo
This is a Java-bean for the layout-configuration of a text column.
It contains the width
,
alignment
,
indent
, and various other meta-information
for the layout of a textual column.
LineWrapper
Nested Class Summary | |
---|---|
static class |
TextColumnInfo.IndentationMode
This enum contains the available modes how to deal with indentation after
newlines . |
Field Summary | |
---|---|
private HorizontalAlignment |
alignment
|
private String |
borderLeft
|
private String |
borderRight
|
private char |
filler
|
private String |
indent
|
private TextColumnInfo.IndentationMode |
indentationMode
|
private Locale |
locale
|
static int |
MINIMUM_WIDTH_FOR_INDENT_AND_HYPHEN
The minimum width of a column in
order that indentation and hyphenation will be active. |
private char[] |
omitChars
|
private int |
width
|
static int |
WIDTH_AUTO_ADJUST
The value used for width of a column in order to activate automatic adjustment of the width. |
private char[] |
wrapChars
|
Constructor Summary | |
---|---|
TextColumnInfo()
The constructor. |
Method Summary | |
---|---|
HorizontalAlignment |
getAlignment()
This method gets the alignment . |
String |
getBorderLeft()
This method gets the string for the left border of this column. |
String |
getBorderRight()
This method gets the string for the right border of this column. |
int |
getBorderWidth()
This method gets the auto calculated width of the left and right border . |
char |
getFiller()
This method gets the character used to fill up the column. |
String |
getIndent()
This method gets the indent. |
TextColumnInfo.IndentationMode |
getIndentationMode()
This method gets the TextColumnInfo.IndentationMode that defines when to add an
indentation . |
Locale |
getLocale()
This method gets the Locale to use for this column. |
char[] |
getOmitChars()
This method gets the characters to omit at the beginning of each indented line. |
int |
getWidth()
This method gets the width of this column in characters excluding the left and right border . |
char[] |
getWrapChars()
This method gets the characters where a wrap of the line is preferred. |
void |
setAlignment(HorizontalAlignment alignment)
This method sets the alignment . |
void |
setBorderLeft(String separator)
This method sets the left border string . |
void |
setBorderRight(String separator)
This method sets the right border string . |
void |
setFiller(char filler)
This method sets the filler . |
void |
setIndent(String indent)
This method sets the indent . |
void |
setIndentationMode(TextColumnInfo.IndentationMode indentationMode)
This method sets the indentation-mode . |
void |
setLocale(Locale locale)
This method sets the locale . |
void |
setOmitChars(char... omitChars)
This method sets the characters to omit . |
void |
setWidth(int width)
|
void |
setWrapChars(char... wrapChars)
This method sets the wrap characters . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int MINIMUM_WIDTH_FOR_INDENT_AND_HYPHEN
width
of a column
in
order that indentation
and hyphenation
will be active. The value is
4.
public static final int WIDTH_AUTO_ADJUST
width
of a column
in order to activate automatic adjustment of the width. The value
is -1. Please note that automatic adjustment for
multiple columns needs to pre-process the entire
text
of these columns what costs a little bit
of additional performance.
private int width
getWidth()
private String borderLeft
getBorderLeft()
private String borderRight
getBorderRight()
private char filler
getFiller()
private String indent
getIndent()
private HorizontalAlignment alignment
getAlignment()
private char[] wrapChars
getWrapChars()
private char[] omitChars
getOmitChars()
private TextColumnInfo.IndentationMode indentationMode
getIndentationMode()
private Locale locale
getLocale()
Constructor Detail |
---|
public TextColumnInfo()
Method Detail |
---|
public int getWidth()
left
and right border
.WIDTH_AUTO_ADJUST
(the default). A reasonable value is at least 5,
typically more than 10. However you may use a very low values (<5) for
rendering a small column of a large table, but then do NOT expect nice
results if text is really wrapped.
WIDTH_AUTO_ADJUST
for
automatic calculation of the width.MINIMUM_WIDTH_FOR_INDENT_AND_HYPHEN
public void setWidth(int width)
width
- is the width to setpublic int getBorderWidth()
left
and right border
.
getBorderLeft()
.length() + getBorderRight()
.length()public String getBorderRight()
changed
for all columns except the last
one.
public void setBorderRight(String separator)
right border string
. This is
typically a single character (e.g. ' ' or '|'). However it is also possible
to use the empty string or a sequence of characters.
separator
- is the right border.public String getBorderLeft()
public void setBorderLeft(String separator)
left border string
. This is
typically a single character (e.g. '|'). However it is also possible to use
a sequence of characters.
separator
- is the right border.public String getIndent()
left border
and before the text of the column in
each line except the first one. The exact behavior depends on
getIndentationMode()
. The default is the empty string.width
is less than
MINIMUM_WIDTH_FOR_INDENT_AND_HYPHEN
.alignment
other than left
. However this
might cause confusing results.
getIndentationMode()
public void setIndent(String indent)
indent
.
indent
- is the indent to setpublic HorizontalAlignment getAlignment()
alignment
.
public void setAlignment(HorizontalAlignment alignment)
alignment
.
alignment
- is the HorizontalAlignment
to use.public char getFiller()
public void setFiller(char filler)
filler
.
filler
- is character used to fill up the column.public char[] getWrapChars()
public void setWrapChars(char... wrapChars)
wrap characters
.
wrapChars
- are the wrap characters
.public char[] getOmitChars()
indented
line. E.g. if space (' ') is contained in
getWrapChars()
you can add it to omit chars to prevent the space
to occur at the beginning of the next line.
public void setOmitChars(char... omitChars)
characters to omit
.
omitChars
- are the characters that shall be omitted from the column
text.public TextColumnInfo.IndentationMode getIndentationMode()
TextColumnInfo.IndentationMode
that defines when to add an
indentation
. To turn indentation
off, simply set indent
to the empty string.TextColumnInfo.IndentationMode.NO_INDENT_AFTER_DOUBLE_NEWLINE
.
getIndent()
public void setIndentationMode(TextColumnInfo.IndentationMode indentationMode)
indentation-mode
.
indentationMode
- is the indentationMode to setpublic Locale getLocale()
Locale
to use for this column. It is used for
line wrapping including hyphenation.
public void setLocale(Locale locale)
locale
.
locale
- is the Locale
to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |