Type | Property and Description |
---|---|
ReadOnlyIntegerProperty |
anchor
The
anchor of the text selection. |
ReadOnlyIntegerProperty |
caretPosition
The current position of the caret within the text.
|
BooleanProperty |
editable
Indicates whether this TextInputControl can be edited by the user.
|
<any> |
font
The default font to use for text in the TextInputControl.
|
ReadOnlyIntegerProperty |
length
The number of characters in the text input.
|
StringProperty |
promptText
The prompt text to display in the
TextInputControl . |
ReadOnlyBooleanProperty |
redoable
The property describes if it's currently possible to redo the latest change of the content that was undone.
|
ReadOnlyStringProperty |
selectedText
Defines the characters in the TextInputControl which are selected
|
<any> |
selection
The current selection.
|
<any> |
textFormatter
The property contains currently attached
TextFormatter . |
StringProperty |
text
The textual content of this TextInputControl.
|
ReadOnlyBooleanProperty |
undoable
The property describes if it's currently possible to undo the latest change of the content that was done.
|
contextMenuProperty, skinClassNameProperty, skinProperty, tooltipProperty
Modifier and Type | Class and Description |
---|---|
protected static interface |
TextInputControl.Content
Interface representing a text input's content.
|
private static class |
TextInputControl.StyleableProperties |
private class |
TextInputControl.TextInputControlFromatterAccessor |
private class |
TextInputControl.TextProperty |
(package private) static class |
TextInputControl.UndoRedoChange
Used to form a linked-list of Undo / Redo changes.
|
Modifier and Type | Field and Description |
---|---|
private FormatterAccessor |
accessor |
private ReadOnlyIntegerWrapper |
anchor
The
anchor of the text selection. |
private ReadOnlyIntegerWrapper |
caretPosition
The current position of the caret within the text.
|
private java.text.BreakIterator |
charIterator
The break iterator instances for navigation over words and complex characters.
|
private TextInputControl.Content |
content |
private boolean |
createNewUndoRecord |
private BooleanProperty |
editable
Indicates whether this TextInputControl can be edited by the user.
|
private <any> |
font |
private ReadOnlyIntegerWrapper |
length
The number of characters in the text input.
|
private StringProperty |
promptText
The prompt text to display in the
TextInputControl . |
private static PseudoClass |
PSEUDO_CLASS_READONLY
*
Stylesheet Handling *
*
|
private ReadOnlyBooleanWrapper |
redoable
The property describes if it's currently possible to redo the latest change of the content that was undone.
|
private ReadOnlyStringWrapper |
selectedText
Defines the characters in the TextInputControl which are selected
|
private <any> |
selection
The current selection.
|
private TextInputControl.TextProperty |
text
The textual content of this TextInputControl.
|
private <any> |
textFormatter
The property contains currently attached
TextFormatter . |
private ReadOnlyBooleanWrapper |
undoable
The property describes if it's currently possible to undo the latest change of the content that was done.
|
private TextInputControl.UndoRedoChange |
undoChange |
private TextInputControl.UndoRedoChange |
undoChangeHead |
private java.text.BreakIterator |
wordIterator |
Modifier | Constructor and Description |
---|---|
protected |
TextInputControl(TextInputControl.Content content)
Creates a new TextInputControl.
|
Modifier and Type | Method and Description |
---|---|
ReadOnlyIntegerProperty |
anchorProperty()
The
anchor of the text selection. |
void |
appendText(java.lang.String text)
Appends a sequence of characters to the content.
|
void |
backward()
Moves the caret position backward.
|
void |
cancelEdit()
If the field is currently being edited, this call will set text to the last commited value.
|
ReadOnlyIntegerProperty |
caretPositionProperty()
The current position of the caret within the text.
|
void |
clear()
Clears the text.
|
void |
commitValue()
Commit the current text and convert it to a value.
|
(package private) static boolean |
containsInvalidCharacters(java.lang.String txt,
boolean newlineIllegal,
boolean tabIllegal) |
void |
copy()
Transfers the currently selected range in the text to the clipboard,
leaving the current selection.
|
void |
cut()
Transfers the currently selected range in the text to the clipboard,
removing the current selection.
|
boolean |
deleteNextChar()
Deletes the character that follows the current caret position from the
text if there is no selection, or deletes the selection if there is one.
|
boolean |
deletePreviousChar()
Deletes the character that precedes the current caret position from the
text if there is no selection, or deletes the selection if there is one.
|
void |
deleteText(IndexRange range)
Removes a range of characters from the content.
|
void |
deleteText(int start,
int end)
Removes a range of characters from the content.
|
void |
deselect()
Clears the selection.
|
private void |
doSelectRange(int anchor,
int caretPosition) |
BooleanProperty |
editableProperty()
Indicates whether this TextInputControl can be edited by the user.
|
void |
end()
Moves the caret to after the last char of the text.
|
void |
endOfNextWord()
Moves the caret to the end of the next word.
|
private void |
endOfNextWord(boolean select) |
void |
executeAccessibleAction(AccessibleAction action,
java.lang.Object... parameters) |
void |
extendSelection(int pos)
This function will extend the selection to include the specified pos.
|
private boolean |
filterAndSet(java.lang.String value) |
(package private) static java.lang.String |
filterInput(java.lang.String txt,
boolean stripNewlines,
boolean stripTabs)
A little utility method for stripping out unwanted characters.
|
<any> |
fontProperty()
The default font to use for text in the TextInputControl.
|
void |
forward()
Moves the caret position forward.
|
int |
getAnchor()
Gets the value of the property anchor.
|
int |
getCaretPosition()
Gets the value of the property caretPosition.
|
static java.util.List<<any>> |
getClassCssMetaData() |
protected TextInputControl.Content |
getContent()
Returns the text input's content model.
|
java.util.List<<any>> |
getControlCssMetaData() |
Font |
getFont()
Gets the value of the property font.
|
private FormatterAccessor |
getFormatterAccessor() |
int |
getLength()
Gets the value of the property length.
|
java.lang.String |
getPromptText()
Gets the value of the property promptText.
|
java.lang.String |
getSelectedText()
Gets the value of the property selectedText.
|
IndexRange |
getSelection()
Gets the value of the property selection.
|
java.lang.String |
getText()
Gets the value of the property text.
|
java.lang.String |
getText(int start,
int end)
Returns a subset of the text input's content.
|
TextFormatter<?> |
getTextFormatter()
Gets the value of the property textFormatter.
|
void |
home()
Moves the caret to before the first char of the text.
|
void |
insertText(int index,
java.lang.String text)
Inserts a sequence of characters into the content.
|
boolean |
isEditable()
Gets the value of the property editable.
|
private static boolean |
isInvalidCharacter(char c,
boolean newlineIllegal,
boolean tabIllegal) |
boolean |
isRedoable()
Gets the value of the property redoable.
|
boolean |
isUndoable()
Gets the value of the property undoable.
|
ReadOnlyIntegerProperty |
lengthProperty()
The number of characters in the text input.
|
void |
nextWord()
Moves the caret to the beginning of next word.
|
private void |
nextWord(boolean select) |
void |
paste()
Transfers the contents in the clipboard into this text,
replacing the current selection.
|
void |
positionCaret(int pos)
Positions the caret to the position indicated by
pos . |
void |
previousWord()
Moves the caret to the beginning of previous word.
|
private void |
previousWord(boolean select) |
StringProperty |
promptTextProperty()
The prompt text to display in the
TextInputControl . |
java.lang.Object |
queryAccessibleAttribute(AccessibleAttribute attribute,
java.lang.Object... parameters) |
void |
redo()
If possible, redoes the last undone modification.
|
ReadOnlyBooleanProperty |
redoableProperty()
The property describes if it's currently possible to redo the latest change of the content that was undone.
|
void |
replaceSelection(java.lang.String replacement)
Replaces the selection with the given replacement String.
|
void |
replaceText(IndexRange range,
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.
|
private int |
replaceText(int start,
int end,
java.lang.String value,
int anchor,
int caretPosition)
This is what is ultimately called by every code path that will update
the content (except for undo / redo).
|
private void |
resetUndoRedoState() |
void |
selectAll()
Selects all text in the text input.
|
void |
selectBackward()
Moves the selection backward one char in the text.
|
ReadOnlyStringProperty |
selectedTextProperty()
Defines the characters in the TextInputControl which are selected
|
void |
selectEnd()
Moves the caret to after the last char of text.
|
void |
selectEndOfNextWord()
Moves the caret to the end of the next word.
|
void |
selectForward()
Moves the selection forward one char in the text.
|
void |
selectHome()
Moves the caret to before the first char of text.
|
<any> |
selectionProperty()
The current selection.
|
void |
selectNextWord()
Moves the caret to the beginning of next word.
|
void |
selectPositionCaret(int pos)
Positions the caret to the position indicated by
pos and extends
the selection, if there is one. |
void |
selectPreviousWord()
Moves the caret to the beginning of previous word.
|
void |
selectRange(int anchor,
int caretPosition)
Positions the anchor and caretPosition explicitly.
|
void |
setEditable(boolean value)
Sets the value of the property editable.
|
void |
setFont(Font value)
Sets the value of the property font.
|
void |
setPromptText(java.lang.String value)
Sets the value of the property promptText.
|
void |
setText(java.lang.String value)
Sets the value of the property text.
|
void |
setTextFormatter(TextFormatter<?> value)
Sets the value of the property textFormatter.
|
<any> |
textFormatterProperty()
The property contains currently attached
TextFormatter . |
StringProperty |
textProperty()
The textual content of this TextInputControl.
|
(package private) void |
textUpdated() |
void |
undo()
If possible, undoes the last modification.
|
ReadOnlyBooleanProperty |
undoableProperty()
The property describes if it's currently possible to undo the latest change of the content that was done.
|
private void |
updateContent(TextFormatter.Change change,
boolean forceNewUndoRecord) |
private <T> void |
updateText(TextFormatter<T> formatter) |
private void |
updateUndoRedoState() |
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, createDefaultSkin, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, loadSkinClass, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
public final <any> fontProperty
getFont()
,
setFont(Font)
public final StringProperty promptTextProperty
TextInputControl
. If set to null or an empty string, no
prompt text is displayed.getPromptText()
,
setPromptText(String)
public final <any> textFormatterProperty
TextFormatter
.
Since the value is part of the Formatter
, changing the TextFormatter will update the text based on the new textFormatter.getTextFormatter()
,
setTextFormatter(TextFormatter)
public final StringProperty textProperty
getText()
,
setText(String)
public final ReadOnlyIntegerProperty lengthProperty
getLength()
public final BooleanProperty editableProperty
isEditable()
,
setEditable(boolean)
public final <any> selectionProperty
getSelection()
public final ReadOnlyStringProperty selectedTextProperty
getSelectedText()
public final ReadOnlyIntegerProperty anchorProperty
anchor
of the text selection.
The anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the anchor might represent the lower or upper bound of the selection.getAnchor()
public final ReadOnlyIntegerProperty caretPositionProperty
anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the caretPosition might represent the lower or upper bound of the selection.getCaretPosition()
public final ReadOnlyBooleanProperty undoableProperty
isUndoable()
public final ReadOnlyBooleanProperty redoableProperty
isRedoable()
private <any> font
private StringProperty promptText
TextInputControl
. If set to null or an empty string, no
prompt text is displayed.private final <any> textFormatter
TextFormatter
.
Since the value is part of the Formatter
, changing the TextFormatter will update the text based on the new textFormatter.private final TextInputControl.Content content
private TextInputControl.TextProperty text
private ReadOnlyIntegerWrapper length
private BooleanProperty editable
private <any> selection
private ReadOnlyStringWrapper selectedText
private ReadOnlyIntegerWrapper anchor
anchor
of the text selection.
The anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the anchor might represent the lower or upper bound of the selection.private ReadOnlyIntegerWrapper caretPosition
anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the caretPosition might represent the lower or upper bound of the selection.private TextInputControl.UndoRedoChange undoChangeHead
private TextInputControl.UndoRedoChange undoChange
private boolean createNewUndoRecord
private final ReadOnlyBooleanWrapper undoable
private final ReadOnlyBooleanWrapper redoable
private java.text.BreakIterator charIterator
private java.text.BreakIterator wordIterator
private FormatterAccessor accessor
private static final PseudoClass PSEUDO_CLASS_READONLY
protected TextInputControl(TextInputControl.Content content)
content
- a non-null implementation of Content.public final <any> fontProperty()
getFont()
,
setFont(Font)
public final void setFont(Font value)
public final Font getFont()
public final StringProperty promptTextProperty()
TextInputControl
. If set to null or an empty string, no
prompt text is displayed.getPromptText()
,
setPromptText(String)
public final java.lang.String getPromptText()
public final void setPromptText(java.lang.String value)
public final <any> textFormatterProperty()
TextFormatter
.
Since the value is part of the Formatter
, changing the TextFormatter will update the text based on the new textFormatter.getTextFormatter()
,
setTextFormatter(TextFormatter)
public final TextFormatter<?> getTextFormatter()
public final void setTextFormatter(TextFormatter<?> value)
protected final TextInputControl.Content getContent()
public final java.lang.String getText()
public final void setText(java.lang.String value)
public final StringProperty textProperty()
getText()
,
setText(String)
public final int getLength()
public final ReadOnlyIntegerProperty lengthProperty()
getLength()
public final boolean isEditable()
public final void setEditable(boolean value)
public final BooleanProperty editableProperty()
isEditable()
,
setEditable(boolean)
public final IndexRange getSelection()
public final <any> selectionProperty()
getSelection()
public final java.lang.String getSelectedText()
public final ReadOnlyStringProperty selectedTextProperty()
getSelectedText()
public final int getAnchor()
public final ReadOnlyIntegerProperty anchorProperty()
anchor
of the text selection.
The anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the anchor might represent the lower or upper bound of the selection.getAnchor()
public final int getCaretPosition()
public final ReadOnlyIntegerProperty caretPositionProperty()
anchor
and caretPosition
make up the selection
range. Selection must always be specified in terms of begin <= end, but
anchor
may be less than, equal to, or greater than the
caretPosition
. Depending on how the user selects text,
the caretPosition might represent the lower or upper bound of the selection.getCaretPosition()
public final boolean isUndoable()
public final ReadOnlyBooleanProperty undoableProperty()
isUndoable()
public final boolean isRedoable()
public final ReadOnlyBooleanProperty redoableProperty()
isRedoable()
public java.lang.String getText(int start, int end)
start
- must be a value between 0 and end - 1.end
- must be less than or equal to the lengthpublic void appendText(java.lang.String text)
text
- a non null Stringpublic void insertText(int index, java.lang.String text)
index
- The location to insert the text.text
- The text to insert.public void deleteText(IndexRange range)
range
- The range of text to delete. The range object must not be null.deleteText(int, int)
public void deleteText(int start, int end)
start
- The starting index in the range, inclusive. This must be >= 0 and < the end.end
- The ending index in the range, exclusive. This is one-past the last character to
delete (consistent with the String manipulation methods). This must be > the start,
and <= the length of the text.public void replaceText(IndexRange range, java.lang.String text)
range
- The range of text to replace. The range object must not be null.text
- The text that is to replace the range. This must not be null.replaceText(int, int, String)
public void replaceText(int start, int end, java.lang.String text)
start
- The starting index in the range, inclusive. This must be >= 0 and < the end.end
- The ending index in the range, exclusive. This is one-past the last character to
delete (consistent with the String manipulation methods). This must be > the start,
and <= the length of the text.text
- The text that is to replace the range. This must not be null.private void updateContent(TextFormatter.Change change, boolean forceNewUndoRecord)
public void cut()
public void copy()
public void paste()
public void selectBackward()
public void selectForward()
public void previousWord()
public void nextWord()
public void endOfNextWord()
public void selectPreviousWord()
public void selectNextWord()
public void selectEndOfNextWord()
private void previousWord(boolean select)
private void nextWord(boolean select)
private void endOfNextWord(boolean select)
public void selectAll()
public void home()
public void end()
public void selectHome()
public void selectEnd()
public boolean deletePreviousChar()
public boolean deleteNextChar()
public void forward()
public void backward()
public void positionCaret(int pos)
pos
. This
function will also clear the selection.pos
- the positionpublic void selectPositionCaret(int pos)
pos
and extends
the selection, if there is one. If there is no selection, then a
selection is formed where the anchor is at the current caret position
and the caretPosition is moved to pos.pos
- the positionpublic void selectRange(int anchor, int caretPosition)
anchor
- the anchorcaretPosition
- the caretPositionprivate void doSelectRange(int anchor, int caretPosition)
public void extendSelection(int pos)
pos
- the positionpublic void clear()
public void deselect()
public void replaceSelection(java.lang.String replacement)
replacement
- the replacement stringpublic final void undo()
isUndoable()
returns
false, then calling this method has no effect.public final void redo()
isRedoable()
returns
false, then calling this method has no effect.void textUpdated()
private void resetUndoRedoState()
private void updateUndoRedoState()
private boolean filterAndSet(java.lang.String value)
private int replaceText(int start, int end, java.lang.String value, int anchor, int caretPosition)
start
- The start index into the existing text which
will be replaced by the new valueend
- The end index into the existing text which will
be replaced by the new value. As with
String.replace this is a lastIndex+1 valuevalue
- The new text valueanchor
- The new selection anchor after the change is madecaretPosition
- The new selection caretPosition after the change
is made.private <T> void updateText(TextFormatter<T> formatter)
public final void commitValue()
public final void cancelEdit()
private FormatterAccessor getFormatterAccessor()
static java.lang.String filterInput(java.lang.String txt, boolean stripNewlines, boolean stripTabs)
txt
- stripNewlines
- stripTabs
- static boolean containsInvalidCharacters(java.lang.String txt, boolean newlineIllegal, boolean tabIllegal)
private static boolean isInvalidCharacter(char c, boolean newlineIllegal, boolean tabIllegal)
public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getControlCssMetaData()
getControlCssMetaData
in class Control
public java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute
in class Control
public void executeAccessibleAction(AccessibleAction action, java.lang.Object... parameters)
executeAccessibleAction
in class Control