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

public interface ScriptEditorControl<T extends Region> extends TextAppendable, EditableText
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.

  • Property Details

  • 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 interface EditableText
      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 than EditableText.getSelectionStart() this means there is no selection.
      Specified by:
      getSelectionEnd in interface EditableText
      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

      void setContextMenu(ContextMenu menu)
      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.
    • setLanguage

      default void setLanguage(ScriptLanguage language)
      Set the language for text to be displayed by this control.

      The default implementation does nothing. Implementing classes may choose to change the control's behavior based on the language.

      Parameters:
      language -
    • getLanguage

      default ScriptLanguage getLanguage()
      Get any language stored for text to be displayed by this control.

      The default implementation always returns null. Implementing classes may choose to store any set language, and modify the control's behavior accordingly.

      Returns: