From c7b651e2664d511fd11813932afe1a7ec090e3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Rasie=C5=84ski?= Date: Thu, 4 Dec 2025 02:14:48 +0100 Subject: [PATCH] fixed errors with detailed view on deletions and edits --- .../client/scenes/FoodpalApplicationCtrl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index 92492ab..1a4bea4 100644 --- a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -137,14 +137,20 @@ public class FoodpalApplicationCtrl implements LocaleAware { } // till the all the code from everyone is implemented for now to not have errors - private void showRecipeDetails(Recipe newRecipe) { - recipeNameLabel.setText(newRecipe.getName()); - ingredientsListView.getItems().setAll(newRecipe.getIngredients()); - preparationListView.getItems().setAll(newRecipe.getPreparationSteps()); + private void showRecipeDetails(Recipe recipe) { + if (recipe == null) { + recipeNameLabel.setText(""); + ingredientsListView.getItems().clear(); + preparationListView.getItems().clear(); + return; + } + + recipeNameLabel.setText(recipe.getName()); + ingredientsListView.getItems().setAll(recipe.getIngredients()); + preparationListView.getItems().setAll(recipe.getPreparationSteps()); } // Button handlers - @FXML public void refresh() { // TODO: someone else doing this @@ -165,7 +171,6 @@ public class FoodpalApplicationCtrl implements LocaleAware { } } - /** * Adds a recipe, by going to a different scene, there you insert the title and bam recipe created */