S
- type of style that can be applied to text.ClipboardActions<PS,SEG,S>
, EditActions<PS,SEG,S>
, NavigationActions<PS,SEG,S>
CodeArea
, GenericStyledArea
, InlineCssTextArea
, InlineCssTextField
, StyleClassedTextArea
, StyleClassedTextField
, StyledTextArea
, StyledTextField
public interface TextEditingArea<PS,SEG,S>
Type | Property | Description |
---|---|---|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
anchor |
|
org.reactfx.SuspendableNo |
beingUpdated |
True when an update to the area's
underling editable document is still occurring
or the viewport is being updated. |
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
caretBounds |
|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
caretColumn |
|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
caretPosition |
|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
currentParagraph |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
length |
|
default javafx.beans.value.ObservableValue<java.lang.String> |
selectedText |
|
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
selectionBounds |
|
default javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> |
selection |
|
default org.reactfx.value.Var<Caret.CaretVisibility> |
showCaret |
|
javafx.beans.value.ObservableValue<java.lang.String> |
text |
Modifier and Type | Method | Description |
---|---|---|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
anchorProperty() |
|
org.reactfx.SuspendableNo |
beingUpdatedProperty() |
True when an update to the area's
underling editable document is still occurring
or the viewport is being updated. |
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
caretBoundsProperty() |
|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
caretColumnProperty() |
|
default javafx.beans.value.ObservableValue<java.lang.Integer> |
caretPositionProperty() |
|
MultiChangeBuilder<PS,SEG,S> |
createMultiChange() |
Starts building a list of changes to be used to update multiple portions of the underlying document
in one call.
|
MultiChangeBuilder<PS,SEG,S> |
createMultiChange(int numOfChanges) |
Same as
createMultiChange() but the number of changes are specified to be more memory efficient. |
default javafx.beans.value.ObservableValue<java.lang.Integer> |
currentParagraphProperty() |
|
void |
displaceCaret(int pos) |
|
void |
dispose() |
Disposes this area, preventing memory leaks.
|
int |
getAbsolutePosition(int paragraphIndex,
int columnIndex) |
Returns the absolute position (i.e.
|
default int |
getAnchor() |
The anchor of the selection.
|
default java.util.Optional<javafx.geometry.Bounds> |
getCaretBounds() |
Gets the bounds of the caret in the Screen's coordinate system or
Optional.empty()
if caret is not visible in the viewport. |
default int |
getCaretColumn() |
The caret position within the current paragraph.
|
default int |
getCaretPosition() |
The current position of the caret, as a character offset in the text.
|
CaretSelectionBind<PS,SEG,S> |
getCaretSelectionBind() |
Gets the area's main
CaretSelectionBind . |
EditableStyledDocument<PS,SEG,S> |
getContent() |
The underlying document of this area that can be displayed by multiple
StyledTextArea s. |
default int |
getCurrentParagraph() |
Index of the current paragraph, i.e.
|
StyledDocument<PS,SEG,S> |
getDocument() |
Rich-text content of this text-editing area.
|
default int |
getLength() |
The number of characters in this text-editing area.
|
default java.util.Locale |
getLocale() |
This is used to determine word and sentence breaks while navigating or selecting.
|
default Paragraph<PS,SEG,S> |
getParagraph(int index) |
|
default int |
getParagraphLength(int index) |
|
javafx.collections.ObservableList<Paragraph<PS,SEG,S>> |
getParagraphs() |
Unmodifiable observable list of paragraphs in this text area.
|
default javafx.scene.control.IndexRange |
getParagraphSelection(int paragraph) |
Returns the selection range in the given paragraph.
|
javafx.scene.control.IndexRange |
getParagraphSelection(Selection selection,
int paragraph) |
|
SegmentOps<SEG,S> |
getSegOps() |
Returns the object used for operating over
segments and their styles |
default java.lang.String |
getSelectedText() |
The selected text.
|
default javafx.scene.control.IndexRange |
getSelection() |
The selection range.
|
default java.util.Optional<javafx.geometry.Bounds> |
getSelectionBounds() |
Gets the bounds of the selection in the Screen's coordinate system if something is selected and visible in the
viewport or
Optional.empty() if selection is not visible in the viewport. |
default Caret.CaretVisibility |
getShowCaret() |
Indicates when this text area should display a caret.
|
default java.lang.String |
getText() |
Text content of this text-editing area.
|
java.lang.String |
getText(int paragraphIndex) |
Returns text content of the given paragraph.
|
java.lang.String |
getText(int start,
int end) |
Returns text content of the given character range.
|
default java.lang.String |
getText(int startParagraph,
int startColumn,
int endParagraph,
int endColumn) |
Returns text content of the given character range.
|
java.lang.String |
getText(javafx.scene.control.IndexRange range) |
Returns text content of the given character range.
|
default boolean |
isBeingUpdated() |
|
javafx.beans.value.ObservableValue<java.lang.Integer> |
lengthProperty() |
|
org.reactfx.EventStream<java.util.List<PlainTextChange>> |
multiPlainChanges() |
|
org.reactfx.EventStream<java.util.List<RichTextChange<PS,SEG,S>>> |
multiRichChanges() |
|
org.reactfx.EventStream<PlainTextChange> |
plainTextChanges() |
|
default void |
replace(int startParagraph,
int startColumn,
int endParagraph,
int endColumn,
StyledDocument<PS,SEG,S> replacement) |
Replaces a range of characters with the given rich-text document.
|
default void |
replace(int startParagraph,
int startColumn,
int endParagraph,
int endColumn,
SEG seg,
S style) |
Replaces a range of characters with the given segment.
|
void |
replace(int start,
int end,
StyledDocument<PS,SEG,S> replacement) |
Replaces a range of characters with the given rich-text document.
|
void |
replace(int start,
int end,
SEG seg,
S style) |
Replaces a range of characters with the given segment.
|
default void |
replace(javafx.scene.control.IndexRange range,
StyledDocument<PS,SEG,S> replacement) |
Equivalent to
replace(range.getStart(), range.getEnd(), replacement) . |
default void |
replace(javafx.scene.control.IndexRange range,
SEG seg,
S style) |
Replaces a range of characters with the given seg.
|
default void |
replaceText(int startParagraph,
int startColumn,
int endParagraph,
int endColumn,
java.lang.String text) |
Replaces a range of characters with the given text.
|
void |
replaceText(int start,
int end,
java.lang.String text) |
Replaces a range of characters with the given text.
|
default void |
replaceText(javafx.scene.control.IndexRange range,
java.lang.String text) |
Replaces a range of characters with the given text.
|
org.reactfx.EventStream<RichTextChange<PS,SEG,S>> |
richChanges() |
|
default javafx.beans.value.ObservableValue<java.lang.String> |
selectedTextProperty() |
|
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> |
selectionBoundsProperty() |
|
default javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> |
selectionProperty() |
|
default void |
selectRange(int anchor,
int caretPosition) |
Positions the anchor and caretPosition explicitly,
effectively creating a selection.
|
default void |
selectRange(int anchorParagraph,
int anchorColumn,
int caretPositionParagraph,
int caretPositionColumn) |
Positions the anchor and caretPosition explicitly,
effectively creating a selection.
|
default void |
setShowCaret(Caret.CaretVisibility value) |
Sets the value of the property showCaret.
|
default org.reactfx.value.Var<Caret.CaretVisibility> |
showCaretProperty() |
|
StyledDocument<PS,SEG,S> |
subDocument(int paragraphIndex) |
Returns rich-text content of the given paragraph.
|
StyledDocument<PS,SEG,S> |
subDocument(int start,
int end) |
Returns rich-text content of the given character range.
|
default StyledDocument<PS,SEG,S> |
subDocument(int startParagraph,
int startColumn,
int endParagraph,
int endColumn) |
Returns rich-text content of the given character range.
|
default StyledDocument<PS,SEG,S> |
subDocument(javafx.scene.control.IndexRange range) |
Returns rich-text content of the given character range.
|
javafx.beans.value.ObservableValue<java.lang.String> |
textProperty() |
javafx.beans.value.ObservableValue<java.lang.Integer> lengthProperty
getLength()
javafx.beans.value.ObservableValue<java.lang.String> textProperty
getText()
default javafx.beans.value.ObservableValue<java.lang.Integer> caretPositionProperty
getCaretPosition()
default javafx.beans.value.ObservableValue<java.lang.Integer> currentParagraphProperty
getCurrentParagraph()
default javafx.beans.value.ObservableValue<java.lang.Integer> caretColumnProperty
getCaretColumn()
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> caretBoundsProperty
getCaretBounds()
default org.reactfx.value.Var<Caret.CaretVisibility> showCaretProperty
default javafx.beans.value.ObservableValue<java.lang.Integer> anchorProperty
getAnchor()
default javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> selectionProperty
getSelection()
default javafx.beans.value.ObservableValue<java.lang.String> selectedTextProperty
getSelectedText()
default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> selectionBoundsProperty
getSelectionBounds()
org.reactfx.SuspendableNo beingUpdatedProperty
underling editable document
is still occurring
or the viewport is being updated.default int getLength()
javafx.beans.value.ObservableValue<java.lang.Integer> lengthProperty()
getLength()
default java.util.Locale getLocale()
default java.lang.String getText()
javafx.beans.value.ObservableValue<java.lang.String> textProperty()
getText()
StyledDocument<PS,SEG,S> getDocument()
EditableStyledDocument<PS,SEG,S> getContent()
StyledTextArea
s.SegmentOps<SEG,S> getSegOps()
segments
and their stylesdefault int getCaretPosition()
default javafx.beans.value.ObservableValue<java.lang.Integer> caretPositionProperty()
getCaretPosition()
default int getCurrentParagraph()
default javafx.beans.value.ObservableValue<java.lang.Integer> currentParagraphProperty()
getCurrentParagraph()
default int getCaretColumn()
default javafx.beans.value.ObservableValue<java.lang.Integer> caretColumnProperty()
getCaretColumn()
default java.util.Optional<javafx.geometry.Bounds> getCaretBounds()
Optional.empty()
if caret is not visible in the viewport.default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> caretBoundsProperty()
getCaretBounds()
default Caret.CaretVisibility getShowCaret()
default void setShowCaret(Caret.CaretVisibility value)
default org.reactfx.value.Var<Caret.CaretVisibility> showCaretProperty()
CaretSelectionBind<PS,SEG,S> getCaretSelectionBind()
CaretSelectionBind
.default int getAnchor()
default javafx.beans.value.ObservableValue<java.lang.Integer> anchorProperty()
getAnchor()
default javafx.scene.control.IndexRange getSelection()
default javafx.beans.value.ObservableValue<javafx.scene.control.IndexRange> selectionProperty()
getSelection()
default java.lang.String getSelectedText()
default javafx.beans.value.ObservableValue<java.lang.String> selectedTextProperty()
getSelectedText()
default java.util.Optional<javafx.geometry.Bounds> getSelectionBounds()
Optional.empty()
if selection is not visible in the viewport.default javafx.beans.value.ObservableValue<java.util.Optional<javafx.geometry.Bounds>> selectionBoundsProperty()
getSelectionBounds()
javafx.collections.ObservableList<Paragraph<PS,SEG,S>> getParagraphs()
default int getParagraphLength(int index)
org.reactfx.SuspendableNo beingUpdatedProperty()
underling editable document
is still occurring
or the viewport is being updated.default boolean isBeingUpdated()
org.reactfx.EventStream<java.util.List<PlainTextChange>> multiPlainChanges()
org.reactfx.EventStream<PlainTextChange> plainTextChanges()
org.reactfx.EventStream<java.util.List<RichTextChange<PS,SEG,S>>> multiRichChanges()
org.reactfx.EventStream<RichTextChange<PS,SEG,S>> richChanges()
java.lang.String getText(int paragraphIndex)
java.lang.String getText(int start, int end)
java.lang.String getText(javafx.scene.control.IndexRange range)
default java.lang.String getText(int startParagraph, int startColumn, int endParagraph, int endColumn)
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
StyledDocument<PS,SEG,S> subDocument(int paragraphIndex)
default StyledDocument<PS,SEG,S> subDocument(javafx.scene.control.IndexRange range)
StyledDocument<PS,SEG,S> subDocument(int start, int end)
default StyledDocument<PS,SEG,S> subDocument(int startParagraph, int startColumn, int endParagraph, int endColumn)
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
default javafx.scene.control.IndexRange getParagraphSelection(int paragraph)
IndexRange(start, paragraph.length() + 1)
when the selection includes a newline character.javafx.scene.control.IndexRange getParagraphSelection(Selection selection, int paragraph)
default void selectRange(int anchor, int caretPosition)
default void selectRange(int anchorParagraph, int anchorColumn, int caretPositionParagraph, int caretPositionColumn)
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
void displaceCaret(int pos)
anchor
or the selection
.
Do not confuse this method with NavigationActions.moveTo(int)
, which is the normal way of moving the
caret. This method can be used to achieve the special case of positioning the caret outside or inside the
selection, as opposed to always being at the boundary. Use with care.void replaceText(int start, int end, java.lang.String text)
0 <= start <= end <= getLength()
.start
- Start index of the range to replace, inclusive.end
- End index of the range to replace, exclusive.text
- The text to put in place of the deleted range.
It must not be null.default void replaceText(int startParagraph, int startColumn, int endParagraph, int endColumn, java.lang.String text)
0 <= start <= end <= getLength()
where
start = getAbsolutePosition(startParagraph, startColumn);
and is inclusive, and
int end = getAbsolutePosition(endParagraph, endColumn);
and is exclusive.
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
text
- The text to put in place of the deleted range.
It must not be null.void replace(int start, int end, StyledDocument<PS,SEG,S> replacement)
MultiChangeBuilder<PS,SEG,S> createMultiChange()
MultiChangeBuilder.commit()
. If the number of
changes are known at compile time, use createMultiChange(int)
for better memory efficiency.MultiChangeBuilder<PS,SEG,S> createMultiChange(int numOfChanges)
createMultiChange()
but the number of changes are specified to be more memory efficient.void replace(int start, int end, SEG seg, S style)
0 <= start <= end <= getLength()
.start
- Start index of the range to replace, inclusive.end
- End index of the range to replace, exclusive.seg
- The seg to put in place of the deleted range.
It must not be null.default void replace(int startParagraph, int startColumn, int endParagraph, int endColumn, SEG seg, S style)
0 <= start <= end <= getLength()
where
start = getAbsolutePosition(startParagraph, startColumn);
and is inclusive, and
int end = getAbsolutePosition(endParagraph, endColumn);
and is exclusive.
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
seg
- The segment to put in place of the deleted range.
It must not be null.default void replace(int startParagraph, int startColumn, int endParagraph, int endColumn, StyledDocument<PS,SEG,S> replacement)
Caution: see getAbsolutePosition(int, int)
to know how the column index argument
can affect the returned position.
default void replaceText(javafx.scene.control.IndexRange range, java.lang.String text)
range
- The range to replace. It must not be null.text
- The text to put in place of the deleted range.
It must not be null.replaceText(int, int, String)
default void replace(javafx.scene.control.IndexRange range, SEG seg, S style)
range
- The range to replace. It must not be null.seg
- The segment to put in place of the deleted range.
It must not be null.replace(int, int, Object, Object)
default void replace(javafx.scene.control.IndexRange range, StyledDocument<PS,SEG,S> replacement)
replace(range.getStart(), range.getEnd(), replacement)
.int getAbsolutePosition(int paragraphIndex, int columnIndex)
For example, given a text with only one line "text"
and the columnIndex value of 1
, "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.columnIndex
- 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)void dispose()