Skip to content

Commit

Permalink
Close #2
Browse files Browse the repository at this point in the history
PubuduJ committed Nov 13, 2022
1 parent 5393845 commit 1fb4959
Showing 16 changed files with 224 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/main/java/AppInitializer.java
Original file line number Diff line number Diff line change
@@ -19,7 +19,10 @@ public static void main(String[] args) {
public void start(Stage primaryStage) throws IOException {
Parent root = FXMLLoader.load(this.getClass().getResource("/view/SplashScreenForm.fxml"));
Scene scene = new Scene(root);
scene.setFill(Color.TRANSPARENT);
primaryStage.setScene(scene);
primaryStage.initStyle(StageStyle.TRANSPARENT);
primaryStage.setResizable(false);
primaryStage.centerOnScreen();
primaryStage.show();
}
4 changes: 4 additions & 0 deletions src/main/java/controller/HomeFormController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package controller;

public class HomeFormController {
}
82 changes: 82 additions & 0 deletions src/main/java/controller/SplashScreenFormController.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,86 @@
package controller;

import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import javafx.util.Duration;
import util.Navigation;

import java.io.IOException;

public class SplashScreenFormController {
public Label lblStatus;
public Rectangle pgbContainer;
public Rectangle pgbLoad;

public void initialize() {
Timeline timeline = new Timeline();
KeyFrame frameOne = new KeyFrame(Duration.millis(0), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
lblStatus.setText("Welcome to National Fuel Pass App...!");
pgbLoad.setWidth(pgbLoad.getWidth());
}
});
KeyFrame frameTwo = new KeyFrame(Duration.millis(1000), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
lblStatus.setText("Connecting with the database...!");
pgbLoad.setWidth(pgbLoad.getWidth() + 70);
}
});
KeyFrame frameThree = new KeyFrame(Duration.millis(1750), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
lblStatus.setText("Loading data...!");
pgbLoad.setWidth(pgbLoad.getWidth() + 130);
}
});
KeyFrame frameFour = new KeyFrame(Duration.millis(2500), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
lblStatus.setText("Setting up the UI...!");
pgbLoad.setWidth(pgbLoad.getWidth() + 250);
}
});
KeyFrame frameFive = new KeyFrame(Duration.millis(3000), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
lblStatus.setText("Setting up the UI...!");
pgbLoad.setWidth(pgbContainer.getWidth());
}
});
KeyFrame frameSix = new KeyFrame(Duration.millis(3500), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
try {
pgbLoad.setWidth(pgbContainer.getWidth());
Parent homeFormContainer = FXMLLoader.load(this.getClass().getResource("/view/HomeForm.fxml"));
Scene scene = new Scene(homeFormContainer);
AnchorPane pneContainer = (AnchorPane) homeFormContainer.lookup("#pneContainer");
Navigation.init(pneContainer);
Stage stage = new Stage();
stage.setScene(scene);
stage.setTitle("National Fuel Pass App");
stage.setMinWidth(700);
stage.setMinHeight(525);
stage.show();
stage.centerOnScreen();
lblStatus.getScene().getWindow().hide();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
timeline.getKeyFrames().addAll(frameOne,frameTwo,frameThree,frameFour,frameFive,frameSix);
timeline.playFromStart();
}
}
5 changes: 5 additions & 0 deletions src/main/java/controller/WelcomeFormController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package controller;

public class WelcomeFormController {

}
35 changes: 35 additions & 0 deletions src/main/java/util/Navigation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package util;

import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.layout.AnchorPane;

import java.io.IOException;
import java.net.URL;

public class Navigation {

private static AnchorPane pneContainer;

public static void init(AnchorPane anchorPane) {
Navigation.pneContainer = anchorPane;
}

public static Object navigate(Routes route) throws IOException {
pneContainer.getChildren().clear();
URL resource = null;
switch (route) {
case WELCOME:
resource = Navigation.class.getResource("/view/WelcomeForm.fxml");
break;
}
FXMLLoader fxmlLoader = new FXMLLoader(resource);
Parent root = fxmlLoader.load();
pneContainer.getChildren().add(root);
AnchorPane.setLeftAnchor(root,0.0);
AnchorPane.setRightAnchor(root,0.0);
AnchorPane.setBottomAnchor(root,0.0);
AnchorPane.setTopAnchor(root,0.0);
return fxmlLoader.getController();
}
}
5 changes: 5 additions & 0 deletions src/main/java/util/Routes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package util;

