Package ch.autumo.ui.fx.controller
Class BaseController
java.lang.Object
ch.autumo.ui.fx.controller.BaseController
- All Implemented Interfaces:
Initializable
- Direct Known Subclasses:
DefaultInfoController
FX Base Controller.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionBaseController
(BaseApp app, Stage stage, BaseModel model, Pane view) Main controller. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Prevent macOS menu detach.getApp()
Get the application.Only called on macOS.Get the 'clear all entry' menu entry.Get the 'recent' sub-menu.getModel()
Get model.getStage()
Get the stage.Only called on macOS.getView()
Get view.abstract void
init
(URL location, ResourceBundle resources, double toolBarShift) Delegated initialization.final void
initialize
(URL location, ResourceBundle resources) void
initializeRecentMenu
(Menu menuRecent, MenuItem menuItemClearAllRecent) Initialize recent menu structure.protected void
Overwrite to open a file from recent list.void
keyPressed
(KeyEvent key) Override if you want to execute more actions on specific keyboard shortcuts for the stage/scene associated.void
Rebuild recent file list.
-
Field Details
-
app
Application. -
stage
Stage. -
model
Model. -
view
View.
-
-
Constructor Details
-
BaseController
Main controller.- Parameters:
app
- appstage
- stagemodel
- modelview
- view
-
-
Method Details
-
getApp
Get the application.- Returns:
- application
-
getStage
Get the stage.- Returns:
- stage
-
getModel
Get model.- Returns:
- model
-
getView
Get view.- Returns:
- model
-
keyPressed
Override if you want to execute more actions on specific keyboard shortcuts for the stage/scene associated.- Parameters:
key
- key pressed
-
initializeRecentMenu
Initialize recent menu structure.- Parameters:
menuRecent
- the 'recent' sub-menumenuItemClearAllRecent
- the 'clear all entry' menu entry or null (will be created)
-
getMenuRecent
Get the 'recent' sub-menu.- Returns:
- 'recent' sub-menu
-
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
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 methodgetToolBar()
! Note: This is usually used for main views only! If this method returns null, the menu bar stays attached to the application andgetToolBar()
is not called. Overwrite if necessary.- Returns:
- menu bar.
-
getToolBar
Only called on macOS. Returns the tool bar; seegetMenuBar()
. It is only called ifgetMenuBar()
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
Overwrite to open a file from recent list.- Parameters:
file
- file
-
initialize
- Specified by:
initialize
in interfaceInitializable
-
init
Delegated initialization. SeeInitializable.initialize(URL, ResourceBundle)
.- Parameters:
location
- The location used to resolve relative paths for the root object, ornull
if the location is not known.resources
- The resources used to localize the root object, ornull
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.
-