refactor: put recipe detail controller into its own file, don't use guice for injecting fxml controllers

This commit is contained in:
Natalia Cholewa 2025-12-20 22:53:00 +01:00
commit d2ad5337b9
4 changed files with 373 additions and 199 deletions

View file

@ -46,7 +46,7 @@
<Font name="System Bold" size="15.0" />
</font></Label>
<fx:include source="SearchBar.fxml" />
<fx:include source="SearchBar.fxml" fx:id="searchBar" />
<ListView fx:id="recipeList" />
@ -61,27 +61,7 @@
<!-- CENTER: RECIPE DETAILS -->
<center>
<VBox spacing="20" visible="false" fx:id="detailsScreen">
<padding>
<Insets bottom="10" left="10" right="10" top="10" />
</padding>
<!-- Recipe title row -->
<HBox spacing="10">
<HBox fx:id="editableTitleArea">
</HBox>
<Button fx:id="editRecipeTitleButton" onAction="#editRecipeTitle" text="Edit" />
<Button fx:id="removeRecipeButton2" mnemonicParsing="false" onAction="#removeSelectedRecipe" text="Remove Recipe" />
<Button fx:id="printRecipeButton" mnemonicParsing="false" onAction="#makePrintable" text="Print Recipe" />
<Button fx:id="favouriteButton" onAction="#toggleFavourite" text="☆" />
</HBox>
<!-- Ingredients -->
<fx:include source="recipe/IngredientList.fxml" />
<!-- Preparation -->
<fx:include source="recipe/RecipeStepList.fxml" />
</VBox>
<fx:include source="recipe/RecipeDetailView.fxml" fx:id="recipeDetail" />
</center>
</BorderPane>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<VBox
xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="client.scenes.recipe.RecipeDetailCtrl"
spacing="20" visible="false" fx:id="detailsScreen">
<padding>
<Insets bottom="10" left="10" right="10" top="10" />
</padding>
<!-- Recipe title row -->
<HBox spacing="10">
<HBox fx:id="editableTitleArea">
</HBox>
<Button fx:id="editRecipeTitleButton" onAction="#editRecipeTitle" text="Edit" />
<Button fx:id="removeRecipeButton" mnemonicParsing="false" onAction="#removeSelectedRecipe" text="Remove Recipe" />
<Button fx:id="printRecipeButton" mnemonicParsing="false" onAction="#printRecipe" text="Print Recipe" />
<Button fx:id="favouriteButton" onAction="#toggleFavourite" text="☆" />
</HBox>
<!-- Ingredients -->
<fx:include source="IngredientList.fxml" fx:id="ingredientList" />
<!-- Preparation -->
<fx:include source="RecipeStepList.fxml" fx:id="stepList" />
</VBox>