String).
Every paragraph, even an empty paragraph, must have at least one SEG object
(even if that SEG object itself represents an empty segment).
It corresponds to a single line when the
text is not wrapped or spans multiple lines when the text is wrapped. A Paragraph
contains of a list of SEG objects which make up the individual segments of the
Paragraph. By providing a specific segment object and an associated
segment operations object, all required data and the necessary
operations on this data for a single segment can be provided.
For more complex requirements (for example, when both text and images shall be part
of the document), a different segment type must be provided. One should use something
like Either<String, Image> for their segment type.
Note that Paragraph is an immutable class - to modify a Paragraph, a new
Paragraph object must be created. Paragraph itself contains some methods which
take care of this, such as concat(), which appends some Paragraph to the current
one and returns a new Paragraph.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final TwoLevelNavigator | |
| private final PS | |
| private final SegmentOps | |
| private final List | |
| private List | |
| private final StyleSpans | |
| private String |
| Access | Constructor and Description |
|---|---|
| public | Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, List<StyledSegment<SEG, S>> styledSegments)
Creates a paragraph using a list of styled segments |
| private | Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, Tuple2<List<SEG>, StyleSpans<S>> decomposedList)
|
| public | Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, SEG segment, S style)
Creates a paragraph that has only one segment that has the same given style throughout. |
| public | Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, SEG segment, StyleSpans<S> styles)
Creates a paragraph that has only one segment but a number of different styles throughout that segment |
| public | Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, List<SEG> segments, StyleSpans<S> styles)
Creates a paragraph that has multiple segments with multiple styles throughout those segments |
| Modifier and Type | Method and Description |
|---|---|
| public char | |
| public Paragraph | |
| pack-priv Paragraph | concatR(Paragraph<PS, SEG, S> that)
Similar to |
| private List | |
| private static <SEG, S> Tuple2 | |
| public Paragraph | |
| public boolean | equals(Object other)
Overrides java. Two paragraphs are defined to be equal if they have the same style (as defined by PS.equals) and the same list of segments (as defined by SEG.equals). |
| public PS | |
| public List | |
| public S | |
| public List | getStyledSegments()
Since the segments and styles in a paragraph are stored separate from another, combines these two collections into a single collection where each segment and its corresponding style are grouped into the same object. |
| public S | |
| public IndexRange | getStyleRangeAtPosition(int position)
Returns the range of homogeneous style that includes the given position. |
| public StyleSpans | |
| public StyleSpans | |
| public String | |
| public int | |
| public int | |
| private static <T> List | |
| public Paragraph | Returns: The new paragraph with the restyled segments.The new style for each segment in the paragraph. style)Restyles every segment in the paragraph to have the given style. |
| public Paragraph | |
| public Paragraph | |
| public Paragraph | Returns: A new paragraph with the same segment contents, but a new paragraph style.The new paragraph style paragraphStyle)Creates a new Paragraph which has the same contents as the current Paragraph, but the given paragraph style. |
| public Paragraph | |
| public Paragraph | |
| public String | |
| public String | |
| public String | |
| public Paragraph |
| length | back to summary |
|---|---|
| private int length | |
| navigator | back to summary |
|---|---|
| private final TwoLevelNavigator navigator | |
| paragraphStyle | back to summary |
|---|---|
| private final PS paragraphStyle | |
| segmentOps | back to summary |
|---|---|
| private final SegmentOps<SEG, S> segmentOps | |
| segments | back to summary |
|---|---|
| private final List<SEG> segments | |
| styledSegments | back to summary |
|---|---|
| private List<StyledSegment<SEG, S>> styledSegments | |
| styles | back to summary |
|---|---|
| private final StyleSpans<S> styles | |
| text | back to summary |
|---|---|
| private String text | |
| Paragraph | back to summary |
|---|---|
| public Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, List<StyledSegment<SEG, S>> styledSegments) Creates a paragraph using a list of styled segments | |
| Paragraph | back to summary |
|---|---|
| private Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, Tuple2<List<SEG>, StyleSpans<S>> decomposedList) | |
| Paragraph | back to summary |
|---|---|
| public Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, SEG segment, S style) Creates a paragraph that has only one segment that has the same given style throughout. | |
| Paragraph | back to summary |
|---|---|
| public Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, SEG segment, StyleSpans<S> styles) Creates a paragraph that has only one segment but a number of different styles throughout that segment | |
| Paragraph | back to summary |
|---|---|
| public Paragraph(PS paragraphStyle, SegmentOps<SEG, S> segmentOps, List<SEG> segments, StyleSpans<S> styles) Creates a paragraph that has multiple segments with multiple styles throughout those segments | |
| charAt | back to summary |
|---|---|
| public char charAt(int index) | |
| concat | back to summary |
|---|---|
| public Paragraph Concatenates this paragraph with the given paragraph | |
| concatR | back to summary |
|---|---|
| pack-priv Paragraph Similar to | |
| createStyledSegments | back to summary |
|---|---|
| private List | |
| decompose | back to summary |
|---|---|
| private static <SEG, S> Tuple2 | |
| delete | back to summary |
|---|---|
| public Paragraph | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Two paragraphs are defined to be equal if they have the same style (as defined by PS.equals) and the same list of segments (as defined by SEG.equals).
| |
| getParagraphStyle | back to summary |
|---|---|
| public PS getParagraphStyle() | |
| getSegments | back to summary |
|---|---|
| public List | |
| getStyleAtPosition | back to summary |
|---|---|
| public S getStyleAtPosition(int position) Returns the style at the given position. That is the style of the
character immediately preceding In other words, | |
| getStyledSegments | back to summary |
|---|---|
| public List Since the segments and styles in a paragraph are stored separate from another, combines these two collections
into a single collection where each segment and its corresponding style are grouped into the same object.
Essentially, returns | |
| getStyleOfChar | back to summary |
|---|---|
| public S getStyleOfChar(int charIdx) Returns the style of character with the given index.
If | |
| getStyleRangeAtPosition | back to summary |
|---|---|
| public IndexRange getStyleRangeAtPosition(int position) Returns the range of homogeneous style that includes the given position.
If | |
| getStyleSpans | back to summary |
|---|---|
| public StyleSpans | |
| getStyleSpans | back to summary |
|---|---|
| public StyleSpans | |
| getText | back to summary |
|---|---|
| public String getText() Returns the plain text content of this paragraph, not including the line terminator. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| length | back to summary |
|---|---|
| public int length() | |
| list | back to summary |
|---|---|
private static <T> List
| |
| restyle | back to summary |
|---|---|
| public Paragraph Restyles every segment in the paragraph to have the given style. Note because Paragraph is immutable, this method returns a new Paragraph. The current Paragraph is unchanged.
| |
| restyle | back to summary |
|---|---|
| public Paragraph | |
| restyle | back to summary |
|---|---|
| public Paragraph | |
| setParagraphStyle | back to summary |
|---|---|
| public Paragraph Creates a new Paragraph which has the same contents as the current Paragraph, but the given paragraph style. Note that because Paragraph is immutable, a new Paragraph is returned. Despite the setX name, the current object is unchanged.
| |
| subSequence | back to summary |
|---|---|
| public Paragraph | |
| subSequence | back to summary |
|---|---|
| public Paragraph | |
| substring | back to summary |
|---|---|
| public String substring(int from, int to) | |
| substring | back to summary |
|---|---|
| public String substring(int from) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non-
| |
| trim | back to summary |
|---|---|
| public Paragraph | |