|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
Object
Component
HyperText
public class HyperText
HyperText is multiline text component that supports different text styles and embedded links. All whitespace is treated literally. HyperText requires non-zero preferred width.
All the normal style decorations can be used for text and link spans, with following exceptions:
width: ignored
height: ignored
align: Vertical alignment controls how the text appears in respect to line height.
Horizontal alignment controls how the items on line appear in respect to line.
If there are multiple text spans on single line, the horizontal alignment of
first span is in effect.
border, background: Border and padding are repeated for individual text
span fragments. For instance, if the span covers severals links there will be
a fragment for each line.
HyperText has following special style customizations:
line-spacing: Gap between lines of text, in pixels
| Constructor Summary | |
|---|---|
HyperText(Style style)
Creates a new HyperText. |
|
| Method Summary | |
|---|---|
void |
appendLink(Style style,
String text,
Object data)
Adds a new link span into this hyper text. |
void |
appendMarkup(Map styles,
String markup)
Appends more text into this hyper text using tagged format. |
void |
appendMarkup(String stylePrefix,
String markup)
Appends more text into this hyper text using tagged format. |
void |
appendText(Style style,
String text)
Adds a new text span into this hyper text. |
void |
clear()
Clears the contents of this hyper text component. |
| Methods inherited from class Component |
|---|
add, appendText, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size |
| Methods inherited from class Object |
|---|
toString, equals, hashCode |
| Methods inherited from |
|---|
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HyperText(Style style)
style - Style for this hyper text| Method Detail |
|---|
public void clear()
clear in class Component
public void appendText(Style style,
String text)
style - Text styletext - Text to append
public void appendLink(Style style,
String text,
Object data)
style - Text style. Focused variant is used when link is focused.text - Text to appenddata - Non-null data attachment.
When link is "opened" the OPEN_LINK action is
sent to Script.actionPerformed(Shell, Component, int) or ActionCallback
along with Component that contains the specified data.
public void appendMarkup(Map styles,
String markup)
Appends more text into this hyper text using tagged format. Only simple tags may appear on markup (no support for attributes). All text outside tags is ignored.
Example text:
<h1>Title</h1>
<p>
Quick brown <b>fox</b> jumps over lazy <a DOG1>dog</a>!
</p>
Any tag will become a link if the name of tag is followed by
space character, in which case the rest of tag body is considered as link id string. This
id string can be retrieved from source Component using Component.getData() at
Script.actionPerformed(Shell, Component, int) or ActionCallback callbacks.
The action id of notifying link "opening" is OPEN_LINK.
Links on this HyperText appear child Components; Component.get(int) and Component.size()
can be used to access them.
styles - Collection of text styles (String to Style mappings).
Mappings must match the tags used on markup, for instance, in above example there
must be "h1", "p", "a" and "b" tags.markup - Content to add in tagged format.appendMarkup(String, String)
public void appendMarkup(String stylePrefix,
String markup)
Appends more text into this hyper text using tagged format. Only simple tags may appear on markup (no support for attributes). All text outside tags is ignored. Styles are taken directly from widget stylesheet, optionally prefixed with specified string.
stylePrefix - Optional prefix fo append to tags to form name of stylemarkup - Content to add in tagged format.appendMarkup(Map, String)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||