Package qupath.lib.gui.scripting
Class TextAreaControl
java.lang.Object
qupath.lib.gui.scripting.TextAreaControl
- All Implemented Interfaces:
TextAppendable
,EditableText
,ScriptEditorControl<TextArea>
Simple text area control (JavaFX) with basic operations and no styling support.
- Author:
- Pete Bankhead
-
Property Summary
TypePropertyDescriptionProperty for the current caret position.Text currently selected in the editor control.Text currently in the editor control.Request wordwrap. -
Constructor Summary
ConstructorDescriptionTextAreaControl
(boolean isEditable) Constructor to create a new text area and wrap it in aTextAreaControl
.TextAreaControl
(TextArea textArea, boolean isEditable) Constructor to wrap an existing text area and wrap it in aTextAreaControl
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendText
(String text) Append the specified text to the appendable.Property for the current caret position.void
clear()
Request clear the contents of the control.void
copy()
Request copy the current selection.void
cut()
Request cut the current selection.void
deleteText
(int startIdx, int endIdx) Request deleting the text within the specified range.void
deselect()
Deselect any currently-selected text.int
Gets the value of thecaretPosition
property.Get the context menu for the control.Get the region representing this control, so it may be added to a scene.Gets the value of theselectedText
property.Get the range of the currently-selected text.getText()
Gets the value of thetext
property.void
insertText
(int pos, String text) Request inserting the specified text.boolean
Returns true if 'redo' can be applied to the control.boolean
Returns true if 'undo' can be applied to the control.void
paste()
Request paste from the system clipboard.void
positionCaret
(int index) Set the caret position to the specified indexvoid
redo()
Request redo.void
replaceSelection
(String text) Insert the specified text, replacing any existing selection.void
Request that the control is focused.Text currently selected in the editor control.void
selectRange
(int startIdx, int endIdx) Set the range of the selected text.void
setContextMenu
(ContextMenu menu) Set the context menu for the control.void
Sets the value of thetext
property.Text currently in the editor control.void
undo()
Request undo.Request wordwrap.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface qupath.lib.gui.scripting.EditableText
getSelectionLength
Methods inherited from interface qupath.lib.gui.scripting.ScriptEditorControl
getSelectionEnd, getSelectionStart, requestFollowCaret
-
Property Details
-
text
- Specified by:
textProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- See Also:
-
selectedText
- Specified by:
selectedTextProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- See Also:
-
wrapText
- Specified by:
wrapTextProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- See Also:
-
caretPosition
- Specified by:
caretPositionProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- See Also:
-
-
Constructor Details
-
TextAreaControl
public TextAreaControl(boolean isEditable) Constructor to create a new text area and wrap it in aTextAreaControl
.- Parameters:
isEditable
- whether the text area should be editable or not
-
TextAreaControl
Constructor to wrap an existing text area and wrap it in aTextAreaControl
.- Parameters:
textArea
- the text area to wrapisEditable
- whether the text area should be editable or not
-
-
Method Details
-
textProperty
Description copied from interface:ScriptEditorControl
Text currently in the editor control.- Specified by:
textProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- the
text
property - See Also:
-
setText
Sets the value of thetext
property.- Specified by:
setText
in interfaceEditableText
- Property description:
- Parameters:
text
- the value for thetext
property- See Also:
-
getText
Gets the value of thetext
property.- Specified by:
getText
in interfaceEditableText
- Property description:
- Returns:
- the value of the
text
property - See Also:
-
selectedTextProperty
Description copied from interface:ScriptEditorControl
Text currently selected in the editor control.- Specified by:
selectedTextProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- the
selectedText
property - See Also:
-
getSelectedText
Gets the value of theselectedText
property.- Specified by:
getSelectedText
in interfaceEditableText
- Property description:
- Returns:
- the value of the
selectedText
property - See Also:
-
getRegion
Description copied from interface:ScriptEditorControl
Get the region representing this control, so it may be added to a scene.- Specified by:
getRegion
in interfaceScriptEditorControl<TextArea>
- Returns:
-
isUndoable
public boolean isUndoable()Description copied from interface:ScriptEditorControl
Returns true if 'undo' can be applied to the control.- Specified by:
isUndoable
in interfaceScriptEditorControl<TextArea>
- Returns:
-
isRedoable
public boolean isRedoable()Description copied from interface:ScriptEditorControl
Returns true if 'redo' can be applied to the control.- Specified by:
isRedoable
in interfaceScriptEditorControl<TextArea>
- Returns:
-
undo
public void undo()Description copied from interface:ScriptEditorControl
Request undo.- Specified by:
undo
in interfaceScriptEditorControl<TextArea>
-
redo
public void redo()Description copied from interface:ScriptEditorControl
Request redo.- Specified by:
redo
in interfaceScriptEditorControl<TextArea>
-
copy
public void copy()Description copied from interface:ScriptEditorControl
Request copy the current selection.- Specified by:
copy
in interfaceScriptEditorControl<TextArea>
-
cut
public void cut()Description copied from interface:ScriptEditorControl
Request cut the current selection.- Specified by:
cut
in interfaceScriptEditorControl<TextArea>
-
paste
public void paste()Description copied from interface:ScriptEditorControl
Request paste from the system clipboard.- Specified by:
paste
in interfaceScriptEditorControl<TextArea>
-
clear
public void clear()Description copied from interface:EditableText
Request clear the contents of the control.- Specified by:
clear
in interfaceEditableText
-
appendText
Description copied from interface:TextAppendable
Append the specified text to the appendable.- Specified by:
appendText
in interfaceEditableText
- Specified by:
appendText
in interfaceTextAppendable
- Parameters:
text
- the text to be appended
-
getCaretPosition
public int getCaretPosition()Gets the value of thecaretPosition
property.- Specified by:
getCaretPosition
in interfaceEditableText
- Property description:
- Returns:
- the value of the
caretPosition
property - See Also:
-
insertText
Description copied from interface:EditableText
Request inserting the specified text.- Specified by:
insertText
in interfaceEditableText
- Parameters:
pos
- position to insert the texttext
- the text to insert
-
deleteText
public void deleteText(int startIdx, int endIdx) Description copied from interface:EditableText
Request deleting the text within the specified range.- Specified by:
deleteText
in interfaceEditableText
- Parameters:
startIdx
-endIdx
-
-
deselect
public void deselect()Description copied from interface:EditableText
Deselect any currently-selected text.- Specified by:
deselect
in interfaceEditableText
-
getSelection
Description copied from interface:ScriptEditorControl
Get the range of the currently-selected text.- Specified by:
getSelection
in interfaceScriptEditorControl<TextArea>
- Returns:
-
selectRange
public void selectRange(int startIdx, int endIdx) Description copied from interface:EditableText
Set the range of the selected text.- Specified by:
selectRange
in interfaceEditableText
- Parameters:
startIdx
-endIdx
-
-
wrapTextProperty
Description copied from interface:ScriptEditorControl
Request wordwrap.- Specified by:
wrapTextProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- the
wrapText
property
-
positionCaret
public void positionCaret(int index) Description copied from interface:EditableText
Set the caret position to the specified index- Specified by:
positionCaret
in interfaceEditableText
- Parameters:
index
-
-
replaceSelection
Description copied from interface:EditableText
Insert the specified text, replacing any existing selection.- Specified by:
replaceSelection
in interfaceEditableText
- Parameters:
text
- the text to insert
-
setContextMenu
Description copied from interface:ScriptEditorControl
Set the context menu for the control.- Specified by:
setContextMenu
in interfaceScriptEditorControl<TextArea>
- Parameters:
menu
-
-
getContextMenu
Description copied from interface:ScriptEditorControl
Get the context menu for the control.- Specified by:
getContextMenu
in interfaceScriptEditorControl<TextArea>
- Returns:
-
requestFocus
public void requestFocus()Description copied from interface:ScriptEditorControl
Request that the control is focused.- Specified by:
requestFocus
in interfaceScriptEditorControl<TextArea>
-
caretPositionProperty
Description copied from interface:ScriptEditorControl
Property for the current caret position.- Specified by:
caretPositionProperty
in interfaceScriptEditorControl<TextArea>
- Returns:
- the
caretPosition
property - See Also:
-