Class ReadOnlyStyledDocumentBuilder<PS,​SEG,​S>

    • Constructor Detail

      • ReadOnlyStyledDocumentBuilder

        public ReadOnlyStyledDocumentBuilder​(SegmentOps<SEG,​S> segmentOps,
                                             PS defaultParagraphStyle)
        Creates a builder
        Parameters:
        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 methods
      • ReadOnlyStyledDocumentBuilder

        public ReadOnlyStyledDocumentBuilder​(SegmentOps<SEG,​S> segmentOps,
                                             PS defaultParagraphStyle,
                                             int initialCapacity)
        Creates a builder
        Parameters:
        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 methods
        initialCapacity - the initial capacity of the underlying ArrayList.
    • Method Detail

      • constructDocument

        public static <PS,​SEG,​S> ReadOnlyStyledDocument<PS,​SEG,​S> constructDocument​(SegmentOps<SEG,​S> segmentOps,
                                                                                                            PS defaultParagraphStyle,
                                                                                                            int initialCapacity,
                                                                                                            Consumer<ReadOnlyStyledDocumentBuilder<PS,​SEG,​S>> configuration)
        Constructs a list of paragraphs
        Parameters:
        segmentOps - the SegmentOps object to use for one of the Paragraph's constructors
        defaultParagraphStyle - the paragraph style object to use when it is not specified in the "addParagraph" methods
        initialCapacity - the initial capaicty for the underlying ArrayList
        configuration - call the builder's addParagraph(Object, Object) methods here
      • addParagraph

        public 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.
      • addParagraph

        public 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.
      • addParagraphs

        public ReadOnlyStyledDocumentBuilder<PS,​SEG,​S> addParagraphs​(List<List<SEG>> listOfSegLists,
                                                                                 StyleSpans<S> entireDocumentStyleSpans)
        Adds multiple paragraphs to the list, using the defaultParagraphStyle for each paragraph. For more configuration on each paragraph's paragraph style, use addParagraphs0(List, StyleSpans)
        Parameters:
        listOfSegLists - each item is the list of segments for a single paragraph
        entireDocumentStyleSpans - style spans for the entire document. It's length should be equal to the length of all the segments' length combined
      • addParagraphs0

        public ReadOnlyStyledDocumentBuilder<PS,​SEG,​S> addParagraphs0​(List<Tuple2<PS,​List<SEG>>> paragraphArgList,
                                                                                  StyleSpans<S> entireDocumentStyleSpans)
        Adds multiple paragraphs to the list, allowing one to specify each paragraph's paragraph style.
        Parameters:
        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 combined