From 2916dd476ee0686daecc00cdc7e2ff2be5b3b95b Mon Sep 17 00:00:00 2001 From: Aysegul Aydinlik Date: Thu, 27 Nov 2025 16:19:54 +0100 Subject: [PATCH] Implemented UI+OverviewCtrl --- .../main/java/client/scenes/OverviewCtrl.java | 62 +++++++++---------- .../main/resources/FoodpalApplication.fxml | 2 +- code-of-conduct.md | 46 -------------- 3 files changed, 30 insertions(+), 80 deletions(-) delete mode 100644 code-of-conduct.md 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 @@ - + diff --git a/code-of-conduct.md b/code-of-conduct.md deleted file mode 100644 index f2fc9a4..0000000 --- a/code-of-conduct.md +++ /dev/null @@ -1,46 +0,0 @@ -# Code of Conduct CSEP -> Last changed: 2025-11-14 04:20 PM -## Assignment description -- working on our teamwork skills -- coding with other people -- communication skill in a group setting - -## Target or ambition level -- so we working towards a 10 but a 8 is fine -- the most important thing is that everyone does their best - -## Planning -- friday - before the ta meeting checking eachother codes and making a planning for the week after -- label the to do lists in gitlab on friday (during planning time) -- check up on eachother thoughout the week -- **Submitter** - Rithvik - -## Communication -- Discord for our online meeting and sharing info and asking questions -- GitLab to share our code -- Friday lab meetings for in person meetings - -### Collaboration outside of the mandatory meetings -- Friday during lab before ta meeting -- Discord -- GitLab - -## Help and assistance -- We have discord together, so if there is a question or issue it can be asked there and also during the friday meeting - -## Work quality -- By having the other 5 members rate the code on gitlab -- Making sure we use the same checkstyle document - -## Decision-making -- Discuss it with arguments so consensus - -## Broken agreements -- Discuss it with them -- If they dont do anything (work, meetings) at all discuss with the ta - -## Problem resolution -- We are all adults here so we can just talk it out by civil discussion -- If your gonna be late, communicate with the rest of the team -- Give a reason if you can't show up for a meeting -- Contact with the TA will be needed when someone doesn't react to any of our messages and doesnt show up at all