From d9ccd2175ccc7161a08361d6b755ccdc8840747d Mon Sep 17 00:00:00 2001 From: tharshita <> Date: Wed, 1 Apr 2020 21:42:13 +0800 Subject: [PATCH 1/2] added goals and achievement tabs with recipe stubs --- data/addressbook.json | 2 +- data/cookedRecords.json | 2 +- data/plannedbook.json | 18 ++++++++- .../java/seedu/recipe/ui/MainTabPanel.java | 22 ++++++++++- src/main/java/seedu/recipe/ui/MainWindow.java | 38 ++++++++++++++++++- src/main/java/seedu/recipe/ui/tab/Tab.java | 4 +- src/main/resources/view/MainTabPanel.fxml | 22 +++++++++++ 7 files changed, 100 insertions(+), 8 deletions(-) diff --git a/data/addressbook.json b/data/addressbook.json index 6d714234101..0356a130272 100644 --- a/data/addressbook.json +++ b/data/addressbook.json @@ -143,4 +143,4 @@ "steps" : [ "Boil chicken", "While chicken is cooking, add sesame oil and crushed ginger into rice and cook it", "When chicken is done, dip it into iced water", "Serve while rice is hot" ], "goals" : [ "Bulk like the Hulk" ] } ] -} +} \ No newline at end of file diff --git a/data/cookedRecords.json b/data/cookedRecords.json index 0b423595f94..9f72c66ac74 100644 --- a/data/cookedRecords.json +++ b/data/cookedRecords.json @@ -24,4 +24,4 @@ }, { "name" : "Asian BBQ Chicken" } ] -} +} \ No newline at end of file diff --git a/data/plannedbook.json b/data/plannedbook.json index ed5efeafb84..5ba166216f2 100644 --- a/data/plannedbook.json +++ b/data/plannedbook.json @@ -1,3 +1,17 @@ { - "plannedRecipes" : [ ] -} + "plannedRecipes" : [ { + "recipes" : [ { + "name" : "Asian BBQ Chicken 2", + "time" : "15", + "isFavourite" : false, + "grains" : [ ], + "vegetables" : [ "1.0tbsp, garlic & ginger (finely chopped)" ], + "proteins" : [ "100.0g, chicken breast" ], + "fruits" : [ ], + "others" : [ "2.0tbsp, char siew sauce", "1.0tsp, honey", "1.0tsp, rice vinegar", "1.0tsp, Salt & pepper", "0.5tsp, sesame oil", "50.0g, sugarspiceeverythingnice" ], + "steps" : [ "In a bowl, mix all the ingredients to create marinade. Mix the chicken with the marinade.", "Pan sear the chicken from both sides.", "edited step 3", "hi" ], + "goals" : [ "Bulk like the Hulk" ] + } ], + "date" : "2020-05-19" + } ] +} \ No newline at end of file diff --git a/src/main/java/seedu/recipe/ui/MainTabPanel.java b/src/main/java/seedu/recipe/ui/MainTabPanel.java index 1e7eb17dadb..fcf0d387dbe 100644 --- a/src/main/java/seedu/recipe/ui/MainTabPanel.java +++ b/src/main/java/seedu/recipe/ui/MainTabPanel.java @@ -22,17 +22,29 @@ public class MainTabPanel extends UiPart { @FXML private StackPane planningListPanelPlaceholder; + @FXML + private StackPane goalsListPanelPlaceholder; + + @FXML + private StackPane achievementsListPanelPlaceholder; + @FXML private TabPane mainTabPanel; - public MainTabPanel(RecipeListPanel recipeListPanel, PlanningListPanel planningListPanel) { + //TODO: change last argument's RecipeListPanel to AchievementsListPanel once class is created + public MainTabPanel(RecipeListPanel recipeListPanel, PlanningListPanel planningListPanel, + RecipeListPanel goalsListPanel, RecipeListPanel achievementsListPanel) { super(FXML); recipeListPanelPlaceholder.getChildren().add(recipeListPanel.getRoot()); planningListPanelPlaceholder.getChildren().add(planningListPanel.getRoot()); + goalsListPanelPlaceholder.getChildren().add(goalsListPanel.getRoot()); + + achievementsListPanelPlaceholder.getChildren().add(achievementsListPanel.getRoot()); + } protected void switchToRecipesTab() { @@ -42,4 +54,12 @@ protected void switchToRecipesTab() { protected void switchToPlanningTab() { this.mainTabPanel.getSelectionModel().select(1); } + + protected void switchToGoalsTab() { + this.mainTabPanel.getSelectionModel().select(2); + } + + protected void switchToAchievementsTab() { + this.mainTabPanel.getSelectionModel().select(3); + } } diff --git a/src/main/java/seedu/recipe/ui/MainWindow.java b/src/main/java/seedu/recipe/ui/MainWindow.java index f76ac3074c0..c8a49a090f1 100644 --- a/src/main/java/seedu/recipe/ui/MainWindow.java +++ b/src/main/java/seedu/recipe/ui/MainWindow.java @@ -38,6 +38,8 @@ public class MainWindow extends UiPart { private MainTabPanel mainTabPanel; private PlanningListPanel planningListPanel; private RecipeListPanel recipeListPanel; + private RecipeListPanel goalsListPanel; + private RecipeListPanel achievementsListPanel; private ResultDisplay resultDisplay; private HelpWindow helpWindow; @@ -56,6 +58,12 @@ public class MainWindow extends UiPart { @FXML private StackPane recipeListPanelPlaceholder; + @FXML + private StackPane goalsListPanelPlaceholder; + + @FXML + private StackPane achievementsListPanelPlaceholder; + @FXML private StackPane resultDisplayPlaceholder; @@ -123,11 +131,17 @@ void fillInnerParts() { ObservableList recipeList = logic.getFilteredRecipeList(); recipeListPanel = new RecipeListPanel(recipeList); - //using recipe list as stub for planning list, to be editted later todo ObservableList plannedList = logic.getFilteredPlannedList(); planningListPanel = new PlanningListPanel(plannedList); - mainTabPanel = new MainTabPanel(recipeListPanel, planningListPanel); + //using recipe list as stub for goalslist and achievements, to be edited later todo + ObservableList goalsList = logic.getFilteredRecipeList(); + goalsListPanel = new RecipeListPanel(goalsList); + + ObservableList achievementsList = logic.getFilteredRecipeList(); + achievementsListPanel = new RecipeListPanel(achievementsList); + + mainTabPanel = new MainTabPanel(recipeListPanel, planningListPanel, goalsListPanel, achievementsListPanel); mainTabPanelPlaceholder.getChildren().add(mainTabPanel.getRoot()); resultDisplay = new ResultDisplay(); @@ -196,6 +210,12 @@ private void handleSwitchTab(Tab tab) { case PLANNING: showPlanningTab(); break; + case GOALS: + showGoalsTab(); + break; + case ACHIEVEMENT: + showAchievementsTab(); + break; default: break; } @@ -246,4 +266,18 @@ private void showRecipesTab() { private void showPlanningTab() { mainTabPanel.switchToPlanningTab(); } + + /** + * Switch to goals tab. + */ + private void showGoalsTab() { + mainTabPanel.switchToGoalsTab(); + } + + /** + * Switch to achievements tab. + */ + private void showAchievementsTab() { + mainTabPanel.switchToAchievementsTab(); + } } diff --git a/src/main/java/seedu/recipe/ui/tab/Tab.java b/src/main/java/seedu/recipe/ui/tab/Tab.java index e33ce961832..127eb2e4715 100644 --- a/src/main/java/seedu/recipe/ui/tab/Tab.java +++ b/src/main/java/seedu/recipe/ui/tab/Tab.java @@ -5,5 +5,7 @@ */ public enum Tab { RECIPES, - PLANNING + PLANNING, + GOALS, + ACHIEVEMENT } diff --git a/src/main/resources/view/MainTabPanel.fxml b/src/main/resources/view/MainTabPanel.fxml index 774d4a41f71..7509c853393 100644 --- a/src/main/resources/view/MainTabPanel.fxml +++ b/src/main/resources/view/MainTabPanel.fxml @@ -31,6 +31,28 @@ + + + + + + + + + + + + + + + + + + + + From 30bcde6a8381a567542d7a9f365103860fb3a396 Mon Sep 17 00:00:00 2001 From: tharshita <> Date: Wed, 1 Apr 2020 21:55:58 +0800 Subject: [PATCH 2/2] fixed EOF errors --- data/addressbook.json | 2 +- data/cookedRecords.json | 2 +- data/plannedbook.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/addressbook.json b/data/addressbook.json index 0356a130272..6d714234101 100644 --- a/data/addressbook.json +++ b/data/addressbook.json @@ -143,4 +143,4 @@ "steps" : [ "Boil chicken", "While chicken is cooking, add sesame oil and crushed ginger into rice and cook it", "When chicken is done, dip it into iced water", "Serve while rice is hot" ], "goals" : [ "Bulk like the Hulk" ] } ] -} \ No newline at end of file +} diff --git a/data/cookedRecords.json b/data/cookedRecords.json index 9f72c66ac74..0b423595f94 100644 --- a/data/cookedRecords.json +++ b/data/cookedRecords.json @@ -24,4 +24,4 @@ }, { "name" : "Asian BBQ Chicken" } ] -} \ No newline at end of file +} diff --git a/data/plannedbook.json b/data/plannedbook.json index 5ba166216f2..0594b95f5f9 100644 --- a/data/plannedbook.json +++ b/data/plannedbook.json @@ -14,4 +14,4 @@ } ], "date" : "2020-05-19" } ] -} \ No newline at end of file +}