Class TextStyleBuilder


public class TextStyleBuilder extends LabelStyleBuilder
A builder class for TextStyle.
  • Constructor Details

    • TextStyleBuilder

      public TextStyleBuilder()
      Constructs a TextStyleBuilder object with all parameters set to defaults.
  • Method Details

    • getFontName

      public String getFontName()
      Returns the font name for the text label.
      Returns:
      The platform dependent font name for the text label.
    • setFontName

      public void setFontName(String fontName)
      Sets the font name for the text label. Accepts a CSS-like list, the most preferred name first, entries
      optionally tagged with the platform they are for ("android:Roboto, ios:Helvetica Neue,
      sans-serif"). A name the device has no font for is skipped; generic names ("sans-serif",
      "serif", "monospace", "Arial", ...) map to the platform font.
      Parameters:
      fontName - The new platform dependent font name for the text label.
    • getTextField

      public String getTextField()
      Returns the text field variable. If not empty, this variable is used to read actual text string from object meta info.
      Returns:
      The current text variable.
    • setTextField

      public void setTextField(String field)
      Sets the text field variable. If not empty, this variable is used to read actual text string from object meta info.
      Parameters:
      field - The text field to use for displaying text from metainfo.
    • getFontSize

      public float getFontSize()
      Returns the font size for the text label.
      Returns:
      The font size for the text label in points.
    • setFontSize

      public void setFontSize(float size)
      Sets the font size for the text label.
      Parameters:
      size - The new font size for the text label in points.
    • isBreakLines

      public boolean isBreakLines()
      Returns the state of the 'break lines' flag.
      Returns:
      The state of the 'break lines' flag.
    • setBreakLines

      public void setBreakLines(boolean enable)
      Sets the state of the 'break lines' flag.
      If enabled, texts containing CR or NL characters are split into multiple lines.
      By default the flag is false, due to backward compatibility reasons.
    • getTextMargins

      public TextMargins getTextMargins()
      Returns the margins for the text.
      Returns:
      The margins for the text.
    • setTextMargins

      public void setTextMargins(TextMargins textMargins)
      Sets the margins for the text. The margins will determine how much
      empty space should surround the text. The default is TextMargins(0, 0, 0, 0).
      Parameters:
      textMargins - The new margins for the text in dp.
    • getStrokeColor

      public Color getStrokeColor()
      Returns the stroke color for the text label.
      Returns:
      The stroke color for the text label.
    • setStrokeColor

      public void setStrokeColor(Color strokeColor)
      Sets the stroke color for the text label.
      Parameters:
      strokeColor - The new stroke color for the text label.
    • getStrokeWidth

      public float getStrokeWidth()
      Returns the stroke width for the text label.
      Returns:
      The stroke width for the text label in screen density independent pixels.
    • setStrokeWidth

      public void setStrokeWidth(float strokeWidth)
      Sets the stroke width for the text label.
      Parameters:
      strokeWidth - The new stroke width for the text label in screen density independent pixels.
    • getBorderColor

      public Color getBorderColor()
      Returns the border color for the text label.
      Returns:
      The border color for the text label.
    • setBorderColor

      public void setBorderColor(Color borderColor)
      Sets the border color for the text label.
      Parameters:
      borderColor - The new border color for the text label. By default the border color is transparent.
    • getBorderWidth

      public float getBorderWidth()
      Returns the border width for the text label.
      Returns:
      The border width for the text label in screen density independent pixels.
    • setBorderWidth

      public void setBorderWidth(float borderWidth)
      Sets the border width for the text label.
      Parameters:
      borderWidth - The new border width for the text label in screen density independent pixels. By default the border width is 0.
    • getBackgroundColor

      public Color getBackgroundColor()
      Returns the background color for the text label.
      Returns:
      The background color for the text label.
    • setBackgroundColor

      public void setBackgroundColor(Color backgroundColor)
      Sets the background color for the text label.
      Parameters:
      backgroundColor - The new background color for the text label. By default the background color is transparent.
    • buildStyle

      public TextStyle buildStyle()
      Builds a new instance of the TextStyle object using previously set parameters.
      Overrides:
      buildStyle in class LabelStyleBuilder
      Returns:
      A new TextStyle object.