|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.writersforge.catalan.layout.StyledText
A lightweight container for styled text. Used by the renderer and managed by LayoutArea objects.
| Nested Class Summary | |
static class |
StyledText.Span
A single homogeneous span of markup style. |
| Constructor Summary | |
StyledText()
Creates a new default instance of StyledText. |
|
StyledText(java.lang.String text)
Creates a new instance of StyledText with the given unstyled text. |
|
StyledText(java.lang.String text,
TextStyle textStyle)
Creates a new instance of StyledText with the given text and style. |
|
StyledText(TextStyle textStyle)
Creates a new instance of StyledText with the given style. |
|
| Method Summary | |
void |
addMarkup(FontStyle style,
int start,
int end)
Adds Style markup across a given range. |
void |
addText(java.lang.String text)
Appends the given text to the current text using the default style. |
void |
addText(java.lang.String text,
FontStyle style)
Appends the given text to the current text using the given Style. |
void |
clear()
Removes all text and markup. |
FontStyle |
getFontStyle()
Returns the font style of this object |
Markup[] |
getMarkup()
Getter for property markup. |
StyledText.Span[] |
getSpans()
Returns an array of text spans that delimit all changes in text style, i.e., a list of discrete markup regions. |
java.lang.String |
getText()
Returns a plain text version of the text contents. |
int |
getTextHeight(int width)
Calculates the vertical extents of the entire run of text, if the text were wrapped to the given width. |
int |
getTextLength()
Returns the total count of text characters. |
TextStyle |
getTextStyle()
Returns the text style of this object |
java.lang.String[] |
wrapText(int width)
Performs line-wrapping on the text contents. |
java.lang.String[] |
wrapText(int width,
int start,
int end)
Performs line-wrapping on the text contents. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public StyledText()
public StyledText(java.lang.String text)
text - the text contentpublic StyledText(TextStyle textStyle)
textStyle - the style of text in this object
public StyledText(java.lang.String text,
TextStyle textStyle)
text - the text contenttextStyle - the style of text in this object| Method Detail |
public TextStyle getTextStyle()
public FontStyle getFontStyle()
public void clear()
public java.lang.String getText()
public int getTextLength()
public void addText(java.lang.String text)
text - text to append
public void addText(java.lang.String text,
FontStyle style)
text - text to appendstyle - style for the appended textpublic int getTextHeight(int width)
width - how wide to wrap the text, in font points
public Markup[] getMarkup()
public void addMarkup(FontStyle style,
int start,
int end)
style - markup stylestart - starting index of markup along the textend - ending index of markup along the textpublic StyledText.Span[] getSpans()
public java.lang.String[] wrapText(int width)
width - the maximum width of the wrapped text, in font point
units
public java.lang.String[] wrapText(int width,
int start,
int end)
width - the maximum width of the wrapped text, in font point
unitsstart - the starting offset into the StyledText contentend - the end offset into the StyledText content
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||