From 384b67be2efd7790126b6a40cac1122474c8cbb5 Mon Sep 17 00:00:00 2001 From: Lara Blersch <lb210@hdm-stuttgart.de> Date: Thu, 22 Jun 2023 11:27:20 +0200 Subject: [PATCH] rounded category boxes, redesigned add recipe buttons in mealplan, display categories in recipeview, improved GUI --- .../mi/hdm/components/CategoryCheckBox.java | 3 +- .../hdm/components/CategoryPreviewLabel.java | 2 +- .../hdm/controllers/MealPlanController.java | 10 +- .../hdm/controllers/RecipeViewController.java | 19 ++- src/main/java/mi/hdm/controllers/View.java | 2 +- src/main/resources/fxml/category-creator.fxml | 35 ++--- .../resources/fxml/ingredient-creator.fxml | 78 +++++------ src/main/resources/fxml/recipe-creator.fxml | 121 +++++++----------- src/main/resources/fxml/recipe-view.fxml | 31 ++--- 9 files changed, 146 insertions(+), 155 deletions(-) diff --git a/src/main/java/mi/hdm/components/CategoryCheckBox.java b/src/main/java/mi/hdm/components/CategoryCheckBox.java index bec9a2e..f28c611 100644 --- a/src/main/java/mi/hdm/components/CategoryCheckBox.java +++ b/src/main/java/mi/hdm/components/CategoryCheckBox.java @@ -17,7 +17,8 @@ public class CategoryCheckBox extends CheckBox { this.setStyle( "-fx-background-color:" + category.getColourCode() + ";" + "-fx-padding: 4px;" + - "-fx-text-fill: " + ColorHelper.getTextColorForBackground(getAssociatedCategory().getColourCode()) + ";" + "-fx-text-fill: " + ColorHelper.getTextColorForBackground(getAssociatedCategory().getColourCode()) + ";" + + "-fx-background-radius: 10px;" ); } diff --git a/src/main/java/mi/hdm/components/CategoryPreviewLabel.java b/src/main/java/mi/hdm/components/CategoryPreviewLabel.java index 61513d0..effe40d 100644 --- a/src/main/java/mi/hdm/components/CategoryPreviewLabel.java +++ b/src/main/java/mi/hdm/components/CategoryPreviewLabel.java @@ -19,7 +19,7 @@ public class CategoryPreviewLabel extends Label { "-fx-background-color:" + category.getColourCode() + ";" + "-fx-padding: 4px;" + "-fx-text-fill: " + ColorHelper.getTextColorForBackground(getAssociatedCategory().getColourCode()) + ";" + - "-fx-border-radius: 10px;" //TODO: border radius on the style? this does not work + "-fx-background-radius: 10px;" ); } diff --git a/src/main/java/mi/hdm/controllers/MealPlanController.java b/src/main/java/mi/hdm/controllers/MealPlanController.java index a81ba3b..125e02a 100644 --- a/src/main/java/mi/hdm/controllers/MealPlanController.java +++ b/src/main/java/mi/hdm/controllers/MealPlanController.java @@ -93,7 +93,14 @@ public class MealPlanController extends BaseController { recipeImage.fitHeightProperty().bind(mealPlanGrid.heightProperty().subtract(60)); name.setPadding(new Insets(10)); }, () -> { - Button addRecipeButton = new Button("add recipe"); + Button addRecipeButton = new Button(); + addRecipeButton.setStyle("-fx-background-color: dedede;" + + "-fx-background-radius: 15;"); + ImageView imageView = new ImageView(String.valueOf(Recipe.class.getResource("/images/Tasty_Pages_Plus_Icon.png"))); + imageView.setPreserveRatio(true); + imageView.setFitHeight(50); + imageView.setFitWidth(50); + addRecipeButton.setGraphic(imageView); mealPlanGrid.add(addRecipeButton, J, 1); addRecipeButton.setOnMouseClicked(element -> searchRecipes(LocalDate.now().plusDays(J))); GridPane.setHalignment(addRecipeButton, HPos.CENTER); @@ -109,6 +116,7 @@ public class MealPlanController extends BaseController { searchVBox.setMaxSize(800, 800); searchVBox.setAlignment(Pos.CENTER); TextField searchTextField = new TextField(); + searchTextField.setPromptText("Search for recipe"); searchTextField.textProperty().addListener(e -> { String input = searchTextField.getText(); log.debug("Input in search field changed, searching through recipes with query '{}'.", input); diff --git a/src/main/java/mi/hdm/controllers/RecipeViewController.java b/src/main/java/mi/hdm/controllers/RecipeViewController.java index 9a7710b..28e365e 100644 --- a/src/main/java/mi/hdm/controllers/RecipeViewController.java +++ b/src/main/java/mi/hdm/controllers/RecipeViewController.java @@ -5,13 +5,12 @@ import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; +import mi.hdm.components.CategoryPreviewLabel; import mi.hdm.components.IngredientLabel; -import mi.hdm.recipes.Ingredient; -import mi.hdm.recipes.IngredientManager; -import mi.hdm.recipes.Recipe; -import mi.hdm.recipes.RecipeManager; +import mi.hdm.recipes.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -21,6 +20,7 @@ public class RecipeViewController extends BaseController { private final Recipe recipe; private final RecipeManager recipeManager; private final IngredientManager ingredientManager; + private final CategoryManager categoryManager; @FXML private AnchorPane parent; @FXML @@ -33,13 +33,16 @@ public class RecipeViewController extends BaseController { private VBox ingredientVBox; @FXML private ImageView recipeImage; + @FXML + private HBox categoryHBox; - public RecipeViewController(Recipe recipe, RecipeManager recipeManager, IngredientManager ingredientManager) { + public RecipeViewController(Recipe recipe, RecipeManager recipeManager, IngredientManager ingredientManager, CategoryManager categoryManager) { this.recipe = recipe; this.recipeManager = recipeManager; this.ingredientManager = ingredientManager; + this.categoryManager = categoryManager; } @FXML @@ -58,7 +61,7 @@ public class RecipeViewController extends BaseController { recipeName.setText(recipe.getName()); recipeDescription.setText(recipe.getDescription()); - recipePreparation.setText(String.join("\n", recipe.getPreparation())); + recipePreparation.setText(String.join("\n\n", recipe.getPreparation())); recipe.getIngredients().forEach((code, amount) -> { Ingredient i = ingredientManager.getIngredient(code).orElseThrow(); @@ -67,6 +70,10 @@ public class RecipeViewController extends BaseController { log.debug("Added ingredient label with the following values: {}, {}, {}", i.getName(), amount, i.getMeasurement()); }); + categoryManager.getCategoriesFromKeys(recipe.getCategoryCodes()).forEach(category -> { + CategoryPreviewLabel label = new CategoryPreviewLabel(category); + categoryHBox.getChildren().add(label); + }); //idea for solution from: https://stackoverflow.com/questions/22710053/how-can-i-show-an-image-using-the-imageview-component-in-javafx-and-fxml log.debug("Trying to load image for recipe from '{}'", recipe.getImageURL()); diff --git a/src/main/java/mi/hdm/controllers/View.java b/src/main/java/mi/hdm/controllers/View.java index 31dba3c..73e2e8e 100644 --- a/src/main/java/mi/hdm/controllers/View.java +++ b/src/main/java/mi/hdm/controllers/View.java @@ -44,7 +44,7 @@ public enum View { case RECIPE_VIEW -> loader.setControllerFactory((callback) -> { if (args != null && args.length == 1 && args[0] instanceof Recipe recipe) { - return new RecipeViewController(recipe, model.getRecipeManager(), model.getIngredientManager()); + return new RecipeViewController(recipe, model.getRecipeManager(), model.getIngredientManager(), model.getCategoryManager()); } else { throw new InvalidParameterException(); } diff --git a/src/main/resources/fxml/category-creator.fxml b/src/main/resources/fxml/category-creator.fxml index 8366ebc..97d0dd6 100644 --- a/src/main/resources/fxml/category-creator.fxml +++ b/src/main/resources/fxml/category-creator.fxml @@ -1,34 +1,39 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.geometry.Insets?> +<?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> -<?import javafx.scene.text.Font?> -<AnchorPane fx:id="parent" prefHeight="700.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/17.0.2-ea" - xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.CategoryCreatorController"> +<?import javafx.scene.text.*?> + +<AnchorPane fx:id="parent" prefHeight="700.0" prefWidth="1000.0" style="-fx-background-color: 000000;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.CategoryCreatorController"> <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> - <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="50.0" - AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="50.0"> + <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="50.0"> <Label text="Create a category"> <font> - <Font name="System Bold" size="24.0"/> + <Font name="System Bold" size="24.0" /> </font> </Label> - <Label text="Name for your category"/> + <Label text="Name for your category" /> <HBox prefWidth="200.0" spacing="20.0"> <VBox.margin> - <Insets top="5.0"/> + <Insets top="5.0" /> </VBox.margin> - <TextField fx:id="nameTextField" maxWidth="500.0" prefWidth="400.0" promptText="Enter a name..."/> - <ColorPicker fx:id="colorPicker" editable="true" promptText="Choose a color..."/> + <TextField fx:id="nameTextField" maxWidth="500.0" prefWidth="400.0" promptText="Enter a name..." style="-fx-background-color: transparent; -fx-border-color: d91c1c; -fx-border-width: 4; -fx-border-radius: 10;" /> + <ColorPicker fx:id="colorPicker" editable="true" promptText="Choose a color..." /> </HBox> <HBox spacing="30.0"> - <Button mnemonicParsing="false" onAction="#handleCancel" text="Cancel"/> - <Button mnemonicParsing="false" onAction="#handleAddCategory" text="Create category"/> + <Button mnemonicParsing="false" onAction="#handleCancel" style="-fx-background-color: transparent; -fx-border-color: d91c1c; -fx-border-width: 4; -fx-border-radius: 5;" text="Cancel" textFill="#d91c1c"> + <font> + <Font name="System Bold" size="17.0" /> + </font></Button> + <Button mnemonicParsing="false" onAction="#handleAddCategory" style="-fx-background-color: transparent; -fx-border-width: 4; -fx-border-color: d91c1c; -fx-border-radius: 5;" text="Create category" textFill="#d91c1c"> + <font> + <Font name="System Bold" size="17.0" /> + </font></Button> <VBox.margin> - <Insets top="15.0"/> + <Insets top="15.0" /> </VBox.margin> </HBox> </VBox> diff --git a/src/main/resources/fxml/ingredient-creator.fxml b/src/main/resources/fxml/ingredient-creator.fxml index 56430d4..7136556 100644 --- a/src/main/resources/fxml/ingredient-creator.fxml +++ b/src/main/resources/fxml/ingredient-creator.fxml @@ -1,21 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.geometry.Insets?> +<?import javafx.geometry.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> -<?import javafx.scene.text.Font?> +<?import javafx.scene.text.*?> -<AnchorPane fx:id="parent" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17.0.2-ea" - xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.IngredientCreatorController"> +<AnchorPane fx:id="parent" prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: 000000;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.IngredientCreatorController"> <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> - <BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" - AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <top> <Label text="Create a new ingredient" textFill="#d91c1c" BorderPane.alignment="CENTER"> <font> - <Font size="24.0"/> + <Font size="24.0" /> </font> </Label> </top> @@ -23,61 +21,65 @@ <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" BorderPane.alignment="CENTER"> <Label text="Ingredient name"> <font> - <Font name="System Bold" size="12.0"/> + <Font name="System Bold" size="12.0" /> </font> </Label> - <TextField fx:id="ingredientNameField" maxWidth="400.0" - promptText="Enter the name for your ingredient here"> + <TextField fx:id="ingredientNameField" maxWidth="400.0" promptText="Enter the name for your ingredient here" style="-fx-background-color: transparent; -fx-border-color: d91c1c; -fx-border-width: 4; -fx-border-radius: 10;"> <VBox.margin> - <Insets bottom="10.0"/> + <Insets bottom="10.0" /> </VBox.margin> </TextField> <Label text="Unit"> <font> - <Font name="System Bold" size="12.0"/> + <Font name="System Bold" size="12.0" /> </font> </Label> <ChoiceBox fx:id="unitChoiceBox" prefWidth="150.0"> <VBox.margin> - <Insets bottom="10.0"/> + <Insets bottom="10.0" /> </VBox.margin> </ChoiceBox> <Label text="Nutrition values"> <font> - <Font name="System Bold" size="12.0"/> + <Font name="System Bold" size="12.0" /> </font> </Label> <GridPane> <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="281.0" minWidth="10.0" prefWidth="197.0"/> - <ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="383.0"/> + <ColumnConstraints hgrow="SOMETIMES" maxWidth="281.0" minWidth="10.0" prefWidth="197.0" /> + <ColumnConstraints hgrow="SOMETIMES" maxWidth="390.0" minWidth="10.0" prefWidth="383.0" /> </columnConstraints> <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> </rowConstraints> <VBox.margin> - <Insets left="10.0" right="10.0"/> + <Insets left="10.0" right="10.0" /> </VBox.margin> - <Label text="Calories"/> - <TextField fx:id="caloriesTextField" GridPane.columnIndex="1"/> - <Label text="Carbohydrates" GridPane.rowIndex="1"/> - <TextField fx:id="carbsTextField" GridPane.columnIndex="1" GridPane.rowIndex="1"/> - <Label text="Fats" GridPane.rowIndex="2"/> - <Label text="Proteins" GridPane.rowIndex="3"/> - <Label text="Fibers" GridPane.rowIndex="4"/> - <Label text="Salt" GridPane.rowIndex="5"/> - <TextField fx:id="fatsTextField" GridPane.columnIndex="1" GridPane.rowIndex="2"/> - <TextField fx:id="proteinsTextField" GridPane.columnIndex="1" GridPane.rowIndex="3"/> - <TextField fx:id="fibersTextField" GridPane.columnIndex="1" GridPane.rowIndex="4"/> - <TextField fx:id="saltTextField" GridPane.columnIndex="1" GridPane.rowIndex="5"/> + <Label text="Calories" /> + <TextField fx:id="caloriesTextField" GridPane.columnIndex="1" /> + <Label text="Carbohydrates" GridPane.rowIndex="1" /> + <TextField fx:id="carbsTextField" GridPane.columnIndex="1" GridPane.rowIndex="1" /> + <Label text="Fats" GridPane.rowIndex="2" /> + <Label text="Proteins" GridPane.rowIndex="3" /> + <Label text="Fibers" GridPane.rowIndex="4" /> + <Label text="Salt" GridPane.rowIndex="5" /> + <TextField fx:id="fatsTextField" GridPane.columnIndex="1" GridPane.rowIndex="2" /> + <TextField fx:id="proteinsTextField" GridPane.columnIndex="1" GridPane.rowIndex="3" /> + <TextField fx:id="fibersTextField" GridPane.columnIndex="1" GridPane.rowIndex="4" /> + <TextField fx:id="saltTextField" GridPane.columnIndex="1" GridPane.rowIndex="5" /> </GridPane> - <Button accessibleText="Create ingredient" onAction="#submitCreateIngredient" mnemonicParsing="false" - text="Create Ingredient"/> + <Button accessibleText="Create ingredient" mnemonicParsing="false" onAction="#submitCreateIngredient" style="-fx-background-color: transparent; -fx-border-width: 4; -fx-border-color: d91c1c; -fx-border-radius: 5;" text="Create Ingredient" textFill="#d91c1c"> + <font> + <Font name="System Bold" size="17.0" /> + </font> + <VBox.margin> + <Insets top="10.0" /> + </VBox.margin></Button> </VBox> </center> </BorderPane> diff --git a/src/main/resources/fxml/recipe-creator.fxml b/src/main/resources/fxml/recipe-creator.fxml index 05d38d4..7b42978 100644 --- a/src/main/resources/fxml/recipe-creator.fxml +++ b/src/main/resources/fxml/recipe-creator.fxml @@ -1,52 +1,44 @@ <?xml version="1.0" encoding="UTF-8"?> <?import javafx.geometry.*?> +<?import javafx.scene.*?> <?import javafx.scene.control.*?> -<?import javafx.scene.Cursor?> -<?import javafx.scene.image.Image?> -<?import javafx.scene.image.ImageView?> +<?import javafx.scene.image.*?> <?import javafx.scene.layout.*?> -<?import javafx.scene.text.Font?> -<AnchorPane prefHeight="800" prefWidth="1200.0" style="-fx-background-color: ffffff;" - xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" - fx:controller="mi.hdm.controllers.RecipeCreatorController"> +<?import javafx.scene.text.*?> + +<AnchorPane prefHeight="800" prefWidth="1200.0" style="-fx-background-color: ffffff;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.RecipeCreatorController"> <padding> - <Insets bottom="10.0" left="10.0" right="10.0"/> + <Insets bottom="10.0" left="10.0" right="10.0" /> </padding> - <BorderPane fx:id="borderPane" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <BorderPane fx:id="borderPane" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <center> - <SplitPane fx:id="topSplitPane" dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0" - style="-fx-box-border: transparent; -fx-padding: 0; -fx-split-pane-divider: transparent; -fx-background-color: transparent;" - BorderPane.alignment="CENTER"> - <AnchorPane minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0" - style="-fx-background-color: ffffff;"> + <SplitPane fx:id="topSplitPane" dividerPositions="0.5" prefHeight="160.0" prefWidth="200.0" style="-fx-box-border: transparent; -fx-padding: 0; -fx-split-pane-divider: transparent; -fx-background-color: transparent;" BorderPane.alignment="CENTER"> + <AnchorPane minHeight="0.0" minWidth="300.0" prefHeight="160.0" prefWidth="100.0" style="-fx-background-color: ffffff;"> <padding> - <Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/> + <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> - <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" - AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> - <Label text="Recipe name"/> - <TextField fx:id="nameTextField" promptText="Enter a name for your recipe" - style="-fx-background-color: eeeeee; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;"> + <VBox prefHeight="200.0" prefWidth="100.0" spacing="5.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <Label text="Recipe name" /> + <TextField fx:id="nameTextField" promptText="Enter a name for your recipe" style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;"> <VBox.margin> - <Insets bottom="5.0"/> + <Insets bottom="5.0" /> </VBox.margin> </TextField> <Label text="Recipe description" /> - <TextArea id="recipeCreatorDesctiptionTextField" fx:id="descriptionTextArea" prefHeight="104.0" prefWidth="566.0" promptText="Enter a description for your recipe" style="-fx-background-color: eeeeee; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" stylesheets="@../styles/GUI_extras.css" wrapText="true"> + <TextArea id="recipeCreatorDesctiptionTextField" fx:id="descriptionTextArea" prefHeight="104.0" prefWidth="566.0" promptText="Enter a description for your recipe" style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" stylesheets="@../styles/GUI_extras.css" wrapText="true"> <VBox.margin> <Insets bottom="5.0" /> </VBox.margin> </TextArea> <Label text="Preparation time" /> - <TextField fx:id="prepTimeTextField" promptText="How much time does it take to prepare this recipe in minutes?" style="-fx-background-color: eeeeee; -fx-border-color: D91C1C; -fx-background-radius: 5; -fx-border-radius: 5; -fx-border-width: 4;"> + <TextField fx:id="prepTimeTextField" promptText="How much time does it take to prepare this recipe in minutes?" style="-fx-background-color: transparent; -fx-border-color: D91C1C; -fx-background-radius: 5; -fx-border-radius: 5; -fx-border-width: 4;"> <VBox.margin> <Insets bottom="5.0" /> </VBox.margin> </TextField> <Label text="Selected categories" /> - <HBox id="recipeCreatorCategoryDisplay" fx:id="categories" minHeight="20.0" prefHeight="33.0" prefWidth="567.0" spacing="5.0" style="-fx-background-color: eeeeee; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-width: 4; -fx-border-radius: 4;"> + <HBox id="recipeCreatorCategoryDisplay" fx:id="categories" minHeight="20.0" prefHeight="33.0" prefWidth="567.0" spacing="5.0" style="-fx-background-color: transparent;"> <padding> <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> </padding> @@ -62,17 +54,15 @@ </TextArea> <Label text="Ingredients" /> <ScrollPane id="RecipeCreatorIngredients" fx:id="selectedIngredientsScrollPane" prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: transparent; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-background-radius: 5; -fx-border-width: 4;" stylesheets="@../styles/GUI_extras.css" /> - <Button mnemonicParsing="false" onAction="#confirmCreateRecipe" - style="-fx-background-color: ffffff; -fx-control-inner-background: transparent; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" - text="Create Recipe" textFill="#d91c1c"> + <Button mnemonicParsing="false" onAction="#confirmCreateRecipe" style="-fx-background-color: ffffff; -fx-control-inner-background: transparent; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" text="Create Recipe" textFill="#d91c1c"> <VBox.margin> - <Insets top="10.0"/> + <Insets top="10.0" /> </VBox.margin> <font> - <Font name="System Bold" size="13.0"/> + <Font name="System Bold" size="13.0" /> </font> <cursor> - <Cursor fx:constant="HAND"/> + <Cursor fx:constant="HAND" /> </cursor> </Button> </VBox> @@ -82,58 +72,43 @@ <padding> <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" /> </padding> - <VBox prefHeight="200.0" prefWidth="100.0" style="-fx-background-color: ffffff;" - AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" - AnchorPane.topAnchor="0.0"> - <Label text="Select categories"/> - <FlowPane fx:id="allCategories" hgap="5.0" prefHeight="129.0" prefWidth="566.0" - style="-fx-background-color: eeeeee; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" - vgap="5.0"> + <VBox prefHeight="200.0" prefWidth="100.0" style="-fx-background-color: ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> + <Label text="Select categories" /> + <FlowPane fx:id="allCategories" hgap="5.0" prefHeight="129.0" prefWidth="566.0" style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;" vgap="5.0"> <padding> - <Insets bottom="5.0" left="5.0" right="5.0" top="5.0"/> + <Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /> </padding> </FlowPane> - <Separator prefWidth="200.0"/> + <Separator prefWidth="200.0" /> <Label text="Search for ingredients"> <VBox.margin> - <Insets top="10.0"/> + <Insets top="10.0" /> </VBox.margin> </Label> - <TextField fx:id="ingredientSearch" onInputMethodTextChanged="#searchIngredients" - promptText="Type something..." - style="-fx-background-color: eeeeee; -fx-background-radius: 5; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 4;"> + <TextField fx:id="ingredientSearch" onInputMethodTextChanged="#searchIngredients" promptText="Type something..." style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 4;"> <VBox.margin> - <Insets bottom="5.0" top="5.0"/> + <Insets bottom="5.0" top="5.0" /> </VBox.margin> </TextField> - <ScrollPane fx:id="searchResultsPane" fitToHeight="true" maxHeight="1.7976931348623157E308" - prefHeight="509.0" prefWidth="566.0" - style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-width: 4; -fx-border-color: #D91C1C; -fx-border-radius: 5;" - stylesheets="@../styles/GUI_extras.css"/> + <ScrollPane fx:id="searchResultsPane" fitToHeight="true" maxHeight="1.7976931348623157E308" prefHeight="509.0" prefWidth="566.0" style="-fx-background-color: transparent; -fx-background-radius: 5; -fx-border-width: 4; -fx-border-color: #D91C1C; -fx-border-radius: 5;" stylesheets="@../styles/GUI_extras.css" /> <HBox alignment="TOP_CENTER" prefHeight="45.0" prefWidth="566.0" spacing="15.0"> - <Button accessibleRole="DECREMENT_BUTTON" mnemonicParsing="false" - onAction="#decrementPageCounter" - style="-fx-background-color: #ffffff; -fx-control-inner-background: transparent; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 2; -fx-padding: 5;" - text="<< Previous" textFill="#d91c1c"> + <Button accessibleRole="DECREMENT_BUTTON" mnemonicParsing="false" onAction="#decrementPageCounter" style="-fx-background-color: #ffffff; -fx-control-inner-background: transparent; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 2; -fx-padding: 5;" text="<< Previous" textFill="#d91c1c"> <opaqueInsets> - <Insets/> + <Insets /> </opaqueInsets> <HBox.margin> - <Insets top="12.0"/> + <Insets top="12.0" /> </HBox.margin> <font> - <Font size="13.0"/> + <Font size="13.0" /> </font> </Button> - <Button accessibleRole="INCREMENT_BUTTON" mnemonicParsing="false" - onAction="#incrementPageCounter" - style="-fx-background-color: #ffffff; -fx-control-inner-background: transparent; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 2;" - text="Next >>" textFill="#d91c1c"> + <Button accessibleRole="INCREMENT_BUTTON" mnemonicParsing="false" onAction="#incrementPageCounter" style="-fx-background-color: #ffffff; -fx-control-inner-background: transparent; -fx-border-color: #D91C1C; -fx-border-radius: 5; -fx-border-width: 2;" text="Next >>" textFill="#d91c1c"> <font> - <Font size="13.0"/> + <Font size="13.0" /> </font> <HBox.margin> - <Insets top="12.0"/> + <Insets top="12.0" /> </HBox.margin> </Button> </HBox> @@ -144,27 +119,25 @@ <top> <GridPane BorderPane.alignment="CENTER"> <columnConstraints> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> - <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> + <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> </columnConstraints> <rowConstraints> - <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> + <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> </rowConstraints> <padding> - <Insets bottom="10.0" left="5.0" right="5.0" top="5.0"/> + <Insets bottom="10.0" left="5.0" right="5.0" top="5.0" /> </padding> - <ImageView fitHeight="40.0" fitWidth="200.0" onMouseClicked="#changeSceneToHome" pickOnBounds="true" - preserveRatio="true" GridPane.valignment="CENTER"> - <Image url="@../images/Tasty_Pages_Back_Arrow.png"/> + <ImageView fitHeight="40.0" fitWidth="200.0" onMouseClicked="#changeSceneToHome" pickOnBounds="true" preserveRatio="true" GridPane.valignment="CENTER"> + <Image url="@../images/Tasty_Pages_Back_Arrow.png" /> <cursor> - <Cursor fx:constant="HAND"/> + <Cursor fx:constant="HAND" /> </cursor> </ImageView> - <Label alignment="CENTER" contentDisplay="CENTER" prefHeight="17.0" prefWidth="1000.0" - text="Create a recipe" textAlignment="CENTER" GridPane.columnIndex="1"> + <Label alignment="CENTER" contentDisplay="CENTER" prefHeight="17.0" prefWidth="1000.0" text="Create a recipe" textAlignment="CENTER" GridPane.columnIndex="1"> <font> - <Font name="System Bold" size="24.0"/> + <Font name="System Bold" size="24.0" /> </font> </Label> </GridPane> diff --git a/src/main/resources/fxml/recipe-view.fxml b/src/main/resources/fxml/recipe-view.fxml index 705f6f9..990476c 100644 --- a/src/main/resources/fxml/recipe-view.fxml +++ b/src/main/resources/fxml/recipe-view.fxml @@ -1,20 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.geometry.Insets?> -<?import javafx.scene.control.Button?> -<?import javafx.scene.control.Label?> -<?import javafx.scene.control.ListView?> -<?import javafx.scene.control.ScrollPane?> -<?import javafx.scene.image.ImageView?> -<?import javafx.scene.layout.AnchorPane?> -<?import javafx.scene.layout.ColumnConstraints?> -<?import javafx.scene.layout.GridPane?> -<?import javafx.scene.layout.Pane?> -<?import javafx.scene.layout.RowConstraints?> -<?import javafx.scene.layout.VBox?> -<?import javafx.scene.text.Font?> +<?import javafx.geometry.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.image.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.text.*?> -<AnchorPane fx:id="parent" prefHeight="540.0" prefWidth="872.0" style="-fx-background-color: ffffff;" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.RecipeViewController"> +<AnchorPane fx:id="parent" prefHeight="540.0" prefWidth="872.0" style="-fx-background-color: ffffff;" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mi.hdm.controllers.RecipeViewController"> <children> <VBox layoutX="410.0" layoutY="1.0" prefHeight="539.0" prefWidth="872.0" style="-fx-background-color: ffffff;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <padding> @@ -72,13 +64,13 @@ <Insets bottom="10.0" /> </VBox.margin> </GridPane> - <ListView fixedCellSize="1.0" prefHeight="80.0" prefWidth="393.0" style="-fx-background-color: transparent; -fx-border-color: D91C1C; -fx-border-radius: 5; -fx-border-width: 4;"> + <HBox fx:id="categoryHBox" prefHeight="50.0" prefWidth="393.0" style="-fx-background-color: transparent;"> <VBox.margin> <Insets bottom="10.0" top="10.0" /> - </VBox.margin></ListView> - <ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" prefHeight="244.0" prefWidth="393.0" style="-fx-border-color: D91C1C; -fx-border-width: 4; -fx-border-radius: 10; -fx-background-color: transparent;" stylesheets="@../styles/GUI_extras.css"> + </VBox.margin></HBox> + <ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" prefHeight="300.0" prefWidth="393.0" style="-fx-border-color: D91C1C; -fx-border-width: 4; -fx-border-radius: 10; -fx-background-color: transparent;" stylesheets="@../styles/GUI_extras.css"> <content> - <Label fx:id="recipePreparation" alignment="TOP_LEFT" contentDisplay="CENTER" lineSpacing="1.5" prefHeight="372.0" prefWidth="393.0" style="-fx-background-color: transparent;" text="Recipe Preparation" wrapText="true"> + <Label fx:id="recipePreparation" alignment="TOP_LEFT" contentDisplay="CENTER" lineSpacing="1.5" prefHeight="303.0" prefWidth="383.0" style="-fx-background-color: transparent;" text="Recipe Preparation" wrapText="true"> <font> <Font name="Inter Regular" size="12.0" /> </font> @@ -90,6 +82,9 @@ </padding> </Label> </content> + <VBox.margin> + <Insets top="10.0" /> + </VBox.margin> </ScrollPane> </children> <GridPane.margin> -- GitLab