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.TwoDimensional
EditableStyledDocument<PS,SEG,S>
GenericEditableStyledDocument
, ReadOnlyStyledDocument
, SimpleEditableStyledDocument
public interface StyledDocument<PS,SEG,S> extends TwoDimensional
Paragraph
that each contain a list of styleable segments.TwoDimensional.Bias, TwoDimensional.Position
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) |
offsetToPosition, position
int length()
java.lang.String getText()
StyledDocument<PS,SEG,S> concat(StyledDocument<PS,SEG,S> that)
StyledDocument<PS,SEG,S> subSequence(int start, int end)
default java.lang.String getText(javafx.scene.control.IndexRange range)
default java.lang.String getText(int start, int end)
default java.lang.String getText(int paragraphIndex)
default int getParagraphLength(int paragraphIndex)
default StyledDocument<PS,SEG,S> subSequence(javafx.scene.control.IndexRange range)
default StyledDocument<PS,SEG,S> subDocument(int paragraphIndex)
default char charAt(int index)
default S getStyleOfChar(int index)
default S getStyleOfChar(int paragraph, int column)
default S getStyleAtPosition(int position)
default S getStyleAtPosition(int paragraph, int position)
default PS getParagraphStyle(int paragraph)
default PS getParagraphStyleAtPosition(int position)
default javafx.scene.control.IndexRange getStyleRangeAtPosition(int position)
default javafx.scene.control.IndexRange getStyleRangeAtPosition(int paragraph, int position)
default StyleSpans<S> getStyleSpans(int from, int to)
default StyleSpans<S> getStyleSpans(int paragraph)
default StyleSpans<S> getStyleSpans(int paragraph, int from, int to)
default int getAbsolutePosition(int paragraphIndex, int columnPosition)
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
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)
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))