Class StyleAttributeMap.Builder

java.lang.Object
jfx.incubator.scene.control.richtext.model.StyleAttributeMap.Builder
Enclosing class:
StyleAttributeMap

public static class StyleAttributeMap.Builder extends Object
StyleAttributeMap are immutable, so a Builder is required to create a new instance
Since:
24
  • Method Details

    • build

      public StyleAttributeMap build()
      Creates an immutable instance of StyleAttributeMap with the attributes set by this Builder.
      Returns:
      the new instance
    • set

      public <V> StyleAttributeMap.Builder set(StyleAttribute<V> a, V value)
      Sets the value for the specified attribute. This method will throw an IllegalArgumentException if the value cannot be cast to the type specified by the attribute.
      Type Parameters:
      V - the attribute value type
      Parameters:
      a - the attribute
      value - the attribute value
      Returns:
      this Builder instance
    • merge

      Merges the specified attributes with the attributes in this instance. The new values override any existing ones.
      Parameters:
      attrs - the attributes to merge, may be null
      Returns:
      this Builder instance
    • setBackground

      public StyleAttributeMap.Builder setBackground(Color color)
      Sets the paragraph background attribute to the specified color. It is recommended to specify a translucent background color in order to avoid obstructing the selection and the current line highlights.
      Parameters:
      color - the color
      Returns:
      this Builder instance
    • setBold

      public StyleAttributeMap.Builder setBold(boolean on)
      Sets the bold attribute.
      Parameters:
      on - true for bold typeface
      Returns:
      this Builder instance
    • setBullet

      public StyleAttributeMap.Builder setBullet(String bullet)
      Sets the BULLET attribute.
      Parameters:
      bullet - the bullet character
      Returns:
      this Builder instance
    • setFirstLineIndent

      public StyleAttributeMap.Builder setFirstLineIndent(double size)
      Sets the FIRST_LINE_INDENT attribute.
      Parameters:
      size - the first line indent value
      Returns:
      this Builder instance
    • setFontFamily

      public StyleAttributeMap.Builder setFontFamily(String name)
      Sets the font family attribute.
      Parameters:
      name - the font family name
      Returns:
      this Builder instance
    • setFontSize

      public StyleAttributeMap.Builder setFontSize(double size)
      Sets the font size attribute.
      Parameters:
      size - the font size in points
      Returns:
      this Builder instance
    • setLineSpacing

      public StyleAttributeMap.Builder setLineSpacing(double value)
      Sets the line spacing paragraph attribute.
      Parameters:
      value - the line spacing value
      Returns:
      this Builder instance
    • setItalic

      public StyleAttributeMap.Builder setItalic(boolean on)
      Sets the italic attribute.
      Parameters:
      on - true for italic typeface
      Returns:
      this Builder instance
    • setRTL

      Sets the paragraph direction attribute.
      Parameters:
      d - the paragraph direction
      Returns:
      this Builder instance
    • setSpaceAbove

      public StyleAttributeMap.Builder setSpaceAbove(double value)
      Sets the space above paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
      Parameters:
      value - the space amount
      Returns:
      this Builder instance
    • setSpaceBelow

      public StyleAttributeMap.Builder setSpaceBelow(double value)
      Sets the space below paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
      Parameters:
      value - the space amount
      Returns:
      this Builder instance
    • setSpaceLeft

      public StyleAttributeMap.Builder setSpaceLeft(double value)
      Sets the space left paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
      Parameters:
      value - the space amount
      Returns:
      this Builder instance
    • setSpaceRight

      public StyleAttributeMap.Builder setSpaceRight(double value)
      Sets the space right paragraph attribute. This method also sets SPACE attribute to Boolean.TRUE.
      Parameters:
      value - the space amount
      Returns:
      this Builder instance
    • setStrikeThrough

      public StyleAttributeMap.Builder setStrikeThrough(boolean on)
      Sets the strike-through attribute.
      Parameters:
      on - true for strike-through typeface
      Returns:
      this Builder instance
    • setTextAlignment

      public StyleAttributeMap.Builder setTextAlignment(TextAlignment a)
      Sets the text alignment attribute to the specified color.
      Parameters:
      a - the alignment
      Returns:
      this Builder instance
    • setTextColor

      public StyleAttributeMap.Builder setTextColor(Color color)
      Sets the text color attribute to the specified color.
      Parameters:
      color - the color
      Returns:
      this Builder instance
    • setUnderline

      public StyleAttributeMap.Builder setUnderline(boolean on)
      Sets the underline attribute.
      Parameters:
      on - true for underline
      Returns:
      this Builder instance