Package qupath.lib.gui.scripting
Interface EditableText
- All Known Subinterfaces:
- ScriptEditorControl<T>
- All Known Implementing Classes:
- CodeAreaControl,- TextAreaControl
public interface EditableText
Interface for objects that manage editable text, including a caret position and selection.
 This is used to define some useful scripting functionality independently of any particular user interface.
- Since:
- v0.4.0
- 
Method SummaryModifier and TypeMethodDescriptionvoidappendText(String text) Append the specified text.voidclear()Request clear the contents of the control.voiddeleteText(int startIdx, int endIdx) Request deleting the text within the specified range.default voiddeselect()Deselect any currently-selected text.intGet the current caret position.Get the selected text as a string.intGet the ending position for any selection (exclusive).default intGet the selection length, or 0 if there is no selection.intGet the starting position for any selection (inclusive).getText()Get all the text in the editor;voidinsertText(int pos, String text) Request inserting the specified text.voidpositionCaret(int index) Set the caret position to the specified indexvoidreplaceSelection(String text) Insert the specified text, replacing any existing selection.voidselectRange(int startIdx, int endIdx) Set the range of the selected text.voidSet all the text in the editor.
- 
Method Details- 
setTextSet all the text in the editor.- Parameters:
- text-
 
- 
getTextString getText()Get all the text in the editor;- Returns:
 
- 
appendTextAppend the specified text.- Parameters:
- text- the text to be appended
 
- 
replaceSelectionInsert the specified text, replacing any existing selection.- Parameters:
- text- the text to insert
 
- 
clearvoid clear()Request clear the contents of the control.
- 
getCaretPositionint getCaretPosition()Get the current caret position.- Returns:
 
- 
insertTextRequest inserting the specified text.- Parameters:
- pos- position to insert the text
- text- the text to insert
 
- 
deleteTextvoid deleteText(int startIdx, int endIdx) Request deleting the text within the specified range.- Parameters:
- startIdx-
- endIdx-
 
- 
positionCaretvoid positionCaret(int index) Set the caret position to the specified index- Parameters:
- index-
 
- 
deselectdefault void deselect()Deselect any currently-selected text.
- 
getSelectedTextString getSelectedText()Get the selected text as a string.- Returns:
 
- 
selectRangevoid selectRange(int startIdx, int endIdx) Set the range of the selected text.- Parameters:
- startIdx-
- endIdx-
 
- 
getSelectionStartint getSelectionStart()Get the starting position for any selection (inclusive).- Returns:
 
- 
getSelectionEndint getSelectionEnd()Get the ending position for any selection (exclusive). If this is equal to or less thangetSelectionStart()this means there is no selection.- Returns:
 
- 
getSelectionLengthdefault int getSelectionLength()Get the selection length, or 0 if there is no selection.- Returns:
 
 
-