Package qupath.lib.gui.scripting
Interface ScriptEditorControl<T extends Region>
- Type Parameters:
T
- the tile of component used for display
- All Superinterfaces:
EditableText
,TextAppendable
- All Known Implementing Classes:
CodeAreaControl
,TextAreaControl
Basic script editor control using JavaFX.
The reason for its existence is to enable custom script editors to be implemented that provide additional functionality
(e.g. syntax highlighting), but do not rely upon subclassing any specific JavaFX control.
Note: This is rather cumbersome, and may be removed in the future if the script editor design is revised.
- 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. -
Method Summary
Modifier and TypeMethodDescriptionProperty for the current caret position.void
copy()
Request copy the current selection.void
cut()
Request cut the current selection.Get the context menu for the control.Get the region representing this control, so it may be added to a scene.Get the range of the currently-selected text.default int
Get the ending position for any selection (exclusive).default int
Get the starting position for any selection (inclusive).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
redo()
Request redo.default void
Request that the control is focused.default void
Request that the X and Y scrolls are adjusted to ensure the caret is visible.Text currently selected in the editor control.void
setContextMenu
(ContextMenu menu) Set the context menu for the control.Text currently in the editor control.void
undo()
Request undo.Request wordwrap.Methods inherited from interface qupath.lib.gui.scripting.EditableText
appendText, clear, deleteText, deselect, getCaretPosition, getSelectedText, getSelectionLength, getText, insertText, positionCaret, replaceSelection, selectRange, setText
Methods inherited from interface qupath.lib.gui.logging.TextAppendable
appendText
-
Property Details
-
text
StringProperty textPropertyText currently in the editor control.- See Also:
-
selectedText
ObservableValue<String> selectedTextPropertyText currently selected in the editor control.- See Also:
-
wrapText
BooleanProperty wrapTextPropertyRequest wordwrap.- See Also:
-
caretPosition
ReadOnlyIntegerProperty caretPositionPropertyProperty for the current caret position.- See Also:
-
-
Method Details
-
textProperty
StringProperty textProperty()Text currently in the editor control.- Returns:
-
getSelection
IndexRange getSelection()Get the range of the currently-selected text.- Returns:
-
getSelectionStart
default int getSelectionStart()Description copied from interface:EditableText
Get the starting position for any selection (inclusive).- Specified by:
getSelectionStart
in interfaceEditableText
- Returns:
-
getSelectionEnd
default int getSelectionEnd()Description copied from interface:EditableText
Get the ending position for any selection (exclusive). If this is equal to or less thanEditableText.getSelectionStart()
this means there is no selection.- Specified by:
getSelectionEnd
in interfaceEditableText
- Returns:
-
paste
void paste()Request paste from the system clipboard. -
selectedTextProperty
ObservableValue<String> selectedTextProperty()Text currently selected in the editor control.- Returns:
-
isUndoable
boolean isUndoable()Returns true if 'undo' can be applied to the control.- Returns:
-
isRedoable
boolean isRedoable()Returns true if 'redo' can be applied to the control.- Returns:
-
getRegion
T getRegion()Get the region representing this control, so it may be added to a scene.- Returns:
-
undo
void undo()Request undo. -
redo
void redo()Request redo. -
copy
void copy()Request copy the current selection. -
cut
void cut()Request cut the current selection. -
wrapTextProperty
BooleanProperty wrapTextProperty()Request wordwrap.- Returns:
-
requestFollowCaret
default void requestFollowCaret()Request that the X and Y scrolls are adjusted to ensure the caret is visible.This method does nothing by default. This means that a class extending this interface must specifically implement this method if a different behavior is expected.
-
caretPositionProperty
ReadOnlyIntegerProperty caretPositionProperty()Property for the current caret position.- Returns:
-
setContextMenu
Set the context menu for the control.- Parameters:
menu
-
-
getContextMenu
ContextMenu getContextMenu()Get the context menu for the control.- Returns:
-
requestFocus
default void requestFocus()Request that the control is focused.
-