Incorporated latest scene router version.

This commit is contained in:
Andrew Lalis 2023-12-25 18:31:01 -05:00
parent b1043c1624
commit 30df89d5b7
8 changed files with 21 additions and 13 deletions

View File

@ -29,7 +29,7 @@
<dependency> <dependency>
<groupId>com.andrewlalis</groupId> <groupId>com.andrewlalis</groupId>
<artifactId>javafx-scene-router</artifactId> <artifactId>javafx-scene-router</artifactId>
<version>1.3.0</version> <version>1.4.0</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -1,5 +1,6 @@
package com.andrewlalis.perfin; package com.andrewlalis.perfin;
import com.andrewlalis.javafx_scene_router.AnchorPaneRouterView;
import com.andrewlalis.javafx_scene_router.SceneRouter; import com.andrewlalis.javafx_scene_router.SceneRouter;
import com.andrewlalis.perfin.view.SplashScreenStage; import com.andrewlalis.perfin.view.SplashScreenStage;
import javafx.application.Application; import javafx.application.Application;
@ -17,7 +18,7 @@ public class PerfinApp extends Application {
/** /**
* The router that's used for navigating between different "pages" in the application. * The router that's used for navigating between different "pages" in the application.
*/ */
public static final SceneRouter router = new SceneRouter(); public static final SceneRouter router = new SceneRouter(new AnchorPaneRouterView(true));
public static void main(String[] args) { public static void main(String[] args) {
launch(args); launch(args);

View File

@ -37,10 +37,7 @@ public class AccountTileController {
accountNumberLabel.setText(account.getAccountNumber()); accountNumberLabel.setText(account.getAccountNumber());
accountBalanceLabel.setText(account.getCurrency().getSymbol()); accountBalanceLabel.setText(account.getCurrency().getSymbol());
accountNameLabel.setText(account.getName()); accountNameLabel.setText(account.getName());
container.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> { container.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> router.navigate("account", account));
System.out.println("Clicked on " + account.getAccountNumber());
router.navigate("account", account);
});
}); });
} }
} }

View File

@ -6,7 +6,6 @@ import javafx.fxml.FXML;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
public class AccountViewController implements RouteSelectionListener { public class AccountViewController implements RouteSelectionListener {

View File

@ -1,5 +1,6 @@
package com.andrewlalis.perfin.control; package com.andrewlalis.perfin.control;
import com.andrewlalis.javafx_scene_router.AnchorPaneRouterView;
import com.andrewlalis.perfin.view.BindingUtil; import com.andrewlalis.perfin.view.BindingUtil;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Label; import javafx.scene.control.Label;
@ -18,7 +19,10 @@ public class MainViewController {
@FXML @FXML
public void initialize() { public void initialize() {
mainContainer.setCenter(router.getViewPane()); AnchorPaneRouterView routerView = (AnchorPaneRouterView) router.getView();
mainContainer.setCenter(routerView.getAnchorPane());
routerView.getAnchorPane().setStyle("-fx-border-color: orange;");
// Set up a simple breadcrumb display in the top bar.
BindingUtil.mapContent( BindingUtil.mapContent(
breadcrumbHBox.getChildren(), breadcrumbHBox.getChildren(),
router.getBreadCrumbs(), router.getBreadCrumbs(),

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.*?>
<?import javafx.scene.layout.VBox?>
<BorderPane <BorderPane
xmlns="http://javafx.com/javafx" xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.andrewlalis.perfin.control.AccountViewController" fx:controller="com.andrewlalis.perfin.control.AccountViewController"
stylesheets="@style/account-view.css" stylesheets="@style/account-view.css"
styleClass="main-container" styleClass="main-container"
style="-fx-border-color: green;"
> >
<top> <top>
<Label fx:id="titleLabel"/> <Label fx:id="titleLabel"/>
</top> </top>
<center> <center>
<VBox> <VBox style="-fx-border-color: blue;" >
<VBox styleClass="account-property-box"> <VBox styleClass="account-property-box">
<Label text="Name"/> <Label text="Name"/>
<TextField fx:id="accountNameField" editable="false"/> <TextField fx:id="accountNameField" editable="false"/>
@ -33,4 +33,10 @@
</VBox> </VBox>
</VBox> </VBox>
</center> </center>
<right>
<VBox style="-fx-border-color: red;">
<Button text="Edit"/>
<Button text="Delete"/>
</VBox>
</right>
</BorderPane> </BorderPane>

View File

@ -8,6 +8,7 @@
fx:id="mainContainer" fx:id="mainContainer"
fx:controller="com.andrewlalis.perfin.control.MainViewController" fx:controller="com.andrewlalis.perfin.control.MainViewController"
stylesheets="@style/main-view.css" stylesheets="@style/main-view.css"
style="-fx-border-color: purple;"
> >
<top> <top>
<VBox> <VBox>
@ -19,7 +20,6 @@
<HBox fx:id="breadcrumbHBox"/> <HBox fx:id="breadcrumbHBox"/>
<Separator/> <Separator/>
</VBox> </VBox>
</top> </top>
<bottom> <bottom>
<HBox fx:id="mainFooter" spacing="5"> <HBox fx:id="mainFooter" spacing="5">

View File

@ -17,7 +17,8 @@
} }
.account-property-box > TextField { .account-property-box > TextField {
-fx-min-width: 200px; -fx-min-width: 100px;
-fx-max-width: 300px;
} }
#accountNumberField { #accountNumberField {