DVBTextLayoutManager

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.dvb.ui
Class DVBTextLayoutManager

    java.lang.Object
      org.dvb.ui.DVBTextLayoutManager

All Implemented Interfaces:
  HTextLayoutManager

    public class DVBTextLayoutManager

extends Object
implements HTextLayoutManager

The DVBTextLayoutManager provides a text rendering layout mechanism for the org.havi.ui.HStaticText org.havi.ui.HText and org.havi.ui.HTextButton classes.

The semantics of the rendering behaviour and the settings are specified in the "Text presentation" annex of the present document. The DVBTextLayoutManager renders the text according to the semantics described in that annex.

Field Summary
`static int` | `HORIZONTAL_CENTER` The text should be centered horizontally.
`static int` | `HORIZONTAL_END_ALIGN` The text should be horizontally to the horizontal end side (e.g.
`static int` | `HORIZONTAL_START_ALIGN` The text should be aligned horizontally to the horizontal start side (e.g.
`static int` | `LINE_ORIENTATION_HORIZONTAL` Horizontal line orientation.
`static int` | `LINE_ORIENTATION_VERTICAL` Vertical line orientation.
`static int` | `START_CORNER_LOWER_LEFT` Lower left text start corner.
`static int` | `START_CORNER_LOWER_RIGHT` Lower right text start corner.
`static int` | `START_CORNER_UPPER_LEFT` Upper left text start corner.
`static int` | `START_CORNER_UPPER_RIGHT` Upper right text start corner.
`static int` | `VERTICAL_CENTER` The text should be centered vertically.
`static int` | `VERTICAL_END_ALIGN` The text should be aligned vertically to the vertical end side (e.g.
`static int` | `VERTICAL_START_ALIGN` The text should be aligned vertically to the vertical start side (e.g.

Constructor Summary
`DVBTextLayoutManager()` Constructs a DVBTextLayoutManager object with default parameters (HORIZONTAL_START_ALIGN, VERTICAL_START_ALIGN, LINE_ORIENTATION_HORIZONTAL, START_CORNER_UPPER_LEFT, wrap = true, linespace = (point size of the default font for HVisible) + 7, letterspace = 0, horizontalTabSpace = 56)
`DVBTextLayoutManager(int horizontalAlign, int verticalAlign, int lineOrientation, int startCorner, boolean wrap, int linespace, int letterspace, int horizontalTabSpace)` Constructs a DVBTextLayoutManager object.

Method Summary
`void` | `addTextOverflowListener(TextOverflowListener l)` Register a TextOverflowListener that will be notified if the text string does not fit in the component when rendering.
`int` | `getHorizontalAlign()` Get the horizontal alignment.
`int` | `getHorizontalTabSpacing()` Get the horizontal tabulation spacing.
`Insets` | `getInsets()` Returns the insets set by the setInsets method.
`int` | `getLetterSpace()` Get the letter space setting.
`int` | `getLineOrientation()` Get the line orientation.
`int` | `getLineSpace()` Get the line space setting.
`int` | `getStartCorner()` Get the starting corner.
`boolean` | `getTextWrapping()` Get the text wrapping setting.
`int` | `getVerticalAlign()` Get the vertical alignment.
`void` | `removeTextOverflowListener(TextOverflowListener l)` Removes a TextOverflowListener that has been registered previously.
`void` | `render(String markedUpString, Graphics g, HVisible v, Insets insets)` Render the string.
`void` | `setHorizontalAlign(int horizontalAlign)` Set the horizontal alignment.
`void` | `setHorizontalTabSpacing(int horizontalTabSpace)` Set the horizontal tabulation spacing.
`void` | `setInsets(Insets insets)` Sets the insets which shall be used by this DVBTextLayoutManager to provide a "virtual margin".
`void` | `setLetterSpace(int letterSpace)` Set the letter space setting.
`void` | `setLineOrientation(int lineOrientation)` Set the line orientation.
`void` | `setLineSpace(int lineSpace)` Set the line space setting.
`void` | `setStartCorner(int startCorner)` Set the starting corner.
`void` | `setTextWrapping(boolean wrap)` Set the text wrapping setting.
`void` | `setVerticalAlign(int verticalAlign)` Set the vertical alignment.

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

Field Detail

### HORIZONTAL_START_ALIGN

    public static final int HORIZONTAL_START_ALIGN

  The text should be aligned horizontally to the horizontal start side (e.g. when start corner is upper left and line orientation horizontal, meaning text that is read left to right from top to bottom, this implies alignment to left).

  See Also:
    Constant Field Values

### HORIZONTAL_END_ALIGN

    public static final int HORIZONTAL_END_ALIGN

  The text should be horizontally to the horizontal end side (e.g. when start corner is upper left and line orientation horizontal, meaning text that is read left to right from top to bottom, this implies alignment to right).

  See Also:
    Constant Field Values

### HORIZONTAL_CENTER

    public static final int HORIZONTAL_CENTER

  The text should be centered horizontally.

  See Also:
    Constant Field Values

### VERTICAL_START_ALIGN

    public static final int VERTICAL_START_ALIGN

  The text should be aligned vertically to the vertical start side (e.g. when start corner is upper left and line orientation horizontal, meaning text that is read left to right from top to bottom, this implies alignment to top).

  This is defined by the clause "Vertical limits" in the "Text presentation" annex of the present document.

  See Also:
    Constant Field Values

### VERTICAL_END_ALIGN

    public static final int VERTICAL_END_ALIGN

  The text should be aligned vertically to the vertical end side (e.g. when start corner is upper left and line orientation horizontal, meaning text that is read left to right from top to bottom, this implies alignment to bottom).

  This is defined by the clause "Vertical limits" in the "Text presentation" annex of the present document.

  See Also:
    Constant Field Values

### VERTICAL_CENTER

    public static final int VERTICAL_CENTER

  The text should be centered vertically.

  See Also:
    Constant Field Values

### LINE_ORIENTATION_HORIZONTAL

    public static final int LINE_ORIENTATION_HORIZONTAL

  Horizontal line orientation.

  See Also:
    Constant Field Values

### LINE_ORIENTATION_VERTICAL

    public static final int LINE_ORIENTATION_VERTICAL

  Vertical line orientation.

  See Also:
    Constant Field Values

### START_CORNER_UPPER_LEFT

    public static final int START_CORNER_UPPER_LEFT

  Upper left text start corner.

  See Also:
    Constant Field Values

### START_CORNER_UPPER_RIGHT

    public static final int START_CORNER_UPPER_RIGHT

  Upper right text start corner.

  See Also:
    Constant Field Values

### START_CORNER_LOWER_LEFT

    public static final int START_CORNER_LOWER_LEFT

  Lower left text start corner.

  See Also:
    Constant Field Values

### START_CORNER_LOWER_RIGHT

    public static final int START_CORNER_LOWER_RIGHT

  Lower right text start corner.

  See Also:
    Constant Field Values

Constructor Detail

### DVBTextLayoutManager

    public DVBTextLayoutManager()

  Constructs a DVBTextLayoutManager object with default parameters (HORIZONTAL_START_ALIGN, VERTICAL_START_ALIGN, LINE_ORIENTATION_HORIZONTAL, START_CORNER_UPPER_LEFT, wrap = true, linespace = (point size of the default font for HVisible) + 7, letterspace = 0, horizontalTabSpace = 56)

### DVBTextLayoutManager

    public DVBTextLayoutManager(int horizontalAlign,
                                int verticalAlign,
                                int lineOrientation,
                                int startCorner,
                                boolean wrap,
                                int linespace,
                                int letterspace,
                                int horizontalTabSpace)

  Constructs a DVBTextLayoutManager object.

  Parameters:
    `horizontalAlign` - Horizontal alignment setting
    `verticalAlign` - Vertical alignment setting
    `lineOrientation` - Line orientation setting
    `startCorner` - Starting corner setting
    `wrap` - Text wrapping setting
    `linespace` - Line spacing setting expressed in points
    `letterspace` - Letterspacing adjustment relative to the default letterspacing. Expressed in units of 1/256th point as the required increase in the spacing between consecutive characters. May be either positive or negative.
    `horizontalTabSpace` - Horizontal tabulation setting in points

Method Detail

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

### setHorizontalAlign

    public void setHorizontalAlign(int horizontalAlign)

  Set the horizontal alignment. The setting shall be one of `HORIZONTAL_CENTER`, `HORIZONTAL_END_ALIGN` or `HORIZONTAL_START_ALIGN`. The failure mode if other values are used is implementation dependent.

  Parameters:
    `horizontalAlign` - Horizontal alignment setting

### setVerticalAlign

    public void setVerticalAlign(int verticalAlign)

  Set the vertical alignment. The setting shall be one of `VERTICAL_CENTER`, `VERTICAL_END_ALIGN` or `VERTICAL_START_ALIGN`. The failure mode if other values are used is implementation dependent.

  Parameters:
    `verticalAlign` - Vertical alignment setting

### setLineOrientation

    public void setLineOrientation(int lineOrientation)

  Set the line orientation. The setting shall be one of `LINE_ORIENTATION_VERTICAL`, `LINE_ORIENTATION_HORIZONTAL`. The failure mode if other values are used is implementation dependent.

  Parameters:
    `lineOrientation` - Line orientation setting

### setStartCorner

    public void setStartCorner(int startCorner)

  Set the starting corner. The setting shall be one of `START_CORNER_UPPER_LEFT`, `START_CORNER_UPPER_RIGHT`, `START_CORNER_LOWER_LEFT` or `START_CORNER_LOWER_RIGHT`. The failure mode if other values are used is implementation dependent.

  ``
  Parameters:
    `startCorner` - Starting corner setting

### setTextWrapping

    public void setTextWrapping(boolean wrap)

  Set the text wrapping setting.

  Parameters:
    `wrap` - Text wrapping setting

### setLineSpace

    public void setLineSpace(int lineSpace)

  Set the line space setting. Using -1 as the line space setting shall cause the line spacing to be determined from the size of the default font.

  Parameters:
    `lineSpace` - line space setting

### setLetterSpace

    public void setLetterSpace(int letterSpace)

  Set the letter space setting. This is a 16 bit signed integer specifying in units of 1/256th point the required increase in the spacing between consecutive characters. It corresponds to the "track" parameter in the MHP text rendering rules.

  Parameters:
    `letterSpace` - letter space setting

### setHorizontalTabSpacing

    public void setHorizontalTabSpacing(int horizontalTabSpace)

  Set the horizontal tabulation spacing.

  Parameters:
    `horizontalTabSpace` - tab spacing in points

### getHorizontalAlign

    public int getHorizontalAlign()

  Get the horizontal alignment.

  Returns:
    Horizontal alignment setting

### getVerticalAlign

    public int getVerticalAlign()

  Get the vertical alignment.

  Returns:
    Vertical alignment setting

### getLineOrientation

    public int getLineOrientation()

  Get the line orientation.

  Returns:
    Line orientation setting

### getStartCorner

    public int getStartCorner()

  Get the starting corner.

  Returns:
    Starting corner setting

### getTextWrapping

    public boolean getTextWrapping()

  Get the text wrapping setting.

  Returns:
    text wrapping setting

### getLineSpace

    public int getLineSpace()

  Get the line space setting.

  Returns:
    line space setting or -1, if the default line spacing is determined from the size of the default font used.

### getLetterSpace

    public int getLetterSpace()

  Get the letter space setting. This is a 16 bit signed integer specifying in units of 1/256th point the required increase in the spacing between consecutive characters. It corresponds to the "track" parameter in the MHP text rendering rules.

  Returns:
    letter space setting

### getHorizontalTabSpacing

    public int getHorizontalTabSpacing()

  Get the horizontal tabulation spacing.

  Returns:
    the horizontal tabulation spacing

### setInsets

    public void setInsets(Insets insets)

  Sets the insets which shall be used by this DVBTextLayoutManager to provide a "virtual margin". These shall be added to the insets passed to the `Render` method (which are to be considered as "bounds"). If this method is not called, the default insets are 0 at each edge.

  Parameters:
    `insets` - Insets that should be used

### getInsets

    public Insets getInsets()

  Returns the insets set by the setInsets method. These Insets are added to the ones passed to the `render` method for rendering the text. When not previously set, zero Insets are returned.

  Returns:
    Insets set by the setInsets method

### addTextOverflowListener

    public void addTextOverflowListener(TextOverflowListener l)

  Register a TextOverflowListener that will be notified if the text string does not fit in the component when rendering.

  Parameters:
    `l` - a listener object

### removeTextOverflowListener

    public void removeTextOverflowListener(TextOverflowListener l)

  Removes a TextOverflowListener that has been registered previously.

  Parameters:
    `l` - a listener object

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

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