public class HDefaultTextLayoutManager extends Object implements HTextLayoutManager
HDefaultTextLayoutManager provides the default text rendering
mechanism for the HStaticText
HText and HTextButton classes.
The HDefaultTextLayoutManager handles alignment and justification of
text in both horizontal and vertical directions as specified by the
current alignment modes set on HVisible. It does not support scaling of text content, and the
scaling mode of an associated HVisible
is ignored.
The string passed to the render method may be
multi-line, where each line is separated by a "\n"
(0x0A). If the string does not fit in the space available, the
string shall be truncated and an ellipsis ("...")
appended to indicate the truncation.
The HDefaultTextLayoutManager should query the HVisible passed to its render method to
determine the basic font to render text in. If the specified font
cannot be accessed the default behavior is to replace it with the
nearest builtin font. Each missing character is replaced with an
"!" character.
The antialiasing behavior of HDefaultTextLayoutManager is
platform dependent.
| Parameter | Description | Default value | Set method | Get method |
|---|---|---|---|---|
| None. | ||||
| Description | Default value | Set method | Get method |
|---|
HTextLayoutManager,
HStaticText,
HText,
HTextButton,
HTextLook,
HVisible| Constructor and Description |
|---|
HDefaultTextLayoutManager()
Creates an
HDefaultTextLayoutManager object. |
| Modifier and Type | Method and Description |
|---|---|
Dimension |
getMaximumSize(HVisible hvisible)
Returns the maximum size required to render the text content in any
possible interaction state of the specified
HVisible component. |
Dimension |
getMinimumSize(HVisible hvisible)
Returns the minimum size required to render the text content in any
possible interaction state of the specified
HVisible component. |
Dimension |
getPreferredSize(HVisible hvisible)
Returns the preferred size to render the text content in any
possible interaction state of the specified
HVisible component. |
void |
render(String markedUpString,
Graphics g,
HVisible v,
Insets insets)
Render the string.
|
public HDefaultTextLayoutManager()
HDefaultTextLayoutManager object. See the class description
for details of constructor parameters and default values.public Dimension getMinimumSize(HVisible hvisible)
HVisible component. To achieve this, the maximum width and maximum
height of all minimum sizes are returned.hvisible - a component within which text will be renderedpublic Dimension getMaximumSize(HVisible hvisible)
HVisible component. To achieve this, the maximum width and maximum
height of all maximum sizes are returned. It is a valid
implementation option to return a dimension with a width and height
of Short.MAX_VALUE.hvisible - a component within which text will be renderedpublic Dimension getPreferredSize(HVisible hvisible)
HVisible component. To achieve this, the maximum width and maximum
height of all preferred sizes are returned.hvisible - a component within which text will be renderedpublic void render(String markedUpString, Graphics g, HVisible v, Insets insets)
HTextLayoutManager should use the passed HVisible object to determine any
additional information required to render the string,
e.g. Font, Color etc.
The text should be laid out in the layout area, which is
defined by the bounds of the specified HVisible, after subtracting the
insets. If the insets are null the full bounding
rectangle is used as the area to render text into.
The HTextLayoutManager should not modify the clipping rectangle of
the Graphics object.
render in interface HTextLayoutManagermarkedUpString - the string to render.g - the graphics context, including a clipping rectangle
which encapsulates the area within which rendering is
permitted. If a valid insets value is passed to this method then
text must only be rendered into the bounds of the widget after
the insets are subtracted. If the insets value is null
then text is rendered into the entire bounding area of the HVisible. It is implementation specific whether
or not the renderer takes into account the intersection of the
clipping rectangle in each case for optimization purposes.v - the HVisible into which
to render.insets - the insets to
determine the area in which to layout the text, or null.Copyright © 2012 code4tv.com. All Rights Reserved.