Package org.fxmisc.richtext.model
Interface StyledDocument<PS,SEG,S>
-
- 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.
- All Superinterfaces:
TwoDimensional
- All Known Subinterfaces:
EditableStyledDocument<PS,SEG,S>
- All Known Implementing Classes:
GenericEditableStyledDocument,ReadOnlyStyledDocument,SimpleEditableStyledDocument
public interface StyledDocument<PS,SEG,S> extends TwoDimensional
An object (document) that is a list of styleableParagraphthat each contain a list of styleable segments.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fxmisc.richtext.model.TwoDimensional
TwoDimensional.Bias, TwoDimensional.Position
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default charcharAt(int index)StyledDocument<PS,SEG,S>concat(StyledDocument<PS,SEG,S> that)default intgetAbsolutePosition(int paragraphIndex, int columnPosition)Returns the absolute position (i.e.default Paragraph<PS,SEG,S>getParagraph(int index)default intgetParagraphLength(int paragraphIndex)List<Paragraph<PS,SEG,S>>getParagraphs()default PSgetParagraphStyle(int paragraph)default PSgetParagraphStyleAtPosition(int position)default SgetStyleAtPosition(int position)default SgetStyleAtPosition(int paragraph, int position)default SgetStyleOfChar(int index)default SgetStyleOfChar(int paragraph, int column)default IndexRangegetStyleRangeAtPosition(int position)default IndexRangegetStyleRangeAtPosition(int paragraph, int position)default StyleSpans<S>getStyleSpans(int paragraph)default StyleSpans<S>getStyleSpans(int from, int to)default StyleSpans<S>getStyleSpans(int paragraph, int from, int to)StringgetText()default StringgetText(int paragraphIndex)default StringgetText(int start, int end)default StringgetText(IndexRange range)intlength()default StyledDocument<PS,SEG,S>subDocument(int paragraphIndex)StyledDocument<PS,SEG,S>subSequence(int start, int end)default StyledDocument<PS,SEG,S>subSequence(IndexRange range)-
Methods inherited from interface org.fxmisc.richtext.model.TwoDimensional
offsetToPosition, position
-
-
-
-
Method Detail
-
length
int length()
-
getText
String getText()
-
concat
StyledDocument<PS,SEG,S> concat(StyledDocument<PS,SEG,S> that)
-
subSequence
StyledDocument<PS,SEG,S> subSequence(int start, int end)
-
getText
default String getText(IndexRange range)
-
getText
default String getText(int start, int end)
-
getText
default String getText(int paragraphIndex)
-
getParagraphLength
default int getParagraphLength(int paragraphIndex)
-
subSequence
default StyledDocument<PS,SEG,S> subSequence(IndexRange range)
-
subDocument
default StyledDocument<PS,SEG,S> subDocument(int paragraphIndex)
-
charAt
default char charAt(int index)
-
getStyleOfChar
default S getStyleOfChar(int index)
-
getStyleOfChar
default S getStyleOfChar(int paragraph, int column)
-
getStyleAtPosition
default S getStyleAtPosition(int position)
-
getStyleAtPosition
default S getStyleAtPosition(int paragraph, int position)
-
getParagraphStyle
default PS getParagraphStyle(int paragraph)
-
getParagraphStyleAtPosition
default PS getParagraphStyleAtPosition(int position)
-
getStyleRangeAtPosition
default IndexRange getStyleRangeAtPosition(int position)
-
getStyleRangeAtPosition
default IndexRange getStyleRangeAtPosition(int paragraph, int position)
-
getStyleSpans
default StyleSpans<S> getStyleSpans(int from, int to)
-
getStyleSpans
default StyleSpans<S> getStyleSpans(int paragraph)
-
getStyleSpans
default StyleSpans<S> getStyleSpans(int paragraph, int from, int to)
-
getAbsolutePosition
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 acolumnPositionvalue of1, 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- The index of the paragraph from which to start.columnPosition- 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))
-
-