Zebra API Doc

zebra.ui.TextRender Class

Extends zebra.ui.Render

Text render that expects and draws a text model or a string as its target

Constructor

zebra.ui.TextRender

(
  • text
)

Parameters:

Methods

getBottom

() Integer

Inherited from zebra.ui.View:

Get bottom gap. The method informs UI component that uses the view as a border view how much space bottom side of the border occupies


Return: Integer

a bottom gap

getLeft

() Integer

Inherited from zebra.ui.View:

Get left gap. The method informs UI component that uses the view as a border view how much space left side of the border occupies


Return: Integer

a left gap

getLine

(
  • r
)
String

Get text line by the given line number

Parameters:

  • r Integer

    a line number


Return: String

a text line

getLineHeight

(
  • l
)
Integer

Get the given line height in pixels

Parameters:

  • l Integer

    a line number


Return: Integer

a line height in pixels

getLineIndent

() Integer

Get a line indent


Return: Integer

line indent

getLines

() Integer

Get number of lines of target text


Return: Integer

a number of line in the target text

getPreferredSize

() Object

Inherited from zebra.ui.View:

Return preferred size the view desires to have


Return: Object

getRight

() Integer

Inherited from zebra.ui.View:

Get right gap. The method informs UI component that uses the view as a border view how much space right side of the border occupies


Return: Integer

a right gap

getTop

() Integer

Inherited from zebra.ui.View:

Get top gap. The method informs UI component that uses the view as a border view how much space top side of the border occupies


Return: Integer

a top gap

getValue

() String

Get the rendered target text as string object


Return: String

rendered text

invalidate

(
  • start
  • size
)
private

Invalidate metrics for the specified range of lines.

Parameters:

  • start Integer

    first line to be invalidated

  • size Integer

    number of lines to be invalidated

lineWidth

(
  • line
)
Integer

Get the given text line width in pixels

Parameters:

  • line Integer

    a text line number


Return: Integer

a text line width in pixels

ownerChanged

(
  • v
)

Called whenever an owner UI component has been changed

Parameters:

paint

(
  • g
  • x
  • y
  • w
  • h
  • c
)

Inherited from zebra.ui.View:

The method is called to render the decorative element on the given surface of the specified UI component

Parameters:

  • g Canvas 2D context

    graphical context

  • x Integer

    x coordinate

  • y Integer

    y coordinate

  • w Integer

    required width

  • h Integer

    required height

  • c zebra.ui.Panel

    an UI component on which the view element has to be drawn

paintLine

(
  • g
  • x
  • y
  • line
  • d
)

Paint the specified text line

Parameters:

  • g 2DContext

    graphical 2D context

  • x Integer

    x coordinate

  • y Integer

    y coordinate

  • line Integer

    a line number

  • d zebra.ui.Panel

    an UI component on that the line has to be rendered

paintSelection

(
  • g
  • x
  • y
  • w
  • h
  • line
  • d
)
protected

Paint the specified text selection of the given line. The area where selection has to be rendered is denoted with the given rectangular area.

Parameters:

  • g 2DContext

    a canvas graphical context

  • x Integer

    a x coordinate of selection rectangular area

  • y Integer

    a y coordinate of selection rectangular area

  • w Integer

    a width of of selection rectangular area

  • h Integer

    a height of of selection rectangular area

  • line Integer

    [description]

  • d zebra.ui.Panel

    a target UI component where the text has to be rendered

recalc

()

Called every time the target text metrics has to be recalculated

setColor

(
  • c
)
Boolean

Set rendered text color

Parameters:

  • c String

    a text color


Return: Boolean

return true if a text color has been updated

setFont

(
  • f
)
Boolean

Set the rendered text font.

Parameters:

  • f String | zebra.ui.Font

    a font as CSS string or zebra.ui.Font class instance


Return: Boolean

return true if a text font has been updated

setTarget

(
  • o
)

Inherited from zebra.ui.Render:

Set the given target object. The method triggers "targetWasChanged(oldTarget, newTarget)" execution if the method is declared. Implement the method if you need to track a target object updating.

Parameters:

  • o Object

    a target object to be visualized

setValue

(
  • s
)

Set the text model content

Parameters:

  • s String

    a text as string object

textUpdated

(
  • src
  • b
  • off
  • size
  • ful
  • updatedLines
)

Text model update listener handler

Parameters:

  • src zebra.data.TextModel

    text model object

  • b Boolean
  • off Integer

    an offset starting from that the text has been updated

  • size Integer

    a size (in character) of text part that has been updated

  • ful Integer

    a first affected by the given update line

  • updatedLines Integer

    a number of text lines that have been affected by text updating

Attributes

color

String readonly

Text color

Default: zebra.ui.TextRender.color

font

String | zebra.ui.Font readonly

Text font

Default: zebra.ui.TextRender.font

owner

zebra.ui.Panel protected readonly

UI component that holds the text render

Default: null

target

Object readonly

Inherited from zebra.ui.Render:

Target object to be visualized

Default: null