|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.TextFormatter
The TextFormatter provides services for formatting text and
breaking text lines. The formatter pays heed to the FontFormat
of the text and the a transformation the text might be displayed with.
| Field Summary | |
static TextFormatter |
DEFAULT_TEXTFORMATTER
global variable that defines a default text formatter (never change this instance) |
int |
fontunit
instance variable for the unit of the used font |
static int |
KEEP_FIRST_CHARACTER
Constant specifying the mode of this formatter |
static int |
SHORTEN_LINES
Constant specifying the mode of this formatter |
static int |
WRAP_FIRST_WORD_CHARACTERS
Constant specifying the mode of this formatter |
static int |
WRAP_WORDS
Constant specifying the mode of this formatter |
| Constructor Summary | |
TextFormatter(java.lang.String text)
Constructor for TextFormatter specifying the text
String to format. |
|
TextFormatter(TextFormatter textformatter)
Copy-Constructor for TextFormatter. |
|
| Method Summary | |
void |
disableMode(int mode)
Disables the given mode. |
void |
enableMode(int mode)
Enables the given mode. |
FontFormat |
getFontFormat()
Returns the FontFormat of this TextFormatter. |
int[] |
getLineHeights(java.lang.String[] lines)
Returns an array containing the heights of the text lines given by the text-array lines under the given
Transform2D. |
int[] |
getLineHeights(Transform2D xform_context,
ScaleValues scalevalues)
Returns a int-array containg the heights of the text-lines
of this formatter. |
int |
getLineLength()
Returns the set length of text-lines. |
java.lang.String[] |
getLines(Transform2D xform_context,
ScaleValues scalevalues)
Returns a String-array containing the text broken up into
text-lines by means of the settings of this instance. |
int[] |
getLineWidths(java.lang.String[] lines)
Returns a int-array containg the widths of the
String-lines given as a parameter. |
int[] |
getLineWidths(Transform2D xform_context,
ScaleValues scalevalues)
Returns a int-array containg the widths of the broken single
lines of text. |
int |
getMarginBottom()
Returns the bottom margin. |
int |
getMarginLeft()
Returns the left margin. |
int |
getMarginRight()
Returns the right margin. |
int |
getMarginTop()
Returns the top margin. |
int |
getModemask()
Returns the set modemask for this formatter. |
int |
getPreferredHeight(Transform2D xform_context,
ScaleValues scalevalues)
Returns the preferred overall height for the formatted text under the given Transform2D. |
java.lang.String[] |
getPreferredLines()
Returns an array holding the formatted text-lines. |
Size |
getPreferredSize(Transform2D xform_context,
ScaleValues scalevalues)
Returns the preferred overall size (height and width) for the formatted text under the given Transform2D. |
java.lang.String |
getText()
Returns the text. |
int |
getTextHeight(int[] lineHeights)
Returns the sum of all line heights given. |
int |
getTextHeight(java.lang.String[] lines)
Returns the overall height needed for the text lines given in the array lines under the given transformation. |
int |
getTextHeight(Transform2D xform_context,
ScaleValues scalevalues)
Returns the overall height for the formatted text under the given Transform2D. |
Transform2D |
getTransform2D()
Returns the actual set Transform2D of the formatter. |
boolean |
isModeEnabled(int mode)
Returns true if the given mode is enabled. |
void |
setFontFormat(FontFormat font)
Sets the FontFormat used by this formatter. |
void |
setLineLength(int linelength)
Sets the demanded line-length to the one given by linelength. |
void |
setMarginBottom(int marginBottom)
Sets the bottom margin to be used for the formatted text. |
void |
setMarginLeft(int marginLeft)
Sets the left margin to be used for the formatted text. |
void |
setMarginRight(int marginRight)
Sets the right margin to be used for the formatted text. |
void |
setMargins(int marginLeft,
int marginTop,
int marginRight,
int marginBottom)
Sets the left, top, right and bottom margin to the given values. |
void |
setMarginTop(int marginTop)
Sets the top margin to be used for the formatted text. |
void |
setModemask(int modemask)
Sets the mode of this formatter to the given one. |
void |
setText(java.lang.String text)
Sets the text to format the the given text. |
void |
setTransform(Transform2D xform)
Sets the Transform2D to be used for the calculations of this
formatter. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final TextFormatter DEFAULT_TEXTFORMATTER
public static final int SHORTEN_LINES
public static final int WRAP_WORDS
public static final int WRAP_FIRST_WORD_CHARACTERS
public static final int KEEP_FIRST_CHARACTER
public int fontunit
| Constructor Detail |
public TextFormatter(java.lang.String text)
TextFormatter specifying the text
String to format.
text - the text to format.public TextFormatter(TextFormatter textformatter)
TextFormatter.
textformatter - the TextFormatter to be copied.| Method Detail |
public final int getLineLength()
public final void setLineLength(int linelength)
linelength.
linelength - the demanded line-length.public final int getMarginLeft()
public final void setMarginLeft(int marginLeft)
marginLeft - the left margin.public final int getMarginRight()
public final void setMarginRight(int marginRight)
marginRight - the right margin.public final int getMarginTop()
public final void setMarginTop(int marginTop)
marginTop - the top margin.public final int getMarginBottom()
public final void setMarginBottom(int marginBottom)
marginBottom - the bottom margin.
public final void setMargins(int marginLeft,
int marginTop,
int marginRight,
int marginBottom)
marginLeft - the margin on the left.marginTop - the margin on the top.marginRight - the margin on the right.marginBottom - the margin on the bottom.public final java.lang.String getText()
public final void setText(java.lang.String text)
text.
text - the text to format.public final FontFormat getFontFormat()
FontFormat of this TextFormatter.
FontFormat.public final void setFontFormat(FontFormat font)
FontFormat used by this formatter.
font - the FontFormat to be used.public final Transform2D getTransform2D()
Transform2D of the formatter.
Transform2D of the formatter.public final void setTransform(Transform2D xform)
Transform2D to be used for the calculations of this
formatter.
xform - the to use for calculationspublic final int getModemask()
public final void setModemask(int modemask)
SHORTEN_LINES,
WRAP_WORDS and WRAP_FIRST_WORD_CHARACTER.
modemask - the modemask to set.public final boolean isModeEnabled(int mode)
true if the given mode is enabled.
mode - the mode to check.
true if the given mode is enabled.public final void enableMode(int mode)
mode are the
static constants SHORTEN_LINES, WRAP_WORDS and
WRAP_FIRST_WORD_CHARACTER.
mode - the mode to disable.public final void disableMode(int mode)
mode are the
static constants SHORTEN_LINES, WRAP_WORDS and
WRAP_FIRST_WORD_CHARACTER.
mode - the mode to disable.
public final java.lang.String[] getLines(Transform2D xform_context,
ScaleValues scalevalues)
String-array containing the text broken up into
text-lines by means of the settings of this instance.
xform_context - the Transform2D to usescalevalues - the values to scale the font the with
public final int[] getLineWidths(Transform2D xform_context,
ScaleValues scalevalues)
int-array containg the widths of the broken single
lines of text.
xform_context - the Tranform2D to usescalevalues - the values to scale the font the with
public final int[] getLineWidths(java.lang.String[] lines)
int-array containg the widths of the
String-lines given as a parameter.
lines - the text-lines to calculate the widths for.
public final int[] getLineHeights(Transform2D xform_context,
ScaleValues scalevalues)
int-array containg the heights of the text-lines
of this formatter.
xform_context - the Tranform2D to usescalevalues - the values to scale the font the with
public final int[] getLineHeights(java.lang.String[] lines)
lines under the given
Transform2D.
lines - an array holding the text-lines.
public final int getTextHeight(Transform2D xform_context,
ScaleValues scalevalues)
Transform2D.
xform_context - the Transform2D to usescalevalues - the values to scale the font the with
public final int getTextHeight(java.lang.String[] lines)
lines under the given transformation.
lines - an array holding the lines of text.
public final int getTextHeight(int[] lineHeights)
lineHeights - an array holding the line heights.
public final java.lang.String[] getPreferredLines()
public final int getPreferredHeight(Transform2D xform_context,
ScaleValues scalevalues)
Transform2D.
xform_context - the Transform2D to usescalevalues - the values to scale the font the with
public final Size getPreferredSize(Transform2D xform_context,
ScaleValues scalevalues)
Transform2D.
xform_context - the Transform2D to usescalevalues - the values to scale the font the with
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||