Class EditorController

java.lang.Object
app.controllers.EditorController
All Implemented Interfaces:
Controller, javafx.fxml.Initializable

public class EditorController
extends java.lang.Object
implements javafx.fxml.Initializable, Controller
An FXML controller that controls the CodeArea
  • Constructor Summary

    Constructors
    Constructor Description
    EditorController()  
  • Method Summary

    Modifier and Type Method Description
    void handle​(CopyEvent event)
    Copy selected content if focused
    void handle​(CutEvent event)
    Cut selected content if focused
    void handle​(LanguageChangedEvent event)
    Refreshes the syntax highlighting when the Programming language is changed
    void handle​(OpenFileEvent event)
    Updates the CodeArea whenever a new file is opened.
    void handle​(PasteEvent event)
    Paste from clipboard if focused
    void handle​(RedoEvent event)
    Redo if focused
    void handle​(SaveFileEvent event)
    Saves the editor content to a file
    void handle​(ToggleCommentEvent event)
    Toggles a comment based on the editor state
    void handle​(ToggleWrapTextEvent event)
    Toggles the WrapText setting
    void handle​(UndoEvent event)
    Undo if focused
    void initialize​(java.net.URL url, java.util.ResourceBundle resourceBundle)
    Initializes the controller, and binds the event of change in editor content to editorChanged
    void saveCodeArea​(boolean isNewFile)
    Saving/Writing to the file based on the active filepath in Model if it is a new File.
    void setEventBus​(com.google.common.eventbus.EventBus eventBus)
    Registers the main EventBus into the controller.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EditorController

      public EditorController()
  • Method Details

    • initialize

      public void initialize​(java.net.URL url, java.util.ResourceBundle resourceBundle)
      Initializes the controller, and binds the event of change in editor content to editorChanged
      Specified by:
      initialize in interface javafx.fxml.Initializable
    • setEventBus

      public void setEventBus​(com.google.common.eventbus.EventBus eventBus)
      Description copied from interface: Controller
      Registers the main EventBus into the controller.
      Specified by:
      setEventBus in interface Controller
    • saveCodeArea

      public void saveCodeArea​(boolean isNewFile)
      Saving/Writing to the file based on the active filepath in Model if it is a new File. Otherwise it will open a dialog to ask the user where to save the file.
      Parameters:
      isNewFile - Whether or not the file already has a path
    • handle

      public void handle​(OpenFileEvent event)
      Updates the CodeArea whenever a new file is opened.
      Parameters:
      event -
    • handle

      public void handle​(SaveFileEvent event)
      Saves the editor content to a file
      Parameters:
      event -
    • handle

      public void handle​(LanguageChangedEvent event)
      Refreshes the syntax highlighting when the Programming language is changed
      Parameters:
      event -
    • handle

      public void handle​(ToggleCommentEvent event)
      Toggles a comment based on the editor state
      Parameters:
      event -
    • handle

      public void handle​(ToggleWrapTextEvent event)
      Toggles the WrapText setting
      Parameters:
      event -
    • handle

      public void handle​(UndoEvent event)
      Undo if focused
      Parameters:
      event -
    • handle

      public void handle​(RedoEvent event)
      Redo if focused
      Parameters:
      event -
    • handle

      public void handle​(CopyEvent event)
      Copy selected content if focused
      Parameters:
      event -
    • handle

      public void handle​(CutEvent event)
      Cut selected content if focused
      Parameters:
      event -
    • handle

      public void handle​(PasteEvent event)
      Paste from clipboard if focused
      Parameters:
      event -