Merge branch 'workingButtons' into 'main'

Making working buttons

Closes #3

See merge request cse1105/2025-2026/teams/csep-team-76!10
This commit is contained in:
Natalia Cholewa 2025-12-03 21:09:04 +01:00
commit fc13f7b847
14 changed files with 444 additions and 192 deletions

View file

@ -17,14 +17,13 @@ package client;
import static com.google.inject.Guice.createInjector; import static com.google.inject.Guice.createInjector;
import java.io.IOException; import client.scenes.AddStepsCtrl;
import java.net.URISyntaxException; import client.scenes.MainCtrl;
import client.scenes.AddIngredientCtrl;
import client.scenes.AddNameCtrl;
import client.scenes.FoodpalApplicationCtrl;
import com.google.inject.Injector; import com.google.inject.Injector;
import client.scenes.AddQuoteCtrl;
import client.scenes.MainCtrl;
import client.scenes.QuoteOverviewCtrl;
import client.utils.ServerUtilsExample; import client.utils.ServerUtilsExample;
import javafx.application.Application; import javafx.application.Application;
import javafx.stage.Stage; import javafx.stage.Stage;
@ -34,7 +33,7 @@ public class Main extends Application {
private static final Injector INJECTOR = createInjector(new MyModule()); private static final Injector INJECTOR = createInjector(new MyModule());
private static final MyFXML FXML = new MyFXML(INJECTOR); private static final MyFXML FXML = new MyFXML(INJECTOR);
public static void main(String[] args) throws URISyntaxException, IOException { public static void main(String[] args){
launch(); launch();
} }
@ -48,10 +47,12 @@ public class Main extends Application {
return; return;
} }
var overview = FXML.load(QuoteOverviewCtrl.class, "client", "scenes", "QuoteOverview.fxml"); var addName = FXML.load(AddNameCtrl.class, "client", "scenes", "AddName.fxml");
var add = FXML.load(AddQuoteCtrl.class, "client", "scenes", "AddQuote.fxml"); var foodpal = FXML.load(FoodpalApplicationCtrl.class, "client", "scenes", "FoodpalApplication.fxml");
var addIngredient = FXML.load(AddIngredientCtrl.class, "client", "scenes", "AddIngredient.fxml");
var addStep = FXML.load(AddStepsCtrl.class, "client", "scenes", "AddSteps.fxml");
var mainCtrl = INJECTOR.getInstance(MainCtrl.class); var mainCtrl = INJECTOR.getInstance(MainCtrl.class);
mainCtrl.initialize(primaryStage, overview, add); mainCtrl.initialize(primaryStage, addName, foodpal, addIngredient, addStep);
} }
} }

View file

@ -15,20 +15,20 @@
*/ */
package client; package client;
import client.scenes.FoodpalApplicationCtrl;
import com.google.inject.Binder; import com.google.inject.Binder;
import com.google.inject.Module; import com.google.inject.Module;
import com.google.inject.Scopes; import com.google.inject.Scopes;
import client.scenes.AddQuoteCtrl; import client.scenes.AddNameCtrl;
import client.scenes.MainCtrl; import client.scenes.MainCtrl;
import client.scenes.QuoteOverviewCtrl;
public class MyModule implements Module { public class MyModule implements Module {
@Override @Override
public void configure(Binder binder) { public void configure(Binder binder) {
binder.bind(MainCtrl.class).in(Scopes.SINGLETON); binder.bind(MainCtrl.class).in(Scopes.SINGLETON);
binder.bind(AddQuoteCtrl.class).in(Scopes.SINGLETON); binder.bind(AddNameCtrl.class).in(Scopes.SINGLETON);
binder.bind(QuoteOverviewCtrl.class).in(Scopes.SINGLETON); binder.bind(FoodpalApplicationCtrl.class).in(Scopes.SINGLETON);
} }
} }

View file

