HDefaultTextLayoutManager

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.havi.ui
Class HDefaultTextLayoutManager

    java.lang.Object
      org.havi.ui.HDefaultTextLayoutManager

All Implemented Interfaces:
  HTextLayoutManager

    public class HDefaultTextLayoutManager

extends Object
implements HTextLayoutManager

The `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.

The parameters to the constructors are as follows, in cases where parameters are not used, then the constructor should use the default values.

### Default parameter values exposed in the constructors

Parameter | Description | Default value | Set method | Get method
--- | --- | --- | --- | ---
None.

### Default parameter values not exposed in the constructors

Description | Default value | Set method | Get method
--- | --- | --- | ---

See Also:
  `HTextLayoutManager`, `HStaticText`, `HText`, `HTextButton`, `HTextLook`, `HVisible`

Constructor Summary
`HDefaultTextLayoutManager()` Creates an `HDefaultTextLayoutManager` object.

Method Summary
`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.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HDefaultTextLayoutManager

    public HDefaultTextLayoutManager()

  Creates an `HDefaultTextLayoutManager` object. See the class description for details of constructor parameters and default values.

Method Detail

### getMinimumSize

    public Dimension getMinimumSize(HVisible hvisible)

  Returns the minimum size required to render the text content in any possible interaction state of the specified `HVisible` component. To achieve this, the maximum width and maximum height of all minimum sizes are returned.

### getMaximumSize

    public Dimension getMaximumSize(HVisible hvisible)

  Returns the maximum size required to render the text content in any possible interaction state of the specified `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.

### getPreferredSize

    public Dimension getPreferredSize(HVisible hvisible)

  Returns the preferred size to render the text content in any possible interaction state of the specified `HVisible` component. To achieve this, the maximum width and maximum height of all preferred sizes are returned.

### render

    public void render(String markedUpString,
                       Graphics g,
                       HVisible v,
                       Insets insets)

  Render the string. The `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.

  Specified by:
    `render` in interface `HTextLayoutManager`
  Parameters:
    `markedUpString` - 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`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD