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 styleableParagraph
that 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 char
charAt(int index)
StyledDocument<PS,SEG,S>
concat(StyledDocument<PS,SEG,S> that)
default int
getAbsolutePosition(int paragraphIndex, int columnPosition)
Returns the absolute position (i.e.default Paragraph<PS,SEG,S>
getParagraph(int index)
default int
getParagraphLength(int paragraphIndex)
java.util.List<Paragraph<PS,SEG,S>>
getParagraphs()
default PS
getParagraphStyle(int paragraph)
default PS
getParagraphStyleAtPosition(int position)
default S
getStyleAtPosition(int position)
default S
getStyleAtPosition(int paragraph, int position)
default S
getStyleOfChar(int index)
default S
getStyleOfChar(int paragraph, int column)
default javafx.scene.control.IndexRange
getStyleRangeAtPosition(int position)
default javafx.scene.control.IndexRange
getStyleRangeAtPosition(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)
java.lang.String
getText()
default java.lang.String
getText(int paragraphIndex)
default java.lang.String
getText(int start, int end)
default java.lang.String
getText(javafx.scene.control.IndexRange range)
int
length()
default StyledDocument<PS,SEG,S>
subDocument(int paragraphIndex)
StyledDocument<PS,SEG,S>
subSequence(int start, int end)
default StyledDocument<PS,SEG,S>
subSequence(javafx.scene.control.IndexRange range)
-
Methods inherited from interface org.fxmisc.richtext.model.TwoDimensional
offsetToPosition, position
-
-
-
-
Method Detail
-
length
int length()
-
getText
java.lang.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 java.lang.String getText(javafx.scene.control.IndexRange range)
-
getText
default java.lang.String getText(int start, int end)
-
getText
default java.lang.String getText(int paragraphIndex)
-
getParagraphLength
default int getParagraphLength(int paragraphIndex)
-
subSequence
default StyledDocument<PS,SEG,S> subSequence(javafx.scene.control.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 javafx.scene.control.IndexRange getStyleRangeAtPosition(int position)
-
getStyleRangeAtPosition
default javafx.scene.control.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 acolumnPosition
value 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))
-
-