diff --git a/src/main/java/com/andrewlalis/perfin/PerfinApp.java b/src/main/java/com/andrewlalis/perfin/PerfinApp.java index 8ec3dbc..1519681 100644 --- a/src/main/java/com/andrewlalis/perfin/PerfinApp.java +++ b/src/main/java/com/andrewlalis/perfin/PerfinApp.java @@ -34,6 +34,12 @@ public class PerfinApp extends Application { */ public static final SceneRouter router = new SceneRouter(new AnchorPaneRouterView(true)); + /** + * A router that controls which help page is being viewed in the side-pane. + * Certain user actions may cause this router to navigate to certain pages. + */ + public static final SceneRouter helpRouter = new SceneRouter(new AnchorPaneRouterView(true)); + public static void main(String[] args) { launch(args); } @@ -82,6 +88,10 @@ public class PerfinApp extends Application { mapResourceRoute("transactions", "/transactions-view.fxml"); mapResourceRoute("create-transaction", "/create-transaction.fxml"); mapResourceRoute("create-balance-record", "/create-balance-record.fxml"); + + // Map help pages. + helpRouter.map("help-test", PerfinApp.class.getResource("/help-pages/help-test.fxml")); + helpRouter.map("home", PerfinApp.class.getResource("/help-pages/home.fxml")); }); } diff --git a/src/main/java/com/andrewlalis/perfin/control/MainViewController.java b/src/main/java/com/andrewlalis/perfin/control/MainViewController.java index 6e9c27b..1872308 100644 --- a/src/main/java/com/andrewlalis/perfin/control/MainViewController.java +++ b/src/main/java/com/andrewlalis/perfin/control/MainViewController.java @@ -10,6 +10,7 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; +import static com.andrewlalis.perfin.PerfinApp.helpRouter; import static com.andrewlalis.perfin.PerfinApp.router; public class MainViewController { @@ -37,6 +38,9 @@ public class MainViewController { } ); + router.navigate("accounts"); + + // Initialize the help manual components. manualVBox.managedProperty().bind(manualVBox.visibleProperty()); manualVBox.setVisible(false); showManualButton.managedProperty().bind(showManualButton.visibleProperty()); @@ -44,7 +48,10 @@ public class MainViewController { hideManualButton.managedProperty().bind(hideManualButton.visibleProperty()); hideManualButton.visibleProperty().bind(manualVBox.visibleProperty()); - router.navigate("accounts"); + AnchorPaneRouterView helpRouterView = (AnchorPaneRouterView) helpRouter.getView(); + manualVBox.getChildren().add(helpRouterView.getAnchorPane()); + + helpRouter.navigate("home"); } @FXML public void goBack() { diff --git a/src/main/resources/help-pages/help-test.fxml b/src/main/resources/help-pages/help-test.fxml new file mode 100644 index 0000000..a01b7aa --- /dev/null +++ b/src/main/resources/help-pages/help-test.fxml @@ -0,0 +1,15 @@ + + + + + + + + + This is a testing help page, which is meant to be shown only for + testing the help system and navigation. + + + diff --git a/src/main/resources/help-pages/home.fxml b/src/main/resources/help-pages/home.fxml new file mode 100644 index 0000000..cd3a519 --- /dev/null +++ b/src/main/resources/help-pages/home.fxml @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/src/main/resources/main-view.fxml b/src/main/resources/main-view.fxml index 90d1a3e..318e645 100644 --- a/src/main/resources/main-view.fxml +++ b/src/main/resources/main-view.fxml @@ -2,8 +2,6 @@ - - - - +