Class RichText.Builder

java.lang.Object
com.codename1.wordprocessing.RichText.Builder
Enclosing class:
RichText

public static final class RichText.Builder extends Object
Accumulates runs into a RichText.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • append

      public RichText.Builder append(String text, TextStyle style)

      Appends a run, merging it into the previous one when the styles are equal. An OBJECT character in plain text is replaced by a space: only append(Inline, ...) places objects.

      Parameters
      • text: the characters; null or empty adds nothing

      • style: their style

      Returns

      this builder

    • append

      public RichText.Builder append(Inline object, TextStyle style)

      Appends an inline object.

      Parameters
      • object: the object; null adds nothing

      • style: the style of its character

      Returns

      this builder

    • append

      public RichText.Builder append(RichText text)

      Appends every run of a text.

      Parameters
      • text: the text to append
      Returns

      this builder

    • length

      public int length()

      The number of characters appended so far.

      Returns

      the length

    • build

      public RichText build()

      The text built so far.

      Returns

      an immutable text