-
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.
feat: made a MainController and a HeaderController which make it poss…
…ible to change pages with header buttons
- Loading branch information
Showing
7 changed files
with
91 additions
and
34 deletions.
There are no files selected for viewing
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
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,4 +1,22 @@ | ||
| package edu.group5.app.control; | ||
|
|
||
| public class HomePageController { | ||
| public class HeaderController { | ||
| private final MainController controller; | ||
|
|
||
| public HeaderController(MainController controller) { | ||
| this.controller = controller; | ||
| } | ||
|
|
||
| public void handleHomeBtn() { | ||
| System.out.println("Home button pressed"); | ||
| controller.showHomePage(); | ||
| } | ||
|
|
||
| public void handleCausesBtn() { | ||
| System.out.println("Causes button pressed"); | ||
| } | ||
|
|
||
| public void handleAboutBtn() { | ||
| System.out.println("About button pressed"); | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package edu.group5.app.control; | ||
|
|
||
| import edu.group5.app.view.MainView; | ||
|
|
||
| public class MainController { | ||
| private MainView view; | ||
|
|
||
| public void setMainView(MainView view) { | ||
| this.view = view; | ||
| } | ||
|
|
||
| public void showHomePage() { | ||
| view.showHomePage(); | ||
| } | ||
|
|
||
| public void showLoginPage() { | ||
| view.showLoginPage(); | ||
| } | ||
| } |
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
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 |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package edu.group5.app.view; | ||
|
|
||
| import edu.group5.app.control.HeaderController; | ||
| import edu.group5.app.control.MainController; | ||
| import edu.group5.app.view.homepage.HomePageView; | ||
| import javafx.scene.Scene; | ||
| import javafx.scene.layout.BorderPane; | ||
|
|
||
| public class MainView { | ||
| private final MainController mainController; | ||
| private final HeaderController headerController; | ||
| private final BorderPane root; | ||
|
|
||
| public MainView(MainController mainController) { | ||
| this.mainController = mainController; | ||
| this.headerController = new HeaderController(mainController); | ||
| this.root = new BorderPane(); | ||
| } | ||
|
|
||
| public Scene createView() { | ||
| root.setCenter(new HomePageView(headerController)); | ||
| return new Scene(root, 1280, 720); | ||
| } | ||
|
|
||
| public void showHomePage() { | ||
| root.setCenter(new HomePageView(headerController)); | ||
| } | ||
|
|
||
| public void showLoginPage() { | ||
|
|
||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
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,11 +1,12 @@ | ||
| package edu.group5.app.view.homepage; | ||
|
|
||
| import edu.group5.app.App; | ||
| import edu.group5.app.control.HeaderController; | ||
| import edu.group5.app.view.Header; | ||
| import javafx.scene.layout.BorderPane; | ||
|
|
||
| public class HomePageView extends BorderPane { | ||
| public HomePageView(App app) { | ||
| HeaderView headerView = new HeaderView(app); | ||
| public HomePageView(HeaderController headerController) { | ||
| Header headerView = new Header(headerController); | ||
| setTop(headerView); | ||
| } | ||
| } |