org.fxmisc.richtext.model.SimpleEditableStyledDocument Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
Rich-text area for JavaFX
The newest version!
package org.fxmisc.richtext.model;
import java.util.Optional;
import java.util.function.BiFunction;
/**
* Provides an implementation of {@link EditableStyledDocument} that specifies its segment type as {@link String}.
* For a version that can specify the segment's generics, see {@link GenericEditableStyledDocument}.
*/
public final class SimpleEditableStyledDocument extends GenericEditableStyledDocumentBase {
/**
* Creates a document that does not merge consecutive styles
*/
public SimpleEditableStyledDocument(PS initialParagraphStyle, S initialStyle) {
this(initialParagraphStyle, initialStyle, (s1, s2) -> Optional.empty());
}
/**
* Creates a document that uses {@link SegmentOps#styledTextOps(BiFunction)} to operate on segments and merge
* consecutive styles.
*/
public SimpleEditableStyledDocument(PS initialParagraphStyle, S initialStyle,
BiFunction> mergeStyle) {
this(initialParagraphStyle, initialStyle, SegmentOps.styledTextOps(mergeStyle));
}
/**
* Creates a document that uses a custom {@link SegmentOps} to operate on segments and merge styles.
*/
public SimpleEditableStyledDocument(PS initialParagraphStyle, S initialTextStyle, SegmentOps segOps) {
super(initialParagraphStyle, initialTextStyle, segOps);
}
/**
* Creates an {@link EditableStyledDocument} with given paragraph as its initial content
*/
public SimpleEditableStyledDocument(Paragraph initialParagraph) {
super(initialParagraph);
}
/**
* Creates an {@link EditableStyledDocument} with the given document as its initial content
*/
public SimpleEditableStyledDocument(ReadOnlyStyledDocument initialContent) {
super(initialContent);
}
}