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.
-
Property Summary
PropertiesTypePropertyDescriptionProperty for the current caret position.Text currently selected in the editor control.Text currently in the editor control.Request wordwrap. -
Constructor Summary
ConstructorsConstructorDescriptionTextAreaControl(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 TypeMethodDescriptionvoidappendText(String text) Append the specified text to the appendable.Property for the current caret position.voidclear()Request clear the contents of the control.voidcopy()Request copy the current selection.voidcut()Request cut the current selection.voiddeleteText(int startIdx, int endIdx) Request deleting the text within the specified range.voiddeselect()Deselect any currently-selected text.intGets the value of thecaretPositionproperty.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 theselectedTextproperty.Get the range of the currently-selected text.getText()Gets the value of thetextproperty.voidinsertText(int pos, String text) Request inserting the specified text.booleanReturns true if 'redo' can be applied to the control.booleanReturns true if 'undo' can be applied to the control.voidpaste()Request paste from the system clipboard.voidpositionCaret(int index) Set the caret position to the specified indexvoidredo()Request redo.voidreplaceSelection(String text) Insert the specified text, replacing any existing selection.voidRequest that the control is focused.Text currently selected in the editor control.voidselectRange(int startIdx, int endIdx) Set the range of the selected text.voidsetContextMenu(ContextMenu menu) Set the context menu for the control.voidSets the value of thetextproperty.Text currently in the editor control.voidundo()Request undo.Request wordwrap.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface qupath.lib.gui.scripting.EditableText
getSelectionLengthMethods inherited from interface qupath.lib.gui.scripting.ScriptEditorControl
getLanguage, getSelectionEnd, getSelectionStart, requestFollowCaret, setLanguage
-
Property Details
-
text
- Specified by:
textPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- See Also:
-
selectedText
- Specified by:
selectedTextPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- See Also:
-
wrapText
- Specified by:
wrapTextPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- See Also:
-
caretPosition
- Specified by:
caretPositionPropertyin 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:ScriptEditorControlText currently in the editor control.- Specified by:
textPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- the
textproperty - See Also:
-
setText
Sets the value of thetextproperty.- Specified by:
setTextin interfaceEditableText- Property description:
- Parameters:
text- the value for thetextproperty- See Also:
-
getText
Gets the value of thetextproperty.- Specified by:
getTextin interfaceEditableText- Property description:
- Returns:
- the value of the
textproperty - See Also:
-
selectedTextProperty
Description copied from interface:ScriptEditorControlText currently selected in the editor control.- Specified by:
selectedTextPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- the
selectedTextproperty - See Also:
-
getSelectedText
Gets the value of theselectedTextproperty.- Specified by:
getSelectedTextin interfaceEditableText- Property description:
- Returns:
- the value of the
selectedTextproperty - See Also:
-
getRegion
Description copied from interface:ScriptEditorControlGet the region representing this control, so it may be added to a scene.- Specified by:
getRegionin interfaceScriptEditorControl<TextArea>- Returns:
-
isUndoable
public boolean isUndoable()Description copied from interface:ScriptEditorControlReturns true if 'undo' can be applied to the control.- Specified by:
isUndoablein interfaceScriptEditorControl<TextArea>- Returns:
-
isRedoable
public boolean isRedoable()Description copied from interface:ScriptEditorControlReturns true if 'redo' can be applied to the control.- Specified by:
isRedoablein interfaceScriptEditorControl<TextArea>- Returns:
-
undo
public void undo()Description copied from interface:ScriptEditorControlRequest undo.- Specified by:
undoin interfaceScriptEditorControl<TextArea>
-
redo
public void redo()Description copied from interface:ScriptEditorControlRequest redo.- Specified by:
redoin interfaceScriptEditorControl<TextArea>
-
copy
public void copy()Description copied from interface:ScriptEditorControlRequest copy the current selection.- Specified by:
copyin interfaceScriptEditorControl<TextArea>
-
cut
public void cut()Description copied from interface:ScriptEditorControlRequest cut the current selection.- Specified by:
cutin interfaceScriptEditorControl<TextArea>
-
paste
public void paste()Description copied from interface:ScriptEditorControlRequest paste from the system clipboard.- Specified by:
pastein interfaceScriptEditorControl<TextArea>
-
clear
public void clear()Description copied from interface:EditableTextRequest clear the contents of the control.- Specified by:
clearin interfaceEditableText
-
appendText
Description copied from interface:TextAppendableAppend the specified text to the appendable.- Specified by:
appendTextin interfaceEditableText- Specified by:
appendTextin interfaceTextAppendable- Parameters:
text- the text to be appended
-
getCaretPosition
public int getCaretPosition()Gets the value of thecaretPositionproperty.- Specified by:
getCaretPositionin interfaceEditableText- Property description:
- Returns:
- the value of the
caretPositionproperty - See Also:
-
insertText
Description copied from interface:EditableTextRequest inserting the specified text.- Specified by:
insertTextin interfaceEditableText- Parameters:
pos- position to insert the texttext- the text to insert
-
deleteText
public void deleteText(int startIdx, int endIdx) Description copied from interface:EditableTextRequest deleting the text within the specified range.- Specified by:
deleteTextin interfaceEditableText- Parameters:
startIdx-endIdx-
-
deselect
public void deselect()Description copied from interface:EditableTextDeselect any currently-selected text.- Specified by:
deselectin interfaceEditableText
-
getSelection
Description copied from interface:ScriptEditorControlGet the range of the currently-selected text.- Specified by:
getSelectionin interfaceScriptEditorControl<TextArea>- Returns:
-
selectRange
public void selectRange(int startIdx, int endIdx) Description copied from interface:EditableTextSet the range of the selected text.- Specified by:
selectRangein interfaceEditableText- Parameters:
startIdx-endIdx-
-
wrapTextProperty
Description copied from interface:ScriptEditorControlRequest wordwrap.- Specified by:
wrapTextPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- the
wrapTextproperty
-
positionCaret
public void positionCaret(int index) Description copied from interface:EditableTextSet the caret position to the specified index- Specified by:
positionCaretin interfaceEditableText- Parameters:
index-
-
replaceSelection
Description copied from interface:EditableTextInsert the specified text, replacing any existing selection.- Specified by:
replaceSelectionin interfaceEditableText- Parameters:
text- the text to insert
-
setContextMenu
Description copied from interface:ScriptEditorControlSet the context menu for the control.- Specified by:
setContextMenuin interfaceScriptEditorControl<TextArea>- Parameters:
menu-
-
getContextMenu
Description copied from interface:ScriptEditorControlGet the context menu for the control.- Specified by:
getContextMenuin interfaceScriptEditorControl<TextArea>- Returns:
-
requestFocus
public void requestFocus()Description copied from interface:ScriptEditorControlRequest that the control is focused.- Specified by:
requestFocusin interfaceScriptEditorControl<TextArea>
-
caretPositionProperty
Description copied from interface:ScriptEditorControlProperty for the current caret position.- Specified by:
caretPositionPropertyin interfaceScriptEditorControl<TextArea>- Returns:
- the
caretPositionproperty - See Also:
-