Tutorial Navigation
Navigation FXML File
source<AnchorPane fx:controller="NavigationController">
<children>
<HBox>
<children>
<Button onAction="#actionToggleWorkspace"
text="%navigation.toggle"/>
<Button onAction="#actionShowPersonController"
text="FXBean Demo"/>
<Button onAction="#actionClickButton"
text="Action Button"/>
<Button id="debugButton" onAction="#actionReload"
text="[Debug] Reload"/>
</children>
<padding>
<Insets left="10.0" top="7.0"/>
</padding>
</HBox>
</children>
<stylesheets>
<URL value="@default.css"/>
</stylesheets>
</AnchorPane>
NavigationController
sourcepackage com.sfxcode.sapphire.javafx.demo.tutorial.controller.app
import com.sfxcode.sapphire.javafx.demo.tutorial.controller.base.AbstractViewController
import com.sfxcode.sapphire.javafx.scene.SFXEaseInTransition
import javafx.event.ActionEvent
import javafx.scene.control.Button
class NavigationController extends AbstractViewController {
def actionToggleWorkspace(event: ActionEvent) {
actionClickButton(event)
val actualController = workspaceManager.actualController
val barChartController = mainViewController.barChartController
val workspaceController = mainViewController.workspaceController
if (actualController == workspaceController)
workspaceManager.updateWithTransition(barChartController)
else
workspaceManager.updateWithTransition(workspaceController)
}
def actionShowPersonController(event: ActionEvent): Unit = {
actionClickButton(event)
val personController = mainViewController.personController
workspaceManager.updateWithTransition(personController)
}
def actionClickButton(event: ActionEvent) {
logger.debug(event.toString)
val button = event.getSource.asInstanceOf[Button]
statusBarController.updateLabel(button)
}
def actionReload(event: ActionEvent): Unit = {
actionClickButton(event)
applicationController.reload()
}
}
1.1.3*