Tutorial Main View Controller

Main FXML File

The MainViewController in the /controller/MainViewController needs a valid FXML File. The bindings for Navigation, Workspace and StatusBar Controller uses the fx:id values.

        <AnchorPane fx:id="navigationPane"/>
        <AnchorPane fx:id="workspacePane"/>
        <AnchorPane fx:id="statusPane"/>


For adding SubController and displaying their UI content following steps are needed:

  1. Prepare SubController
  2. Connect with FXML identifier
  3. Define ContentManager
  4. Load Controller in the MainViewController LifeCycle
  5. Optional Prepare Functions for Controller switching
  6. Optional CDI based Functions / Injection Points

Prepare SubController

lazy val workspaceController: WorkspaceController =
lazy val barChartController: BarChartController =
lazy val personController: PersonController =
lazy val navigationController: NavigationController =
lazy val statusBarController: StatusBarController =
  new StatusBarController()

Connect with FXML identifier

var workspacePane: Pane = _
var statusPane: Pane = _
var navigationPane: Pane = _


var workspaceManager: ContentManager = _
var navigationManager: ContentManager = _
var statusBarManager: ContentManager = _

Init Controller

override def didGainVisibilityFirstTime() {
  navigationManager = ContentManager(navigationPane, this, navigationController)
  statusBarManager = ContentManager(statusPane, this, statusBarController)
  workspaceManager = ContentManager(workspacePane, this, workspaceController)