Added first placeholder help pages, and initialization to controller.

This commit is contained in:
Andrew Lalis 2024-01-08 23:13:15 -05:00
parent 8270c5a273
commit 2a79afe1b5
5 changed files with 63 additions and 12 deletions

View File

@ -34,6 +34,12 @@ public class PerfinApp extends Application {
*/ */
public static final SceneRouter router = new SceneRouter(new AnchorPaneRouterView(true)); 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) { public static void main(String[] args) {
launch(args); launch(args);
} }
@ -82,6 +88,10 @@ public class PerfinApp extends Application {
mapResourceRoute("transactions", "/transactions-view.fxml"); mapResourceRoute("transactions", "/transactions-view.fxml");
mapResourceRoute("create-transaction", "/create-transaction.fxml"); mapResourceRoute("create-transaction", "/create-transaction.fxml");
mapResourceRoute("create-balance-record", "/create-balance-record.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"));
}); });
} }

View File

@ -10,6 +10,7 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import static com.andrewlalis.perfin.PerfinApp.helpRouter;
import static com.andrewlalis.perfin.PerfinApp.router; import static com.andrewlalis.perfin.PerfinApp.router;
public class MainViewController { public class MainViewController {
@ -37,6 +38,9 @@ public class MainViewController {
} }
); );
router.navigate("accounts");
// Initialize the help manual components.
manualVBox.managedProperty().bind(manualVBox.visibleProperty()); manualVBox.managedProperty().bind(manualVBox.visibleProperty());
manualVBox.setVisible(false); manualVBox.setVisible(false);
showManualButton.managedProperty().bind(showManualButton.visibleProperty()); showManualButton.managedProperty().bind(showManualButton.visibleProperty());
@ -44,7 +48,10 @@ public class MainViewController {
hideManualButton.managedProperty().bind(hideManualButton.visibleProperty()); hideManualButton.managedProperty().bind(hideManualButton.visibleProperty());
hideManualButton.visibleProperty().bind(manualVBox.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() { @FXML public void goBack() {

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
>
<TextFlow>
<Text>
This is a testing help page, which is meant to be shown only for
testing the help system and navigation.
</Text>
</TextFlow>
</VBox>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
>
<Label styleClass="large-font,bold-text" text="Perfin Help Pages"/>
<TextFlow>
<Text>
This is the homepage for Perfin's help pages: a manual for how to
use Perfin safely and effectively to manage your personal finances.
</Text>
</TextFlow>
<TextFlow>
<Text>
Search for a topic below, or click on the help icon beside some
component to navigate to its page.
</Text>
</TextFlow>
<HBox>
<Label text="Search!"/>
<TextField/>
</HBox>
</VBox>

View File

@ -2,8 +2,6 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.TextFlow?>
<?import javafx.scene.text.Text?>
<BorderPane <BorderPane
xmlns="http://javafx.com/javafx" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
@ -31,14 +29,6 @@
</HBox> </HBox>
</bottom> </bottom>
<right> <right>
<VBox fx:id="manualVBox" style="-fx-min-width: 400px;" styleClass="padding-extra-1,std-spacing"> <VBox fx:id="manualVBox" style="-fx-min-width: 400px;" styleClass="padding-extra-1"/>
<Label text="Perfin User Manual" styleClass="large-font,bold-text"/>
<TextFlow>
<Text>
This manual is your guide on how to properly use Perfin to
manage your personal finances.
</Text>
</TextFlow>
</VBox>
</right> </right>
</BorderPane> </BorderPane>