Class CodeAreaControl
java.lang.Object
qupath.lib.gui.scripting.richtextfx.CodeAreaControl
- All Implemented Interfaces:
TextAppendable
,EditableText
,ScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
public class CodeAreaControl
extends Object
implements ScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
Code area control using RichTextFX.
- 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 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.org.fxmisc.flowless.VirtualizedScrollPane
<org.fxmisc.richtext.CodeArea> 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.void
Request that the X and Y scrolls are adjusted to ensure the caret is visible.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
-
Property Details
-
text
- Specified by:
textProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
- See Also:
-
selectedText
- Specified by:
selectedTextProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
- See Also:
-
wrapText
- Specified by:
wrapTextProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
- See Also:
-
caretPosition
- Specified by:
caretPositionProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
- See Also:
-
-
Method Details
-
textProperty
Description copied from interface:ScriptEditorControl
Text currently in the editor control.- Specified by:
textProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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
public org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea> 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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
-
undo
public void undo()Description copied from interface:ScriptEditorControl
Request undo.- Specified by:
undo
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
redo
public void redo()Description copied from interface:ScriptEditorControl
Request redo.- Specified by:
redo
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
copy
public void copy()Description copied from interface:ScriptEditorControl
Request copy the current selection.- Specified by:
copy
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
cut
public void cut()Description copied from interface:ScriptEditorControl
Request cut the current selection.- Specified by:
cut
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
paste
public void paste()Description copied from interface:ScriptEditorControl
Request paste from the system clipboard.- Specified by:
paste
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
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
-
clear
public void clear()Description copied from interface:EditableText
Request clear the contents of the control.- Specified by:
clear
in interfaceEditableText
-
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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- 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
-
-
requestFollowCaret
public void requestFollowCaret()Description copied from interface:ScriptEditorControl
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.
- Specified by:
requestFollowCaret
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Parameters:
menu
-
-
getContextMenu
Description copied from interface:ScriptEditorControl
Get the context menu for the control.- Specified by:
getContextMenu
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
-
requestFocus
public void requestFocus()Description copied from interface:ScriptEditorControl
Request that the control is focused.- Specified by:
requestFocus
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
caretPositionProperty
Description copied from interface:ScriptEditorControl
Property for the current caret position.- Specified by:
caretPositionProperty
in interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
- Returns:
- the
caretPosition
property - See Also:
-