public enum Routes {
WELCOME, REGISTRATION, LOGIN, ADMIN_LOGIN, CONTROL_CENTER, DASHBOARD
}
Binary file added src/main/resources/img/ceypetco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/fuelStation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/ioc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/lock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/padlock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/img/qrCode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/main/resources/view/HomeForm.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="controller.HomeFormController"
prefHeight="400.0" prefWidth="600.0">

</AnchorPane>
71 changes: 62 additions & 9 deletions src/main/resources/view/SplashScreenForm.fxml
Original file line number Diff line number Diff line change
@@ -1,14 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<?import javafx.scene.shape.Rectangle?>
<?import javafx.scene.text.Font?>

<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="controller.SplashScreenFormController"
prefHeight="400.0" prefWidth="600.0">

<AnchorPane prefHeight="355.0" prefWidth="563.0" style="-fx-background-color: rgba(0,0,0,0);" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.SplashScreenFormController">
<children>
<AnchorPane layoutY="51.0" prefHeight="315.0" prefWidth="563.0" style="-fx-background-color: black;" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0">
<children>
<Circle fill="WHITE" layoutX="101.0" layoutY="65.0" radius="97.0" stroke="BLACK" strokeType="INSIDE" />
<AnchorPane prefHeight="315.0" prefWidth="563.0" style="-fx-background-color: white;" AnchorPane.bottomAnchor="1.0" AnchorPane.leftAnchor="1.0" AnchorPane.rightAnchor="1.0" AnchorPane.topAnchor="1.0">
<children>
<ImageView fitHeight="60.0" fitWidth="271.0" layoutX="23.0" layoutY="232.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/logo.png" />
</image>
</ImageView>
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="23.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/fuelStation.png" />
</image>
</ImageView>
<VBox layoutX="188.9199981689453" layoutY="14.0" spacing="3.0">
<children>
<Label prefHeight="42.0" prefWidth="357.0" text="National Fuel Pass App">
<font>
<Font name="Cantarell Bold" size="33.0" />
</font>
</Label>
<Label text=" " />
<Label prefHeight="25.0" prefWidth="52.0" text="v1.0.0">
<font>
<Font name="Cantarell Extra Bold" size="16.0" />
</font>
</Label>
<Label fx:id="lblStatus" prefHeight="18.0" prefWidth="363.0" text="Welcome to National Fuel Pass App...!">
<font>
<Font name="Cantarell Extra Bold" size="14.0" />
</font>
</Label>
</children>
</VBox>
<ImageView fitHeight="60.0" fitWidth="60.0" layoutX="495.0" layoutY="241.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/ceypetco.png" />
</image>
</ImageView>
<ImageView fitHeight="60.0" fitWidth="64.0" layoutX="435.0" layoutY="240.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/ioc.png" />
</image>
</ImageView>
<Rectangle fx:id="pgbContainer" fill="#3790e4" height="5.0" layoutY="286.0" stroke="#10a6f2" strokeType="INSIDE" strokeWidth="0.0" width="563.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="-1.0" AnchorPane.rightAnchor="-1.0" />
<Rectangle fx:id="pgbLoad" fill="#0eab13" height="5.0" layoutY="286.0" stroke="#219723" strokeType="INSIDE" width="32.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="-1.0" />
</children>
</AnchorPane>
</children>
</AnchorPane>
</children>
</AnchorPane>
14 changes: 14 additions & 0 deletions src/main/resources/view/WelcomeForm.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>

<AnchorPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="controller.WelcomeFormController"
prefHeight="400.0" prefWidth="600.0">

</AnchorPane>

0 comments on commit 1fb4959

Please sign in to comment.