@ -0,0 +1,86 @@
/*
* Copyright 2021 Delft University of Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client.scenes;
import client.utils.ServerUtils;
import com.google.inject.Inject;
import commons.Recipe;
import jakarta.ws.rs.WebApplicationException;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.stage.Modality;
import java.io.IOException;
public class AddIngredientCtrl {
private final ServerUtils server;
private final MainCtrl mainCtrl;
private final FoodpalApplicationCtrl foodpalCtrl;
@FXML
public TextField ingredient;
@Inject
public AddIngredientCtrl(ServerUtils server, MainCtrl mainCtrl, FoodpalApplicationCtrl foodpalCtrl) {
this.mainCtrl = mainCtrl;
this.server = server;
this.foodpalCtrl = foodpalCtrl;
}
public void cancel() throws IOException, InterruptedException {
clearFields();
mainCtrl.showFoodpal();
}
public void ok() throws IOException, InterruptedException {
try {
Recipe selected = foodpalCtrl.getSelectedRecipe();
server.addRecipeIngredient(selected, ingredient.getText());
} catch (WebApplicationException e) {
var alert = new Alert(Alert.AlertType.ERROR);
alert.initModality(Modality.APPLICATION_MODAL);
alert.setContentText(e.getMessage());
alert.showAndWait();
return;
}
clearFields();
mainCtrl.showFoodpal();
}
private void clearFields() {
ingredient.clear();
}
public void keyPressed(KeyEvent e) throws IOException, InterruptedException {
switch (e.getCode()) {
case ENTER:
ok();
break;
case ESCAPE:
cancel();
break;
default:
break;
}
}
}

View file

@ -0,0 +1,81 @@
/*
* Copyright 2021 Delft University of Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client.scenes;
import client.utils.ServerUtils;
import com.google.inject.Inject;
import jakarta.ws.rs.WebApplicationException;
import javafx.scene.control.Alert;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent;
import javafx.stage.Modality;
import java.io.IOException;
public class AddNameCtrl {
private final ServerUtils server;
private final MainCtrl mainCtrl;
public TextField recipeName;
@Inject
public AddNameCtrl(ServerUtils server, MainCtrl mainCtrl) {
this.mainCtrl = mainCtrl;
this.server = server;
}
public void cancel() throws IOException, InterruptedException {
clearFields();
mainCtrl.showFoodpal();
}
public void ok() throws IOException, InterruptedException {
try {
server.addRecipeName(recipeName.getText());
} catch (WebApplicationException e) {
var alert = new Alert(Alert.AlertType.ERROR);
alert.initModality(Modality.APPLICATION_MODAL);
alert.setContentText(e.getMessage());
alert.showAndWait();
return;
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
clearFields();
mainCtrl.showFoodpal();
}
private void clearFields() {
recipeName.clear();
}
public void keyPressed(KeyEvent e) throws IOException, InterruptedException {
switch (e.getCode()) {
case ENTER:
ok();
break;
case ESCAPE:
cancel();
break;
default:
break;
}
}
}

View file

@ -15,11 +15,9 @@
*/ */
package client.scenes; package client.scenes;
import client.utils.ServerUtils;
import com.google.inject.Inject; import com.google.inject.Inject;
import commons.Recipe;
import client.utils.ServerUtilsExample;
import commons.Person;
import commons.Quote;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
@ -27,35 +25,34 @@ import javafx.scene.control.TextField;
import javafx.scene.input.KeyEvent; import javafx.scene.input.KeyEvent;
import javafx.stage.Modality; import javafx.stage.Modality;
public class AddQuoteCtrl { import java.io.IOException;
private final ServerUtilsExample server; public class AddStepsCtrl {
private final ServerUtils server;
private final MainCtrl mainCtrl; private final MainCtrl mainCtrl;
private final FoodpalApplicationCtrl foodpalCtrl;
@FXML @FXML
private TextField firstName; public TextField preparationStep;
@FXML
private TextField lastName;
@FXML
private TextField quote;
@Inject @Inject
public AddQuoteCtrl(ServerUtilsExample server, MainCtrl mainCtrl) { public AddStepsCtrl(ServerUtils server, MainCtrl mainCtrl, FoodpalApplicationCtrl foodpalCtrl) {
this.mainCtrl = mainCtrl; this.mainCtrl = mainCtrl;
this.server = server; this.server = server;
this.foodpalCtrl = foodpalCtrl;
} }
public void cancel() { public void cancel() throws IOException, InterruptedException {
clearFields(); clearFields();
mainCtrl.showOverview(); mainCtrl.showFoodpal();
} }
public void ok() { public void ok() throws IOException, InterruptedException {
try { try {
server.addQuote(getQuote()); Recipe selected = foodpalCtrl.getSelectedRecipe();
server.addRecipeStep(selected, preparationStep.getText());
} catch (WebApplicationException e) { } catch (WebApplicationException e) {
var alert = new Alert(Alert.AlertType.ERROR); var alert = new Alert(Alert.AlertType.ERROR);
@ -65,23 +62,16 @@ public class AddQuoteCtrl {
return; return;
} }
clearFields();
mainCtrl.showOverview();
}
private Quote getQuote() { clearFields();
var p = new Person(firstName.getText(), lastName.getText()); mainCtrl.showFoodpal();
var q = quote.getText();
return new Quote(p, q);
} }
private void clearFields() { private void clearFields() {
firstName.clear(); preparationStep.clear();
lastName.clear();
quote.clear();
} }
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) throws IOException, InterruptedException {
switch (e.getCode()) { switch (e.getCode()) {
case ENTER: case ENTER:
ok(); ok();

View file

@ -1,8 +1,10 @@
package client.scenes; package client.scenes;
import java.io.IOException;
import java.util.List; import java.util.List;
import client.utils.ServerUtils;
import commons.Recipe; import commons.Recipe;
import jakarta.inject.Inject; import jakarta.inject.Inject;
@ -12,8 +14,10 @@ import javafx.scene.control.Label;
import javafx.scene.control.ListCell; import javafx.scene.control.ListCell;
import javafx.scene.control.ListView; import javafx.scene.control.ListView;
public class OverviewCtrl { public class FoodpalApplicationCtrl {
private final MainCtrl mainCtrl; private final MainCtrl mainCtrl;
private final ServerUtils server;
// all of these aren't used with only my part of the code // all of these aren't used with only my part of the code
// everything in the top bar === // everything in the top bar ===
@ -68,12 +72,13 @@ public class OverviewCtrl {
private Button addPreparationStepButton; private Button addPreparationStepButton;
@Inject @Inject
public OverviewCtrl(MainCtrl mainCtrl) { public FoodpalApplicationCtrl(MainCtrl mainCtrl, ServerUtils server) {
this.mainCtrl = mainCtrl; this.mainCtrl = mainCtrl;
this.server = server;
} }
@FXML @FXML
private void initialize() { private void initialize() throws IOException, InterruptedException {
// Show recipe name in the list // Show recipe name in the list
recipeList.setCellFactory(list -> new ListCell<>() { recipeList.setCellFactory(list -> new ListCell<>() {
@Override @Override
@ -101,14 +106,18 @@ public class OverviewCtrl {
// till the all the code from everyone is implemented for now to not have errors // till the all the code from everyone is implemented for now to not have errors
private void showRecipeDetails(Recipe newRecipe) { private void showRecipeDetails(Recipe newRecipe) {
recipeNameLabel.setText(newRecipe.getName());
ingredientsListView.getItems().setAll(newRecipe.getIngredients());
preparationListView.getItems().setAll(newRecipe.getPreparationSteps());
} }
// Button handlers // Button handlers
@FXML @FXML
private void refresh() { public void refresh() throws IOException, InterruptedException {
// TODO: someone else doing this // TODO: someone else doing this
List<Recipe> recipes = showRecipeDetails(); List<Recipe> recipes = server.getRecipes();
recipeList.getItems().setAll(recipes); recipeList.getItems().setAll(recipes);
// Select first recipe in the list by default // Select first recipe in the list by default
@ -117,27 +126,26 @@ public class OverviewCtrl {
} }
} }
// to remove error till everything else is implemented
private List<Recipe> showRecipeDetails() {
return List.of();
}
/**
* Adds a recipe, by going to a different scene, there you insert the title and bam recipe created
*/
@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.showOverview(); mainCtrl.showAddName();
} }
@FXML @FXML
private void removeSelectedRecipe() { private void removeSelectedRecipe() throws IOException, InterruptedException {
Recipe selected = recipeList.getSelectionModel().getSelectedItem(); Recipe selected = recipeList.getSelectionModel().getSelectedItem();
if (selected == null) { if (selected == null) {
return; return;
} }
// TODO: someone else todo server.deleteRecipe(selected.getId());
recipeList.getItems().remove(selected); recipeList.getItems().remove(selected);
showRecipeDetails(null);
} }
@FXML @FXML
@ -147,7 +155,7 @@ public class OverviewCtrl {
return; return;
} }
// Let MainCtrl open the full detail screen // Let MainCtrl open the full detail screen
mainCtrl.showOverview(); //I had showrecipedetail but intelij says showoverview mainCtrl.showAddName(); //I had showrecipedetail but intelij says showoverview
} }
@FXML @FXML
@ -157,16 +165,27 @@ public class OverviewCtrl {
openSelectedRecipe(); openSelectedRecipe();
} }
/**
* You can add ingredients. you get send to a different scene that creates the ingredient
* It doesn't automatically refresh yet so before you can see the new ingredient you have to first click on a
* different recipe and come back after
*/
@FXML @FXML
private void addIngredient() { private void addIngredient() {
// TODO: make it possible to add ingredient to current recipe
System.out.println("Add ingredient clicked"); System.out.println("Add ingredient clicked");
mainCtrl.showAddIngredient();
} }
/**
* You can add steps. you get send to a different scene that creates the Step
* It doesn't automatically refresh yet so before you can see the new step you have to first click on a
* different recipe and come back after
*/
@FXML @FXML
private void addPreparationStep() { private void addPreparationStep() {
// TODO: make it possible to add step to current recipe
System.out.println("Add preparation step clicked"); System.out.println("Add preparation step clicked");
mainCtrl.showAddSteps();
} }
// Language buttons // Language buttons
@ -185,6 +204,34 @@ public class OverviewCtrl {
System.out.println("Switch language to PL"); System.out.println("Switch language to PL");
} }
//without caused errors
@FXML
private void makePrintable() {
System.out.println("Recipe printed");
}
/**
* Get the recipe that was selected
* @return the selected recipe
*/
public Recipe getSelectedRecipe() {
return recipeList.getSelectionModel().getSelectedItem();
}
/**
* Clones a recipe, when clicking on the button "clone"
*/
public void cloneRecipe() throws IOException, InterruptedException {
Recipe selected = recipeList.getSelectionModel().getSelectedItem();
if (selected == null) {
return;
}
server.cloneRecipe(selected.getId());
refresh();
}
} }

View file

@ -20,38 +20,92 @@ import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import javafx.util.Pair; import javafx.util.Pair;
import java.io.IOException;
public class MainCtrl { public class MainCtrl {
private Stage primaryStage; private Stage primaryStage;
private QuoteOverviewCtrl overviewCtrl; private AddNameCtrl addNameCtrl;
private Scene overview; private Scene addName;
private AddQuoteCtrl addCtrl; private FoodpalApplicationCtrl foodpalCtrl;
private Scene add; private Scene foodpal;
private AddIngredientCtrl addIngredientCtrl;
private Scene addIngredient;
private AddStepsCtrl addStepsCtrl;
private Scene addStep;
public void initialize(Stage primaryStage,
Pair<AddNameCtrl, Parent> addName,
Pair<FoodpalApplicationCtrl, Parent> foodpal,
Pair<AddIngredientCtrl, Parent> addIngredient,
Pair<AddStepsCtrl, Parent> addStep
) throws IOException, InterruptedException {
public void initialize(Stage primaryStage, Pair<QuoteOverviewCtrl, Parent> overview,
Pair<AddQuoteCtrl, Parent> add) {
this.primaryStage = primaryStage; this.primaryStage = primaryStage;
this.overviewCtrl = overview.getKey();
this.overview = new Scene(overview.getValue());
this.addCtrl = add.getKey(); this.addNameCtrl = addName.getKey();
this.add = new Scene(add.getValue()); this.addName = new Scene(addName.getValue());
showOverview(); this.foodpalCtrl = foodpal.getKey();
this.foodpal = new Scene(foodpal.getValue());
this.addIngredientCtrl = addIngredient.getKey();
this.addIngredient = new Scene(addIngredient.getValue());
this.addStepsCtrl = addStep.getKey();
this.addStep = new Scene(addStep.getValue());
showFoodpal();
primaryStage.show(); primaryStage.show();
} }
public void showOverview() {
primaryStage.setTitle("Quotes: Overview"); public void showAddName() {
primaryStage.setScene(overview); primaryStage.setTitle("Naming recipes");
overviewCtrl.refresh(); primaryStage.setScene(addName);
addName.setOnKeyPressed(e -> {
try {
addNameCtrl.keyPressed(e);
} catch (IOException | InterruptedException ex) {
throw new RuntimeException(ex);
}
});
} }
public void showAdd() { public void showFoodpal() throws IOException, InterruptedException {
primaryStage.setTitle("Quotes: Adding Quote"); primaryStage.setTitle("FoodPal");
primaryStage.setScene(add); primaryStage.setScene(foodpal);
add.setOnKeyPressed(e -> addCtrl.keyPressed(e)); foodpalCtrl.refresh();
}
public void showAddIngredient() {
primaryStage.setTitle("To add ingredients");
primaryStage.setScene(addIngredient);
addIngredient.setOnKeyPressed(e -> {
try {
addIngredientCtrl.keyPressed(e);
} catch (IOException | InterruptedException ex) {
throw new RuntimeException(ex);
}
});
}
public void showAddSteps() {
primaryStage.setTitle("To add preparation steps");
primaryStage.setScene(addStep);
addStep.setOnKeyPressed(e -> {
try {
addStepsCtrl.keyPressed(e);
} catch (IOException | InterruptedException ex) {
throw new RuntimeException(ex);
}
});
} }
} }

View file

@ -1,71 +0,0 @@
/*
* Copyright 2021 Delft University of Technology
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package client.scenes;
import java.net.URL;
import java.util.ResourceBundle;
import com.google.inject.Inject;
import client.utils.ServerUtilsExample;
import commons.Quote;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
public class QuoteOverviewCtrl implements Initializable {
private final ServerUtilsExample server;
private final MainCtrl mainCtrl;
private ObservableList<Quote> data;
@FXML
private TableView<Quote> table;
@FXML
private TableColumn<Quote, String> colFirstName;
@FXML
private TableColumn<Quote, String> colLastName;
@FXML
private TableColumn<Quote, String> colQuote;
@Inject
public QuoteOverviewCtrl(ServerUtilsExample server, MainCtrl mainCtrl) {
this.server = server;
this.mainCtrl = mainCtrl;
}
@Override
public void initialize(URL location, ResourceBundle resources) {
colFirstName.setCellValueFactory(q -> new SimpleStringProperty(q.getValue().person.firstName));
colLastName.setCellValueFactory(q -> new SimpleStringProperty(q.getValue().person.lastName));
colQuote.setCellValueFactory(q -> new SimpleStringProperty(q.getValue().quote));
}
public void addQuote() {
mainCtrl.showAdd();
}
public void refresh() {
var quotes = server.getQuotes();
data = FXCollections.observableList(quotes);
table.setItems(data);
}
}

View file

@ -14,6 +14,7 @@ import java.net.URI;
import java.net.http.HttpClient; import java.net.http.HttpClient;
import java.net.http.HttpRequest; import java.net.http.HttpRequest;
import java.net.http.HttpResponse; import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON; import static jakarta.ws.rs.core.MediaType.APPLICATION_JSON;
@ -127,7 +128,7 @@ public class ServerUtils {
//Get the recipe //Get the recipe
HttpRequest request = HttpRequest.newBuilder() HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(SERVER + "/recipe/" + id)) .uri(URI.create(SERVER + "/recipe/" + id))
.GET() .GET() //Needs to be changed to POST() when api is changed
.build(); .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
@ -156,4 +157,44 @@ public class ServerUtils {
} }
return true; return true;
} }
public void addRecipeName(String name) throws IOException, InterruptedException {
Recipe newRecipe = new Recipe();
newRecipe.setName(name);
addRecipe(newRecipe);
}
public void addRecipeIngredient(Recipe recipe, String ingredient) throws IOException, InterruptedException {
List<String> ingredients = new ArrayList<>(recipe.getIngredients());
ingredients.add(ingredient);
recipe.setIngredients(ingredients);
updateRecipe(recipe);
}
public void updateRecipe(Recipe recipe) throws IOException, InterruptedException {
String json = objectMapper.writeValueAsString(recipe);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(SERVER + "/recipe/" + recipe.getId()))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString((json))) // Needs to be changed to PUT() when api changed
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if(response.statusCode() != statusOK){
throw new IOException("Failed to update recipe: " + recipe.toDetailedString() + "body: " + response.body());
}
objectMapper.readValue(response.body(), Recipe.class);
}
public void addRecipeStep(Recipe recipe, String preparationStep) throws IOException, InterruptedException {
List<String> preparationSteps = new ArrayList<>(recipe.getPreparationSteps());
preparationSteps.add(preparationStep);
recipe.setPreparationSteps(preparationSteps);
updateRecipe(recipe);
}
} }

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="94.0" prefWidth="470.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.scenes.AddIngredientCtrl">
<children>
<Button layoutX="417.0" layoutY="54.0" mnemonicParsing="false" onAction="#ok" text="Ok" />
<Button layoutX="349.0" layoutY="54.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<TextField fx:id="ingredient" layoutX="120.0" layoutY="24.0" prefHeight="18.0" prefWidth="292.0" />
<Label layoutX="28.0" layoutY="29.0" text="Ingredient Name" />
</children>
</AnchorPane>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="94.0" prefWidth="470.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.scenes.AddNameCtrl">
<children>
<Button layoutX="417.0" layoutY="54.0" mnemonicParsing="false" onAction="#ok" text="Ok" />
<Button layoutX="349.0" layoutY="54.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<TextField fx:id="recipeName" layoutX="109.0" layoutY="24.0" prefHeight="18.0" prefWidth="292.0" />
<Label layoutX="28.0" layoutY="29.0" text="Recipe Name" />
</children>
</AnchorPane>

View file

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="146.0" prefWidth="470.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.scenes.AddQuoteCtrl">
<children>
<Button layoutX="419.0" layoutY="105.0" mnemonicParsing="false" onAction="#ok" text="Ok" />
<Button layoutX="350.0" layoutY="105.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<TextField fx:id="firstName" layoutX="109.0" layoutY="24.0" prefHeight="26.0" prefWidth="79.0" />
<TextField fx:id="lastName" layoutX="286.0" layoutY="24.0" />
<TextField fx:id="quote" layoutX="109.0" layoutY="61.0" prefHeight="26.0" prefWidth="345.0" />
<Label layoutX="216.0" layoutY="29.0" text="Last Name" />
<Label layoutX="28.0" layoutY="29.0" text="First Name" />
<Label layoutX="28.0" layoutY="66.0" text="Quote" />
</children>
</AnchorPane>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="94.0" prefWidth="470.0" xmlns="http://javafx.com/javafx/23.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="client.scenes.AddStepsCtrl">
<children>
<Button layoutX="417.0" layoutY="54.0" mnemonicParsing="false" onAction="#ok" text="Ok" />
<Button layoutX="349.0" layoutY="54.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<TextField fx:id="preparationStep" layoutX="120.0" layoutY="24.0" prefHeight="18.0" prefWidth="292.0" />
<Label layoutX="28.0" layoutY="29.0" text="Preparation step" />
</children>
</AnchorPane>

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.scenes.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.FoodpalApplicationCtrl">
<!-- TOP BAR --> <!-- TOP BAR -->
<top> <top>
@ -44,7 +44,7 @@
<buttons> <buttons>
<ToolBar prefHeight="35.0" prefWidth="123.0"> <ToolBar prefHeight="35.0" prefWidth="123.0">
<items> <items>
<Button fx:id="flagEnButton" minWidth="33.0" onAction="#switchToEngelish" prefHeight="25.0" prefWidth="33.0" text="EN" /> <Button fx:id="flagEnButton" minWidth="33.0" onAction="#switchToEnglish" prefHeight="25.0" prefWidth="33.0" text="EN" />
<Button fx:id="flagNlButton" onAction="#switchToDutch" text="NL" /> <Button fx:id="flagNlButton" onAction="#switchToDutch" text="NL" />
<Button fx:id="flagPlButton" onAction="#switchToPolish" text="PL" /> <Button fx:id="flagPlButton" onAction="#switchToPolish" text="PL" />
</items> </items>
@ -70,10 +70,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<Button fx:id="closeButton" onAction="#closeWindow" text="X" GridPane.columnIndex="3" />
<Button fx:id="maximizeButton" onAction="#MazimizeWindow" text="□" GridPane.columnIndex="2" />
<Button fx:id="minimizeButton" onAction="#MinimizeWindow" text="-" GridPane.columnIndex="1" />
<Button fx:id="refreshButton" onAction="#refresh" prefHeight="25.0" prefWidth="34.0" text="⟳" GridPane.columnIndex="3" GridPane.rowIndex="2" /> <Button fx:id="refreshButton" onAction="#refresh" prefHeight="25.0" prefWidth="34.0" text="⟳" GridPane.columnIndex="3" GridPane.rowIndex="2" />
</children> </children>
</GridPane> </GridPane>
@ -97,7 +94,7 @@
<HBox spacing="10"> <HBox spacing="10">
<Button fx:id="AddRecipeButton" onAction="#addRecipe" text="Add Recipe" /> <Button fx:id="AddRecipeButton" onAction="#addRecipe" text="Add Recipe" />
<Button fx:id="RemoveRecipeButton" onAction="#removeSelectedRecipe" text="Remove Recipe" /> <Button fx:id="RemoveRecipeButton" onAction="#removeSelectedRecipe" text="Remove Recipe" />
<Button mnemonicParsing="false" text="Clone" /> <Button fx:id= "CloneREcipeButton" mnemonicParsing="false" onAction="#cloneRecipe" text="Clone" />
</HBox> </HBox>
</VBox> </VBox>
</left> </left>
@ -111,35 +108,35 @@
<!-- Recipe title row --> <!-- Recipe title row -->
<HBox spacing="10"> <HBox spacing="10">
<Label fx:id="replaceNameLabel" text="Recipe Name"> <Label fx:id="recipeNameLabel" text="Recipe Name">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font></Label> </font></Label>
<Button fx:id="editRecipeTitleButton" onAction="#editRecipeTitle" text="Edit" /> <Button fx:id="editRecipeTitleButton" onAction="#editRecipeTitle" text="Edit" />
<Button fx:id="RemoveRecipeButton2" mnemonicParsing="false" onAction="#removeSelectedRecipe" text="Remove Recipe" /> <Button fx:id="RemoveRecipeButton2" mnemonicParsing="false" onAction="#removeSelectedRecipe" text="Remove Recipe" />
<Button fx:id="printRecipe" mnemonicParsing="false" onAction="#MakePrintable" text="Print Recipe" /> <Button fx:id="printRecipe" mnemonicParsing="false" onAction="#makePrintable" text="Print Recipe" />
</HBox> </HBox>
<!-- Ingredients --> <!-- Ingredients -->
<VBox spacing="10"> <VBox spacing="10">
<Label fx:id="ingredientsListView" text="Ingredients"> <Label text="Ingredients">
<font> <font>
<Font name="System Bold" size="14.0" /> <Font name="System Bold" size="14.0" />
</font></Label> </font>
<ListView prefHeight="167.0" prefWidth="912.0" /> </Label>
<ListView fx:id="ingredientsListView" prefHeight="167.0" prefWidth="912.0" />
<Button fx:id="addIngredientButton" onAction="#addIngredient" text="Add Ingredient" /> <Button fx:id="addIngredientButton" onAction="#addIngredient" text="Add Ingredient" />
</VBox> </VBox>
<!-- Preparation --> <!-- Preparation -->
<VBox spacing="10"> <Label text="Preparation">
<Label fx:id="preparationListView" text="Preparation"> <font>
<font> <Font name="System Bold" size="14.0" />
<Font name="System Bold" size="14.0" /> </font>
</font></Label> </Label>
<ListView prefHeight="200.0" /> <ListView fx:id="preparationListView" prefHeight="200.0" />
<Button fx:id="addPreparationStepButton" onAction="#addPreperationStep" text="Add Step" /> <Button fx:id="addPreparationStepButton" onAction="#addPreparationStep" text="Add Step" />
</VBox> <GridPane>
<GridPane>
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="890.6666870117188" minWidth="10.0" prefWidth="854.6666870117188" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="890.6666870117188" minWidth="10.0" prefWidth="854.6666870117188" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="445.3333740234375" minWidth="10.0" prefWidth="57.33331298828125" /> <ColumnConstraints hgrow="SOMETIMES" maxWidth="445.3333740234375" minWidth="10.0" prefWidth="57.33331298828125" />