Top Description Methods
org.fxmisc.richtext.model

public Interface EditableStyledDocument<PS, SEG, S>

extends StyledDocument<PS, SEG, S>
Known Direct Implementers
org.fxmisc.richtext.model.GenericEditableStyledDocument, org.fxmisc.richtext.model.GenericEditableStyledDocumentBase
Type Parameters
<PS>
the paragraph style type
<SEG>
the segment type
<S>
the segment's style
Imports
javafx.beans.value.ObservableValue, org.reactfx.EventStream, .EventStreamBase, .Subscription, .SuspendableNo, org.reactfx.collection.LiveList, org.reactfx.value.Val, java.util.Arrays, .List

Content model for org.fxmisc.richtext.GenericStyledArea. Specifies edit operations on paragraph's styles, segments (like text), and segments' style, but does not worry about view-related aspects (e.g. scrolling).

Method Summary

Modifier and TypeMethod and Description
public SuspendableNo
public int
public LiveList<Paragraph<PS, SEG, S>>
public boolean
public Val<Integer>
public default EventStream<List<PlainTextChange>>
multiPlainChanges()

Returns an EventStream that emits a List of PlainTextChanges every time a non-style change is made to this document.

public EventStream<List<RichTextChange<PS, SEG, S>>>
multiRichChanges()

Returns an EventStream that emits a List of RichTextChanges every time a change is made to this document, even when such a change does not modify the underlying document in any way.

public default EventStream<PlainTextChange>
plainChanges()

Returns an EventStream that emits each PlainTextChange in multiPlainChanges()'s emitted list.

public default void
replace(Replacement<PS, SEG, S> replacement)

Convenience method for replace(int, int, StyledDocument) using a Replacement argument.

public void
replace(int
the absolute position in the document that starts the portion to replace
start
,
int
the absolute position in the document that ends the portion to replace
end
,
StyledDocument<PS, SEG, S>
the document that replaces the removed portion of this document
replacement
)

Replaces the portion of this document "from..to" with the given replacement.

public void
replaceMulti(List<Replacement<PS, SEG, S>> replacements)

Replaces multiple portions of this document in one update.

public default EventStream<RichTextChange<PS, SEG, S>>
richChanges()

Returns an EventStream that emits each RichTextChange in multiRichChanges()'s emitted list.

public void
setParagraphStyle(int paragraphIndex, PS style)

Sets the given paragraph to the given paragraph style

public void
setStyle(int
the absolute position in the document that starts the range to re-style
from
,
int
the absolute position in the document that ends the range to re-style
to
,
S style)

Sets the style of all segments in the given "from..to" range to the given style.

public void
setStyle(int paragraphIndex, S style)

Sets all segments in the given paragraph to the given style

public void
setStyle(int paragraphIndex, int fromCol, int toCol, S style)

Sets the given range "fromCol..toCol" in the given paragraph to the given style

public void
setStyleSpans(int from, StyleSpans<? extends S> styleSpens)

Replaces the style spans for the given range "from..(from + styleSpans.length())" with the given style spans

public void
setStyleSpans(int paragraphIndex, int from, StyleSpans<? extends S> styleSpens)

Replaces the style spans for the given range "from..(from + styleSpans.length())" in the given paragraph with the given style spans

public ReadOnlyStyledDocument<PS, SEG, S>
snapshot()

Read-only snapshot of the current state of this document.

public ObservableValue<String>
Inherited from org.fxmisc.richtext.model.StyledDocument:
charAtconcatgetAbsolutePositiongetParagraphgetParagraphLengthgetParagraphStylegetParagraphStyleAtPositiongetStyleAtPositiongetStyleAtPositiongetStyleOfChargetStyleOfChargetStyleRangeAtPositiongetStyleRangeAtPositiongetStyleSpansgetStyleSpansgetStyleSpansgetTextgetTextgetTextgetTextlengthsubDocumentsubSequencesubSequence

Method Detail

beingUpdatedPropertyback to summary
public SuspendableNo beingUpdatedProperty()
getLengthback to summary
public int getLength()
getParagraphsback to summary
public LiveList<Paragraph<PS, SEG, S>> getParagraphs()

Redeclares org.fxmisc.richtext.model.StyledDocument.getParagraphs.

Annotations
@Override
isBeingUpdatedback to summary
public boolean isBeingUpdated()
lengthPropertyback to summary
public Val<Integer> lengthProperty()
multiPlainChangesback to summary
public default EventStream<List<PlainTextChange>> multiPlainChanges()

Returns an EventStream that emits a List of PlainTextChanges every time a non-style change is made to this document. A style change would include setting a segment's style, but not changing that segment or setting a paragraph's style. A non-style change would include adding/removing/modifying a segment itself. The emitted list will only have one item in it unless one used replaceMulti(List).

multiRichChangesback to summary
public EventStream<List<RichTextChange<PS, SEG, S>>> multiRichChanges()

Returns an EventStream that emits a List of RichTextChanges every time a change is made to this document, even when such a change does not modify the underlying document in any way. The emitted list will only have one item in it unless one used replaceMulti(List).

plainChangesback to summary
public default EventStream<PlainTextChange> plainChanges()

Returns an EventStream that emits each PlainTextChange in multiPlainChanges()'s emitted list.

replaceback to summary
public default void replace(Replacement<PS, SEG, S> replacement)

Convenience method for replace(int, int, StyledDocument) using a Replacement argument.

replaceback to summary
public void replace(int start, int end, StyledDocument<PS, SEG, S> replacement)

Replaces the portion of this document "from..to" with the given replacement.

Parameters
start:int

the absolute position in the document that starts the portion to replace

end:int

the absolute position in the document that ends the portion to replace

replacement:StyledDocument<PS, SEG, S>

the document that replaces the removed portion of this document

replaceMultiback to summary
public void replaceMulti(List<Replacement<PS, SEG, S>> replacements)

Replaces multiple portions of this document in one update.

richChangesback to summary
public default EventStream<RichTextChange<PS, SEG, S>> richChanges()

Returns an EventStream that emits each RichTextChange in multiRichChanges()'s emitted list.

setParagraphStyleback to summary
public void setParagraphStyle(int paragraphIndex, PS style)

Sets the given paragraph to the given paragraph style

setStyleback to summary
public void setStyle(int from, int to, S style)

Sets the style of all segments in the given "from..to" range to the given style.

Parameters
from:int

the absolute position in the document that starts the range to re-style

to:int

the absolute position in the document that ends the range to re-style

setStyleback to summary
public void setStyle(int paragraphIndex, S style)

Sets all segments in the given paragraph to the given style

setStyleback to summary
public void setStyle(int paragraphIndex, int fromCol, int toCol, S style)

Sets the given range "fromCol..toCol" in the given paragraph to the given style

setStyleSpansback to summary
public void setStyleSpans(int from, StyleSpans<? extends S> styleSpens)

Replaces the style spans for the given range "from..(from + styleSpans.length())" with the given style spans

setStyleSpansback to summary
public void setStyleSpans(int paragraphIndex, int from, StyleSpans<? extends S> styleSpens)

Replaces the style spans for the given range "from..(from + styleSpans.length())" in the given paragraph with the given style spans

snapshotback to summary
public ReadOnlyStyledDocument<PS, SEG, S> snapshot()

Read-only snapshot of the current state of this document.

textPropertyback to summary
public ObservableValue<String> textProperty()