PS
- the paragraph style typeSEG
- the segment typeS
- the segment style typepublic final class ReadOnlyStyledDocumentBuilder<PS,SEG,S>
extends java.lang.Object
constructDocument(SegmentOps, Object, Consumer)
or one of its constructors and
build()
for easily creating a ReadOnlyStyledDocument
from a list
of Paragraph
s that is constructed via "addParagraph(s)" methods.Constructor | Description |
---|---|
ReadOnlyStyledDocumentBuilder(SegmentOps<SEG,S> segmentOps,
PS defaultParagraphStyle) |
Creates a builder
|
ReadOnlyStyledDocumentBuilder(SegmentOps<SEG,S> segmentOps,
PS defaultParagraphStyle,
int initialCapacity) |
Creates a builder
|
Modifier and Type | Method | Description |
---|---|---|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(java.util.List<StyledSegment<SEG,S>> styledSegments) |
Adds to the list a paragraph that is constructed using the list of
StyledSegment s. |
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(java.util.List<StyledSegment<SEG,S>> styledSegments,
PS paragraphStyle) |
Adds to the list a paragraph that is constructed using the list of
StyledSegment s. |
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(java.util.List<SEG> segments,
StyleSpans<S> styles) |
Adds to the list a paragraph that has multiple segments with multiple styles throughout those segments
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(java.util.List<SEG> segments,
StyleSpans<S> styles,
PS paragraphStyle) |
Adds to the list a paragraph that has multiple segments with multiple styles throughout those segments
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(SEG segment,
StyleSpans<S> styles) |
Adds to the list a paragraph that has only one segment but a number of different styles throughout that segment
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(SEG segment,
StyleSpans<S> styles,
PS paragraphStyle) |
Adds to the list a paragraph that has only one segment but a number of different styles throughout that segment
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(SEG segment,
S style) |
Adds to the list a paragraph that has only one segment that has the same given style throughout.
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraph(SEG segment,
S style,
PS paragraphStyle) |
Adds to the list a paragraph that has only one segment that has the same given style throughout.
|
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraphs(java.util.List<java.util.List<SEG>> listOfSegLists,
StyleSpans<S> entireDocumentStyleSpans) |
Adds multiple paragraphs to the list, using the
defaultParagraphStyle for each paragraph. |
ReadOnlyStyledDocumentBuilder<PS,SEG,S> |
addParagraphs0(java.util.List<org.reactfx.util.Tuple2<PS,java.util.List<SEG>>> paragraphArgList,
StyleSpans<S> entireDocumentStyleSpans) |
Adds multiple paragraphs to the list, allowing one to specify each paragraph's paragraph style.
|
ReadOnlyStyledDocument<PS,SEG,S> |
build() |
Returns an unmodifiable list of the constructed
Paragraph s and ensures this builder cannot be used again. |
static <PS,SEG,S> ReadOnlyStyledDocument<PS,SEG,S> |
constructDocument(SegmentOps<SEG,S> segmentOps,
PS defaultParagraphStyle,
int initialCapacity,
java.util.function.Consumer<ReadOnlyStyledDocumentBuilder<PS,SEG,S>> configuration) |
Constructs a list of paragraphs
|
static <PS,SEG,S> ReadOnlyStyledDocument<PS,SEG,S> |
constructDocument(SegmentOps<SEG,S> segmentOps,
PS defaultParagraphStyle,
java.util.function.Consumer<ReadOnlyStyledDocumentBuilder<PS,SEG,S>> configuration) |
Constructs a list of paragraphs
|
public ReadOnlyStyledDocumentBuilder(SegmentOps<SEG,S> segmentOps, PS defaultParagraphStyle)
segmentOps
- the SegmentOps
to use for each call to one of the Paragraph
's constructors.defaultParagraphStyle
- the default paragraph style to use when one is not specified in the
"addParagraph"-prefixed methodspublic ReadOnlyStyledDocumentBuilder(SegmentOps<SEG,S> segmentOps, PS defaultParagraphStyle, int initialCapacity)
segmentOps
- the SegmentOps
to use for each call to one of the Paragraph
's constructors.defaultParagraphStyle
- the default paragraph style to use when one is not specified in the
"addParagraph"-prefixed methodsinitialCapacity
- the initial capacity of the underlying ArrayList
.public static <PS,SEG,S> ReadOnlyStyledDocument<PS,SEG,S> constructDocument(SegmentOps<SEG,S> segmentOps, PS defaultParagraphStyle, java.util.function.Consumer<ReadOnlyStyledDocumentBuilder<PS,SEG,S>> configuration)
segmentOps
- the SegmentOps
object to use for one of the Paragraph
's constructorsdefaultParagraphStyle
- the paragraph style object to use when it is not specified in the
"addParagraph" methodsconfiguration
- call the builder's addParagraph(Object, Object)
methods herepublic static <PS,SEG,S> ReadOnlyStyledDocument<PS,SEG,S> constructDocument(SegmentOps<SEG,S> segmentOps, PS defaultParagraphStyle, int initialCapacity, java.util.function.Consumer<ReadOnlyStyledDocumentBuilder<PS,SEG,S>> configuration)
segmentOps
- the SegmentOps
object to use for one of the Paragraph
's constructorsdefaultParagraphStyle
- the paragraph style object to use when it is not specified in the
"addParagraph" methodsinitialCapacity
- the initial capaicty for the underlying ArrayList
configuration
- call the builder's addParagraph(Object, Object)
methods herepublic ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(java.util.List<StyledSegment<SEG,S>> styledSegments)
StyledSegment
s.public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(java.util.List<StyledSegment<SEG,S>> styledSegments, PS paragraphStyle)
StyledSegment
s.public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(SEG segment, S style)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(SEG segment, S style, PS paragraphStyle)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(SEG segment, StyleSpans<S> styles)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(SEG segment, StyleSpans<S> styles, PS paragraphStyle)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(java.util.List<SEG> segments, StyleSpans<S> styles)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraph(java.util.List<SEG> segments, StyleSpans<S> styles, PS paragraphStyle)
public ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraphs(java.util.List<java.util.List<SEG>> listOfSegLists, StyleSpans<S> entireDocumentStyleSpans)
defaultParagraphStyle
for each paragraph. For
more configuration on each paragraph's paragraph style, use addParagraphs0(List, StyleSpans)
listOfSegLists
- each item is the list of segments for a single paragraphentireDocumentStyleSpans
- style spans for the entire document. It's length should be equal to the length
of all the segments' length combinedpublic ReadOnlyStyledDocumentBuilder<PS,SEG,S> addParagraphs0(java.util.List<org.reactfx.util.Tuple2<PS,java.util.List<SEG>>> paragraphArgList, StyleSpans<S> entireDocumentStyleSpans)
paragraphArgList
- each item is a Tuple2 that represents the paragraph style and segment list
for a single paragraph. If the paragraph style is null
,
the defaultParagraphStyle
will be used instead.entireDocumentStyleSpans
- style spans for the entire document. It's length should be equal to the length
of all the segments' length combinedpublic ReadOnlyStyledDocument<PS,SEG,S> build()
Paragraph
s and ensures this builder cannot be used again.