Class WrappedText

java.lang.Object
de.xima.fc.common.text.wrap.WrappedText
All Implemented Interfaces:
Serializable

public final class WrappedText extends Object implements Serializable
Represents a piece of text that has been wrapped into lines.

This class is immutable and thread-safe.

Since:
8.4.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    WrappedText(List<WrappedLine> lines, double width, double height)
    Creates a new wrapped text.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the height of the entire piece of text.
    Gets the individual lines that make up the wrapped text.
    Returns the entire text with all lines separated by a single space when not a forced line break, or LF when a forced line break is present.
    text(Newline newline)
    Returns the entire text with all lines separated by the given newline.
     
    double
    Gets the width of the entire piece of text.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • WrappedText

      public WrappedText(List<WrappedLine> lines, double width, double height)
      Creates a new wrapped text.
      Parameters:
      lines - The lines of the wrapped text.
      width - The width of the entire piece of text.
      height - The height of the entire piece of text.
  • Method Details

    • height

      public double height()
      Gets the height of the entire piece of text.
      Returns:
      The height of the text.
    • lines

      public List<WrappedLine> lines()
      Gets the individual lines that make up the wrapped text.
      Returns:
      The lines of the wrapped text.
    • text

      public String text(Newline newline)
      Returns the entire text with all lines separated by the given newline.
      Parameters:
      newline - Newline to use for separating the lines.
      Returns:
      All lines joined with the given newline.
    • text

      public String text()
      Returns the entire text with all lines separated by a single space when not a forced line break, or LF when a forced line break is present.
      Returns:
      All lines joined with a single space or LF.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • width

      public double width()
      Gets the width of the entire piece of text.
      Returns:
      The width of the text.