Top Description Methods
org.fxmisc.richtext.model

public Interface StyledDocument<PS, SEG, S>

extends TwoDimensional
Known Direct Subinterfaces
org.fxmisc.richtext.model.EditableStyledDocument
Known Direct Implementers
org.fxmisc.richtext.model.ReadOnlyStyledDocument
Type Parameters
<PS>
The type of the paragraph style.
<SEG>
The type of the segments in the paragraph (e.g. String).
<S>
The type of the style of individual segments.
Static Imports
org.fxmisc.richtext.model.TwoDimensional.Bias.*

An object (document) that is a list of styleable Paragraph that each contain a list of styleable segments.

Method Summary

Modifier and TypeMethod and Description
public default char
charAt(int index)

public StyledDocument<PS, SEG, S>
concat(StyledDocument<PS, SEG, S> that)

public default int
getAbsolutePosition(int
The index of the paragraph from which to start.
paragraphIndex
,
int
If positive, the index going forward (the given paragraph's line or the next one(s)). If negative, the index going backward (the previous paragraph's line(s))
columnPosition
)

Returns the absolute position (i.e. the spot in-between characters) of the given column position in the given paragraph.

public default Paragraph<PS, SEG, S>
getParagraph(int index)

public default int
getParagraphLength(int paragraphIndex)

public List<Paragraph<PS, SEG, S>>
public default PS
getParagraphStyle(int paragraph)

public default PS
public default S
getStyleAtPosition(int position)

public default S
getStyleAtPosition(int paragraph, int position)

public default S
getStyleOfChar(int index)

public default S
getStyleOfChar(int paragraph, int column)

public default IndexRange
public default IndexRange
getStyleRangeAtPosition(int paragraph, int position)

public default StyleSpans<S>
getStyleSpans(int from, int to)

public default StyleSpans<S>
getStyleSpans(int paragraph)

public default StyleSpans<S>
getStyleSpans(int paragraph, int from, int to)

public String
public default String
public default String
getText(int start, int end)

public default String
getText(int paragraphIndex)

public int
public default StyledDocument<PS, SEG, S>
subDocument(int paragraphIndex)

public StyledDocument<PS, SEG, S>
subSequence(int start, int end)

public default StyledDocument<PS, SEG, S>
Inherited from org.fxmisc.richtext.model.TwoDimensional:
offsetToPositionposition

Method Detail

charAtback to summary
public default char charAt(int index)
concatback to summary
public StyledDocument<PS, SEG, S> concat(StyledDocument<PS, SEG, S> that)
getAbsolutePositionback to summary
public default int getAbsolutePosition(int paragraphIndex, int columnPosition)

Returns the absolute position (i.e. the spot in-between characters) of the given column position in the given paragraph.

For example, given a text with only one line "text" and a columnPosition value of 1, the value, 1, as in "position 1" would be returned:

 ┌ character index 0
 | ┌ character index 1
 | |   ┌ character index 3
 | |   |
 v v   v

|t|e|x|t|

^ ^     ^
| |     |
| |     └ position 4
| └ position 1
└ position 0

Warning: Off-By-One errors can easily occur

If the column index spans outside of the given paragraph's length, the returned value will pass on to the previous/next paragraph. In other words, given a document with two paragraphs (where the first paragraph's text is "some" and the second "thing"), then the following statements are true:

  • getAbsolutePosition(0, "some".length()) == 4 == getAbsolutePosition(1, -1)
  • getAbsolutePosition(0, "some".length() + 1) == 5 == getAbsolutePosition(1, 0)
Parameters
paragraphIndex:int

The index of the paragraph from which to start.

columnPosition:int

If positive, the index going forward (the given paragraph's line or the next one(s)). If negative, the index going backward (the previous paragraph's line(s))

getParagraphback to summary
public default Paragraph<PS, SEG, S> getParagraph(int index)
getParagraphLengthback to summary
public default int getParagraphLength(int paragraphIndex)
getParagraphsback to summary
public List<Paragraph<PS, SEG, S>> getParagraphs()
getParagraphStyleback to summary
public default PS getParagraphStyle(int paragraph)
getParagraphStyleAtPositionback to summary
public default PS getParagraphStyleAtPosition(int position)
getStyleAtPositionback to summary
public default S getStyleAtPosition(int position)
getStyleAtPositionback to summary
public default S getStyleAtPosition(int paragraph, int position)
getStyleOfCharback to summary
public default S getStyleOfChar(int index)
getStyleOfCharback to summary
public default S getStyleOfChar(int paragraph, int column)
getStyleRangeAtPositionback to summary
public default IndexRange getStyleRangeAtPosition(int position)
getStyleRangeAtPositionback to summary
public default IndexRange getStyleRangeAtPosition(int paragraph, int position)
getStyleSpansback to summary
public default StyleSpans<S> getStyleSpans(int from, int to)
getStyleSpansback to summary
public default StyleSpans<S> getStyleSpans(int paragraph)
getStyleSpansback to summary
public default StyleSpans<S> getStyleSpans(int paragraph, int from, int to)
getTextback to summary
public String getText()
getTextback to summary
public default String getText(IndexRange range)
getTextback to summary
public default String getText(int start, int end)
getTextback to summary
public default String getText(int paragraphIndex)
lengthback to summary
public int length()
subDocumentback to summary
public default StyledDocument<PS, SEG, S> subDocument(int paragraphIndex)
subSequenceback to summary
public StyledDocument<PS, SEG, S> subSequence(int start, int end)
subSequenceback to summary
public default StyledDocument<PS, SEG, S> subSequence(IndexRange range)