Class zebkit.draw.StringRender
extends <zebkit.draw.BaseTextRender>
<zebkit.draw>

Lightweight implementation of single line string render. The render requires a simple string as a target object.

Constructor:
zebkit.draw.StringRender (str, [font], [color])

Parameters:



protected <Integer> calcLineWidth ( )
public <String> getLine (l)
public <Integer> getLines ( )
public <Integer> getLineSize (line)
public <Integer> getMaxOffset ( )
protected void invalidate ( )


protected <Integer> calcLineWidth ( )

Calculates string width if it has not been done yet.


Returns: <Integer>

a string width

public <String> getLine (l)

Get the given line.


Parameters:
  • l <Integer>

    a line number


Returns: <String>

a line

public <Integer> getLines ( )

Implementation of position metric interface. Returns number of lines.


Returns: <Integer>

a number of lines.

public <Integer> getLineSize (line)

Implementation of position metric interface. Returns the given line size (in characters).


Parameters:
  • line <Integer>

    a line number. This render supports only single line.


Returns: <Integer>

a line size

public <Integer> getMaxOffset ( )

Implementation of position metric interface. Returns maximal possible offset within the given string.


Returns: <Integer>

a maximal possible offset.

protected void invalidate ( )

Invalidate the render state. Invalidation flushes string metrics to be re-calculated again.



Inherited attributes:
public Integer lineIndent    protected zebkit.layout.Layoutable owner    public Object target   



public <String> color

Color to be used to render the target string

public <zebkit.Font> font

Font to be used to render the target string

protected <Integer> stringWidth

Calculated string width (in pixels). If string width has not been calculated the value is set to -1.