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.
source<BorderPane>
<top>
<AnchorPane fx:id="navigationPane"/>
</top>
<center>
<AnchorPane fx:id="workspacePane"/>
</center>
<bottom>
<AnchorPane fx:id="statusPane"/>
</bottom>
</BorderPane>
MainViewController
For adding SubController and displaying their UI content following steps are needed:
- Prepare SubController
- Connect with FXML identifier
- Define ContentManager
- Load Controller in the MainViewController LifeCycle
- Optional Prepare Functions for Controller switching
- Optional CDI based Functions / Injection Points
Prepare SubController
sourcelazy val workspaceController: WorkspaceController =
getController[WorkspaceController]()
lazy val barChartController: ChartPageController =
getController[ChartPageController]()
lazy val personController: PersonPageController =
getController[PersonPageController]()
lazy val navigationController: NavigationController =
getController[NavigationController]()
lazy val statusBarController: StatusBarController =
new StatusBarController()
Connect with FXML identifier
source@FXML
var workspacePane: Pane = _
@FXML
var statusPane: Pane = _
@FXML
var navigationPane: Pane = _
ContentManager
sourcevar workspaceManager: SFXContentManager = _
var navigationManager: SFXContentManager = _
var statusBarManager: SFXContentManager = _
Init Controller
sourceoverride def didGainVisibilityFirstTime() {
super.didGainVisibility()
navigationManager = SFXContentManager(navigationPane, this, navigationController)
statusBarManager = SFXContentManager(statusPane, this, statusBarController)
workspaceManager = SFXContentManager(workspacePane, this, workspaceController)
}
1.1.3*