-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
57 additions
and
1 deletion.
There are no files selected for viewing
58 changes: 57 additions & 1 deletion
58
src/main/java/edu/group5/app/view/homepage/HomePageView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,68 @@ | ||
| package edu.group5.app.view.homepage; | ||
|
|
||
| import edu.group5.app.control.HeaderController; | ||
| import edu.group5.app.control.HomePageController; | ||
| import edu.group5.app.view.Header; | ||
| import javafx.geometry.Pos; | ||
| import javafx.scene.control.Button; | ||
| import javafx.scene.control.ScrollPane; | ||
| import javafx.scene.layout.BorderPane; | ||
| import javafx.scene.layout.StackPane; | ||
| import javafx.scene.layout.VBox; | ||
| import javafx.scene.text.Text; | ||
|
|
||
| public class HomePageView extends BorderPane { | ||
| public HomePageView(HeaderController headerController) { | ||
| private final HomePageController controller; | ||
|
|
||
| public HomePageView(HomePageController homePageController, HeaderController headerController) { | ||
| this.controller = homePageController; | ||
| getStylesheets().add(getClass().getResource("/homepage/homepage.css").toExternalForm()); | ||
| Header headerView = new Header(headerController); | ||
| setTop(headerView); | ||
| setCenter(createBody()); | ||
| } | ||
|
|
||
| private ScrollPane createBody() { | ||
| ScrollPane body = new ScrollPane(); | ||
| body.setFitToWidth(true); | ||
| VBox vBox = new VBox(); | ||
| vBox.getChildren().addAll( | ||
| createIntroductionSection(), | ||
| createCharityImageSection(), | ||
| createCharityImageSection() | ||
| ); | ||
| body.setContent(vBox); | ||
| return body; | ||
| } | ||
|
|
||
| private VBox createIntroductionSection() { | ||
| VBox introductionSection = new VBox(); | ||
| introductionSection.setId("introduction-section"); | ||
| introductionSection.setAlignment(Pos.CENTER); | ||
| introductionSection.setSpacing(10); | ||
|
|
||
| Text h1 = new Text("MAKE A DIFFERENCE TODAY"); | ||
| h1.setId("h1"); | ||
| Text h2 = new Text("SUPPORT THOSE IN NEED AROUND THE WORLD"); | ||
| h2.setId("h2"); | ||
|
|
||
| Button donateToACauseBtn = new Button("Donate to a cause"); | ||
| donateToACauseBtn.setOnAction(e -> controller.handleDonateToACauseBtn()); | ||
|
|
||
| Button aboutUsBtn = new Button("About us"); | ||
| aboutUsBtn.setOnAction(e -> controller.handleAboutUsBtn()); | ||
|
|
||
| introductionSection.getChildren().addAll(h1, h2, donateToACauseBtn, aboutUsBtn); | ||
| return introductionSection; | ||
| } | ||
|
|
||
| private StackPane createCharityImageSection() { | ||
| StackPane charityImageSection = new StackPane(); | ||
| charityImageSection.setId("charity-image-section"); | ||
| charityImageSection.setPrefHeight(300); | ||
| StackPane image = new StackPane(); | ||
| image.setId("charity-image"); | ||
| charityImageSection.getChildren().add(image); | ||
| return charityImageSection; | ||
| } | ||
| } |