diff --git a/client/src/main/java/client/scenes/OverviewCtrl.java b/client/src/main/java/client/scenes/OverviewCtrl.java index 6a71d19..fb57a44 100644 --- a/client/src/main/java/client/scenes/OverviewCtrl.java +++ b/client/src/main/java/client/scenes/OverviewCtrl.java @@ -3,7 +3,8 @@ package client.scenes; import java.util.List; -//import commons.Recipe; or something +import commons.Recipe; + import jakarta.inject.Inject; import javafx.fxml.FXML; import javafx.scene.control.Button; @@ -12,30 +13,30 @@ import javafx.scene.control.ListCell; import javafx.scene.control.ListView; public class OverviewCtrl { - private final MainCtrl mainCtrl; + // all of these aren't used with only my part of the code // everything in the top bar === @FXML - private Button flagEnButton; + private Button flagEnButton; //already here for advanced stuff @FXML - private Button flagNlButton; + private Button flagNlButton; //already here for advanced stuff @FXML - private Button flagPlButton; + private Button flagPlButton; //already here for advanced stuff @FXML private Button refreshButton; @FXML - private Button closeButton; + private Button closeButton; //already here for advanced stuff @FXML - private Button maximizeButton; + private Button maximizeButton; //already here for advanced stuff @FXML - private Button minimizeButton; + private Button minimizeButton; //already here for advanced stuff // everything in the left lane @FXML @@ -78,7 +79,7 @@ public class OverviewCtrl { @Override protected void updateItem(Recipe item, boolean empty) { super.updateItem(item, empty); - setText(empty || item == null ? "" : item.name); + setText(empty || item == null ? "" : item.getName()); } }); @@ -89,7 +90,8 @@ public class OverviewCtrl { // Double-click to go to detail screen recipeList.setOnMouseClicked(event -> { - if (event.getClickCount() == 2) { + final int DOUBLE_CLICK = 2; //to not get magic number:P + if (event.getClickCount() == DOUBLE_CLICK) { openSelectedRecipe(); } }); @@ -97,12 +99,16 @@ public class OverviewCtrl { refresh(); } - // ================== BUTTON HANDLERS ================== + // till the all the code from everyone is implemented for now to not have errors + private void showRecipeDetails(Recipe newRecipe) { + } + + // Button handlers @FXML private void refresh() { // TODO: someone else doing this - List recipes = getMockRecipes(); + List recipes = showRecipeDetails(); recipeList.getItems().setAll(recipes); // Select first recipe in the list by default @@ -111,14 +117,19 @@ public class OverviewCtrl { } } - @FXML - private void addRecipe() { - // Navigate to "create recipe" screen (should be like a pop-up or new screen or just another place in the app) - mainCtrl.showCreateRecipe(); + // to remove error till everything else is implemented + private List showRecipeDetails() { + return List.of(); } @FXML - private void removeSelectedRecipe() { + private void addRecipe() { + // Navigate to "create recipe" screen (should be like a pop-up or new screen or just another place in the app) + mainCtrl.showOverview(); + } + + @FXML + private void removeSelectedRecipe() { Recipe selected = recipeList.getSelectionModel().getSelectedItem(); if (selected == null) { return; @@ -136,7 +147,7 @@ public class OverviewCtrl { return; } // Let MainCtrl open the full detail screen - mainCtrl.showRecipeDetail(selected.id); + mainCtrl.showOverview(); //I had showrecipedetail but intelij says showoverview } @FXML @@ -174,21 +185,6 @@ public class OverviewCtrl { System.out.println("Switch language to PL"); } - // Window control buttons (are we keeping this?) - @FXML - private void closeWindow() { - mainCtrl.closeApplication(); - } - - @FXML - private void maximizeWindow() { - mainCtrl.toggleMaximize(); - } - - @FXML - private void minimizeWindow() { - mainCtrl.minimize(); - } } diff --git a/client/src/main/resources/FoodpalApplication.fxml b/client/src/main/resources/FoodpalApplication.fxml index 9743e7e..087ab34 100644 --- a/client/src/main/resources/FoodpalApplication.fxml +++ b/client/src/main/resources/FoodpalApplication.fxml @@ -15,7 +15,7 @@ - +