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
PropertiesTypePropertyDescriptionProperty for the current caret position.Text currently selected in the editor control.Text currently in the editor control.Request wordwrap. -
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 the property caretPosition.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 the property selectedText.Get the range of the currently-selected text.getText()Gets the value of the property text.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.voidRequest that the X and Y scrolls are adjusted to ensure the caret is visible.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 the property text.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
getSelectionEnd, getSelectionStart
-
Property Details
-
text
- Specified by:
textPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-
selectedText
- Specified by:
selectedTextPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-
wrapText
- Specified by:
wrapTextPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
caretPosition
- Specified by:
caretPositionPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-
-
Method Details
-
textProperty
Description copied from interface:ScriptEditorControlText currently in the editor control.- Specified by:
textPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-
setText
Sets the value of the property text.- Specified by:
setTextin interfaceEditableText- Property description:
-
getText
Gets the value of the property text.- Specified by:
getTextin interfaceEditableText- Property description:
- Returns:
-
selectedTextProperty
Description copied from interface:ScriptEditorControlText currently selected in the editor control.- Specified by:
selectedTextPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-
getSelectedText
Gets the value of the property selectedText.- Specified by:
getSelectedTextin interfaceEditableText- Property description:
- Returns:
-
getRegion
public org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea> getRegion()Description copied from interface:ScriptEditorControlGet the region representing this control, so it may be added to a scene.- Specified by:
getRegionin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
isUndoable
public boolean isUndoable()Description copied from interface:ScriptEditorControlReturns true if 'undo' can be applied to the control.- Specified by:
isUndoablein interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
isRedoable
public boolean isRedoable()Description copied from interface:ScriptEditorControlReturns true if 'redo' can be applied to the control.- Specified by:
isRedoablein interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
undo
public void undo()Description copied from interface:ScriptEditorControlRequest undo.- Specified by:
undoin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
redo
public void redo()Description copied from interface:ScriptEditorControlRequest redo.- Specified by:
redoin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
copy
public void copy()Description copied from interface:ScriptEditorControlRequest copy the current selection.- Specified by:
copyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
cut
public void cut()Description copied from interface:ScriptEditorControlRequest cut the current selection.- Specified by:
cutin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
paste
public void paste()Description copied from interface:ScriptEditorControlRequest paste from the system clipboard.- Specified by:
pastein interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
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
-
clear
public void clear()Description copied from interface:EditableTextRequest clear the contents of the control.- Specified by:
clearin interfaceEditableText
-
getCaretPosition
public int getCaretPosition()Gets the value of the property caretPosition.- Specified by:
getCaretPositionin interfaceEditableText- Property description:
- Returns:
-
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
-
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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
selectRange
public void selectRange(int startIdx, int endIdx) Description copied from interface:EditableTextSet the range of the selected text.- Specified by:
selectRangein interfaceEditableText
-
wrapTextProperty
Description copied from interface:ScriptEditorControlRequest wordwrap.- Specified by:
wrapTextPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
positionCaret
public void positionCaret(int index) Description copied from interface:EditableTextSet the caret position to the specified index- Specified by:
positionCaretin interfaceEditableText
-
requestFollowCaret
public void requestFollowCaret()Description copied from interface:ScriptEditorControlRequest 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:
requestFollowCaretin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
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<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
getContextMenu
Description copied from interface:ScriptEditorControlGet the context menu for the control.- Specified by:
getContextMenuin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
-
requestFocus
public void requestFocus()Description copied from interface:ScriptEditorControlRequest that the control is focused.- Specified by:
requestFocusin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>
-
caretPositionProperty
Description copied from interface:ScriptEditorControlProperty for the current caret position.- Specified by:
caretPositionPropertyin interfaceScriptEditorControl<org.fxmisc.flowless.VirtualizedScrollPane<org.fxmisc.richtext.CodeArea>>- Returns:
- See Also:
-