Implemented UI+OverviewCtrl

This commit is contained in:
Aysegul Aydinlik 2025-11-27 16:19:54 +01:00
commit 2916dd476e
3 changed files with 30 additions and 80 deletions

View file

@ -3,7 +3,8 @@ package client.scenes;
import java.util.List; import java.util.List;
//import commons.Recipe; or something import commons.Recipe;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
@ -12,30 +13,30 @@ import javafx.scene.control.ListCell;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
public class OverviewCtrl { public class OverviewCtrl {
private final MainCtrl mainCtrl; private final MainCtrl mainCtrl;
// all of these aren't used with only my part of the code
// everything in the top bar === // everything in the top bar ===
@FXML @FXML
private Button flagEnButton; private Button flagEnButton; //already here for advanced stuff
@FXML @FXML
private Button flagNlButton; private Button flagNlButton; //already here for advanced stuff
@FXML @FXML
private Button flagPlButton; private Button flagPlButton; //already here for advanced stuff
@FXML @FXML
private Button refreshButton; private Button refreshButton;
@FXML @FXML
private Button closeButton; private Button closeButton; //already here for advanced stuff
@FXML @FXML
private Button maximizeButton; private Button maximizeButton; //already here for advanced stuff
@FXML @FXML
private Button minimizeButton; private Button minimizeButton; //already here for advanced stuff
// everything in the left lane // everything in the left lane
@FXML @FXML
@ -78,7 +79,7 @@ public class OverviewCtrl {
@Override @Override
protected void updateItem(Recipe item, boolean empty) { protected void updateItem(Recipe item, boolean empty) {
super.updateItem(item, 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 // Double-click to go to detail screen
recipeList.setOnMouseClicked(event -> { recipeList.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) { final int DOUBLE_CLICK = 2; //to not get magic number:P
if (event.getClickCount() == DOUBLE_CLICK) {
openSelectedRecipe(); openSelectedRecipe();
} }
}); });
@ -97,12 +99,16 @@ public class OverviewCtrl {
refresh(); 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 @FXML
private void refresh() { private void refresh() {
// TODO: someone else doing this // TODO: someone else doing this
List<Recipe> recipes = getMockRecipes(); List<Recipe> recipes = showRecipeDetails();
recipeList.getItems().setAll(recipes); recipeList.getItems().setAll(recipes);
// Select first recipe in the list by default // Select first recipe in the list by default
@ -111,10 +117,15 @@ public class OverviewCtrl {
} }
} }
// to remove error till everything else is implemented
private List<Recipe> showRecipeDetails() {
return List.of();
}
@FXML @FXML
private void addRecipe() { private void addRecipe() {
// Navigate to "create recipe" screen (should be like a pop-up or new screen or just another place in the app) // Navigate to "create recipe" screen (should be like a pop-up or new screen or just another place in the app)
mainCtrl.showCreateRecipe(); mainCtrl.showOverview();
} }
@FXML @FXML
@ -136,7 +147,7 @@ public class OverviewCtrl {
return; return;
} }
// Let MainCtrl open the full detail screen // Let MainCtrl open the full detail screen
mainCtrl.showRecipeDetail(selected.id); mainCtrl.showOverview(); //I had showrecipedetail but intelij says showoverview
} }
@FXML @FXML
@ -174,21 +185,6 @@ public class OverviewCtrl {
System.out.println("Switch language to PL"); 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();
}
} }

View file

@ -15,7 +15,7 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<BorderPane prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.OverviewCtrl"> <BorderPane prefHeight="800.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/25" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.scenes.OverviewCtrl">
<!-- TOP BAR --> <!-- TOP BAR -->
<top> <top>

View file

@ -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