diff --git a/client/src/main/java/client/Main.java b/client/src/main/java/client/Main.java index 8be1175..7a7137b 100644 --- a/client/src/main/java/client/Main.java +++ b/client/src/main/java/client/Main.java @@ -20,6 +20,7 @@ import static com.google.inject.Guice.createInjector; import java.io.IOException; import java.net.URISyntaxException; +import client.scenes.FoodpalApplicationCtrl; import com.google.inject.Injector; import client.scenes.AddQuoteCtrl; @@ -50,8 +51,9 @@ public class Main extends Application { var overview = FXML.load(QuoteOverviewCtrl.class, "client", "scenes", "QuoteOverview.fxml"); var add = FXML.load(AddQuoteCtrl.class, "client", "scenes", "AddQuote.fxml"); + var foodpal = FXML.load(FoodpalApplicationCtrl.class, "client", "scenes", "FoodpalApplication.fxml"); var mainCtrl = INJECTOR.getInstance(MainCtrl.class); - mainCtrl.initialize(primaryStage, overview, add); + mainCtrl.initialize(primaryStage, overview, add, foodpal); } } \ No newline at end of file diff --git a/client/src/main/java/client/scenes/OverviewCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java similarity index 90% rename from client/src/main/java/client/scenes/OverviewCtrl.java rename to client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index fb57a44..2b4d7ca 100644 --- a/client/src/main/java/client/scenes/OverviewCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -12,7 +12,7 @@ import javafx.scene.control.Label; import javafx.scene.control.ListCell; import javafx.scene.control.ListView; -public class OverviewCtrl { +public class FoodpalApplicationCtrl { private final MainCtrl mainCtrl; // all of these aren't used with only my part of the code @@ -68,7 +68,7 @@ public class OverviewCtrl { private Button addPreparationStepButton; @Inject - public OverviewCtrl(MainCtrl mainCtrl) { + public FoodpalApplicationCtrl(MainCtrl mainCtrl) { this.mainCtrl = mainCtrl; } @@ -106,7 +106,7 @@ public class OverviewCtrl { // Button handlers @FXML - private void refresh() { + public void refresh() { // TODO: someone else doing this List recipes = showRecipeDetails(); recipeList.getItems().setAll(recipes); @@ -185,6 +185,25 @@ public class OverviewCtrl { System.out.println("Switch language to PL"); } + @FXML + private void closeWindow() { + System.out.println("Close window"); + } + + @FXML + private void maximizeWindow() { + System.out.println("Maximize window"); + } + + @FXML + private void minimizeWindow() { + System.out.println("Minimize window"); + } + + @FXML + private void MakePrintable() { + System.out.println("Recipe printed"); + } } diff --git a/client/src/main/java/client/scenes/MainCtrl.java b/client/src/main/java/client/scenes/MainCtrl.java index f231fb6..160104c 100644 --- a/client/src/main/java/client/scenes/MainCtrl.java +++ b/client/src/main/java/client/scenes/MainCtrl.java @@ -30,16 +30,26 @@ public class MainCtrl { private AddQuoteCtrl addCtrl; private Scene add; - public void initialize(Stage primaryStage, Pair overview, - Pair add) { + private FoodpalApplicationCtrl foodpalCtrl; + private Scene foodpal; + + public void initialize(Stage primaryStage, + Pair overview, + Pair add, + Pair foodpal){ + this.primaryStage = primaryStage; + this.overviewCtrl = overview.getKey(); this.overview = new Scene(overview.getValue()); this.addCtrl = add.getKey(); this.add = new Scene(add.getValue()); - showOverview(); + this.foodpalCtrl = foodpal.getKey(); + this.foodpal = new Scene(foodpal.getValue()); + + showFoodpal(); primaryStage.show(); } @@ -54,4 +64,10 @@ public class MainCtrl { primaryStage.setScene(add); add.setOnKeyPressed(e -> addCtrl.keyPressed(e)); } + + public void showFoodpal(){ + primaryStage.setTitle("FoodPal"); + primaryStage.setScene(foodpal); + foodpalCtrl.refresh(); + } } \ No newline at end of file diff --git a/client/src/main/resources/FoodpalApplication.fxml b/client/src/main/resources/client/scenes/FoodpalApplication.fxml similarity index 87% rename from client/src/main/resources/FoodpalApplication.fxml rename to client/src/main/resources/client/scenes/FoodpalApplication.fxml index 087ab34..dd126a6 100644 --- a/client/src/main/resources/FoodpalApplication.fxml +++ b/client/src/main/resources/client/scenes/FoodpalApplication.fxml @@ -15,7 +15,7 @@ - + @@ -44,7 +44,7 @@ -