PS
- the paragraph styleS
- the segment's styleCodeArea
, GenericStyledArea
, InlineCssTextArea
, InlineCssTextField
, StyleClassedTextArea
, StyleClassedTextField
, StyledTextArea
, StyledTextField
public interface StyleActions<PS,S>
TextEditingArea
.Type | Property | Description |
---|---|---|
javafx.beans.property.BooleanProperty |
useInitialStyleForInsertion |
Modifier and Type | Method | Description |
---|---|---|
default void |
clearParagraphStyle(int paragraph) |
Resets the style of the given paragraph to the initial style.
|
default void |
clearStyle(int paragraph) |
Resets the style of the given paragraph to the initial style.
|
default void |
clearStyle(int from,
int to) |
Resets the style of the given range to the initial style.
|
default void |
clearStyle(int paragraph,
int from,
int to) |
Resets the style of the given range in the given paragraph
to the initial style.
|
PS |
getInitialParagraphStyle() |
Style used by default when no other style is provided.
|
S |
getInitialTextStyle() |
Style used by default when no other style is provided.
|
PS |
getParagraphStyleForInsertionAt(int pos) |
Returns
getInitialParagraphStyle() if getUseInitialStyleForInsertion() is true;
otherwise, returns the paragraph style at the given position. |
S |
getStyleAtPosition(int position) |
Returns the style at the given position.
|
S |
getStyleAtPosition(int paragraph,
int position) |
Returns the style at the given position in the given paragraph.
|
S |
getStyleOfChar(int index) |
Returns the style of the character with the given index.
|
S |
getStyleOfChar(int paragraph,
int index) |
Returns the style of the character with the given index in the given
paragraph.
|
javafx.scene.control.IndexRange |
getStyleRangeAtPosition(int position) |
Returns the range of homogeneous style that includes the given position.
|
javafx.scene.control.IndexRange |
getStyleRangeAtPosition(int paragraph,
int position) |
Returns the range of homogeneous style that includes the given position
in the given paragraph.
|
StyleSpans<S> |
getStyleSpans(int paragraph) |
Returns styles of the whole paragraph.
|
StyleSpans<S> |
getStyleSpans(int from,
int to) |
Returns the styles in the given character range.
|
StyleSpans<S> |
getStyleSpans(int paragraph,
int from,
int to) |
Returns the styles in the given character range of the given paragraph.
|
default StyleSpans<S> |
getStyleSpans(int paragraph,
javafx.scene.control.IndexRange range) |
Returns the styles in the given character range of the given paragraph.
|
default StyleSpans<S> |
getStyleSpans(javafx.scene.control.IndexRange range) |
Returns the styles in the given character range.
|
S |
getTextStyleForInsertionAt(int pos) |
Returns
getInitialTextStyle() if getUseInitialStyleForInsertion() is true;
otherwise, returns the style at the given position. |
default boolean |
getUseInitialStyleForInsertion() |
Indicates whether the initial style should also be used for plain text
inserted into this text area.
|
boolean |
isPreserveStyle() |
Indicates whether style should be preserved on undo/redo (and in the future copy/paste and text move).
|
void |
setParagraphStyle(int paragraph,
PS paragraphStyle) |
Sets style for the whole paragraph.
|
void |
setStyle(int paragraph,
int from,
int to,
S style) |
Sets style for the given range relative in the given paragraph.
|
void |
setStyle(int from,
int to,
S style) |
Sets style for the given character range.
|
void |
setStyle(int paragraph,
S style) |
Sets style for the whole paragraph.
|
void |
setStyleSpans(int paragraph,
int from,
StyleSpans<? extends S> styleSpans) |
Set multiple style ranges of a paragraph at once.
|
void |
setStyleSpans(int from,
StyleSpans<? extends S> styleSpans) |
Set multiple style ranges at once.
|
default void |
setUseInitialStyleForInsertion(boolean value) |
Sets the value of the property useInitialStyleForInsertion.
|
javafx.beans.property.BooleanProperty |
useInitialStyleForInsertionProperty() |
javafx.beans.property.BooleanProperty useInitialStyleForInsertionProperty
default boolean getUseInitialStyleForInsertion()
false
, the style immediately
preceding the insertion position is used. Default value is false
.default void setUseInitialStyleForInsertion(boolean value)
javafx.beans.property.BooleanProperty useInitialStyleForInsertionProperty()
S getInitialTextStyle()
PS getInitialParagraphStyle()
S getTextStyleForInsertionAt(int pos)
getInitialTextStyle()
if getUseInitialStyleForInsertion()
is true;
otherwise, returns the style at the given position.PS getParagraphStyleForInsertionAt(int pos)
getInitialParagraphStyle()
if getUseInitialStyleForInsertion()
is true;
otherwise, returns the paragraph style at the given position.boolean isPreserveStyle()
S getStyleOfChar(int index)
index
points to a line terminator character,
the last style used in the paragraph terminated by that
line terminator is returned.S getStyleAtPosition(int position)
position
, except when
position
points to a paragraph boundary, in which case it
is the style at the beginning of the latter paragraph.
In other words, most of the time getStyleAtPosition(p)
is equivalent to getStyleOfChar(p-1)
, except when p
points to a paragraph boundary, in which case it is equivalent to
getStyleOfChar(p)
.
javafx.scene.control.IndexRange getStyleRangeAtPosition(int position)
position
points to a boundary between two styled ranges, then
the range preceding position
is returned. If position
points to a boundary between two paragraphs, then the first styled range
of the latter paragraph is returned.StyleSpans<S> getStyleSpans(int from, int to)
default StyleSpans<S> getStyleSpans(javafx.scene.control.IndexRange range)
S getStyleOfChar(int paragraph, int index)
index
is beyond the end of the paragraph, the
style at the end of line is returned. If index
is negative, it
is the same as if it was 0.S getStyleAtPosition(int paragraph, int position)
getStyleOfChar(paragraph, position-1)
.javafx.scene.control.IndexRange getStyleRangeAtPosition(int paragraph, int position)
position
points to a boundary between
two styled ranges, then the range preceding position
is returned.StyleSpans<S> getStyleSpans(int paragraph)
StyleSpans<S> getStyleSpans(int paragraph, int from, int to)
default StyleSpans<S> getStyleSpans(int paragraph, javafx.scene.control.IndexRange range)
void setStyle(int from, int to, S style)
void setStyle(int paragraph, S style)
void setStyle(int paragraph, int from, int to, S style)
void setStyleSpans(int from, StyleSpans<? extends S> styleSpans)
for(StyleSpan<S>
span: styleSpans) {
setStyle(from, from + span.getLength(), span.getStyle());
from += span.getLength();
}
but the actual implementation in SimpleEditableStyledDocument
is
more efficient.void setStyleSpans(int paragraph, int from, StyleSpans<? extends S> styleSpans)
for(StyleSpan<S>
span: styleSpans) {
setStyle(paragraph, from, from + span.getLength(), span.getStyle());
from += span.getLength();
}
but the actual implementation in SimpleEditableStyledDocument
is
more efficient.void setParagraphStyle(int paragraph, PS paragraphStyle)
default void clearStyle(int from, int to)
default void clearStyle(int paragraph, int from, int to)
default void clearStyle(int paragraph)
default void clearParagraphStyle(int paragraph)