Package de.xima.fc.common.text.wrap
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description WrappedText(List<WrappedLine> lines, double width, double height)Creates a new wrapped text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleheight()Gets the height of the entire piece of text.List<WrappedLine>lines()Gets the individual lines that make up the wrapped text.Stringtext()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.Stringtext(Newline newline)Returns the entire text with all lines separated by the given newline.StringtoString()doublewidth()Gets the width of the entire piece of text.
-
-
-
Constructor Detail
-
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 Detail
-
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.
-
width
public double width()
Gets the width of the entire piece of text.- Returns:
- The width of the text.
-
-