Zebra API Doc

zebra.ui.Label Class

Label UI component class. The label can be used to visualize simple string or multi lines text or the given text render implementation:

   // render simple string
   var l = new zebra.ui.Label("Simple string");

   // render multi lines text
   var l = new zebra.ui.Label(new zebra.data.Text("Multiline\ntext"));

   // render password text
   var l = new zebra.ui.Label(new zebra.ui.PasswordText("password"));

Constructor

zebra.ui.Label

(
  • [r]
)

Parameters:

  • [r] String | zebra.data.TextModel | zebra.ui.TextRender optional

    a text to be shown with the label. You can pass a simple string or an instance of a text model or an instance of text render as the text value.

Methods

calcPreferredSize

(
  • t
)
Object

Inherited from zebra.ui.ViewPan:

Override the parent method to calculate preferred size basing on a target view.

Parameters:


Return: Object

return a target view preferred size if it is defined. The returned structure is the following: { width: {Integer}, height:{Integer} }

getColor

() String

Get the label text color


Return: String

a zebra label color

getFont

() zebra.ui.Font

Get the label text font


Return: zebra.ui.Font

a zebra label font

getValue

() String

Get the label text


Return: String

a zebra label text

setColor

(
  • c
)
chainable

Set the label text color

Parameters:

  • c String

    a text color

setFont

(
  • f
)
chainable

Set the label text font

Parameters:

setValue

(
  • s
)
chainable

Set the label text value

Parameters:

  • s String

    a new label text

setView

(
  • v
)
chainable

Inherited from zebra.ui.ViewPan:

Set the target view to be wrapped with the UI component

Parameters:

  • v zebra.ui.View | Function

    a view or a rendering view "paint(g,x,y,w,h,c)" function

Attributes

view

zebra.ui.View readonly

Inherited from zebra.ui.ViewPan:

Reference to a view that the component visualize

Default: null