Class BaseController

java.lang.Object
ch.autumo.ui.fx.controller.BaseController
All Implemented Interfaces:
Initializable
Direct Known Subclasses:
DefaultInfoController

public abstract class BaseController extends Object implements Initializable
FX Base Controller.
  • Field Details

    • app

      protected BaseApp app
      Application.
    • stage

      protected Stage stage
      Stage.
    • model

      protected BaseModel model
      Model.
    • view

      protected Pane view
      View.
  • Constructor Details

    • BaseController

      public BaseController(BaseApp app, Stage stage, BaseModel model, Pane view)
      Main controller.
      Parameters:
      app - app
      stage - stage
      model - model
      view - view
  • Method Details

    • getApp

      public BaseApp getApp()
      Get the application.
      Returns:
      application
    • getStage

      public Stage getStage()
      Get the stage.
      Returns:
      stage
    • getModel

      public BaseModel getModel()
      Get model.
      Returns:
      model
    • getView

      public Pane getView()
      Get view.
      Returns:
      model
    • keyPressed

      public void keyPressed(KeyEvent key)
      Override if you want to execute more actions on specific keyboard shortcuts for the stage/scene associated.
      Parameters:
      key - key pressed
    • initializeRecentMenu

      public void initializeRecentMenu(Menu menuRecent, MenuItem menuItemClearAllRecent)
      Initialize recent menu structure.
      Parameters:
      menuRecent - the 'recent' sub-menu
      menuItemClearAllRecent - the 'clear all entry' menu entry or null (will be created)
    • getMenuRecent

      public Menu getMenuRecent()
      Get the 'recent' sub-menu.
      Returns:
      'recent' sub-menu
    • getMenuItemClearAllRecent

      public MenuItem getMenuItemClearAllRecent()
      Get the 'clear all entry' menu entry.
      Returns:
      'clear all entry' menu entry
    • rebuildRecentList

      public void rebuildRecentList()
      Rebuild recent file list.
    • disableMacOSMenuDetach

      public final void disableMacOSMenuDetach()
      Prevent macOS menu detach.
    • getMenuBar

      public MenuBar getMenuBar()
      Only called on macOS. Get menu bar; implement this, if you want to detach the application menu on macOS system and to add it to macOS its desktop menu. If you implement this, you might want to implement the method getToolBar()! Note: This is usually used for main views only! If this method returns null, the menu bar stays attached to the application and getToolBar() is not called. Overwrite if necessary.
      Returns:
      menu bar.
    • getToolBar

      public Pane getToolBar()
      Only called on macOS. Returns the tool bar; see getMenuBar(). It is only called if getMenuBar() returns not null! It repositions the tool bar after detaching the menu bar. The tool bar should be inside a pane with a shifted top anchor ('AnchorPane.topAnchor'); it is set to zero!
      Returns:
      tool bar pane.
    • innerOpen

      protected void innerOpen(File file)
      Overwrite to open a file from recent list.
      Parameters:
      file - file
    • initialize

      public final void initialize(URL location, ResourceBundle resources)
      Specified by:
      initialize in interface Initializable
    • init

      public abstract void init(URL location, ResourceBundle resources, double toolBarShift)
      Delegated initialization. See Initializable.initialize(URL, ResourceBundle).
      Parameters:
      location - The location used to resolve relative paths for the root object, or null if the location is not known.
      resources - The resources used to localize the root object, or null if the root object was not localized.
      toolBarShift - if the tool bar has been shifted, this value is bigger than zero and can be used to adjust the UI layout.