diff --git a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java index 9ba7585..cf5dc49 100644 --- a/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java +++ b/client/src/main/java/client/scenes/FoodpalApplicationCtrl.java @@ -28,9 +28,9 @@ import javafx.scene.control.TextField; import javafx.scene.input.KeyCode; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; +import javafx.scene.text.Font; public class FoodpalApplicationCtrl implements LocaleAware { - private final MainCtrl mainCtrl; private final ServerUtils server; private final LocaleManager localeManager; private final IngredientListCtrl ingredientListCtrl; @@ -80,13 +80,11 @@ public class FoodpalApplicationCtrl implements LocaleAware { @Inject public FoodpalApplicationCtrl( - MainCtrl mainCtrl, ServerUtils server, LocaleManager localeManager, IngredientListCtrl ingredientListCtrl, RecipeStepListCtrl stepListCtrl ) { - this.mainCtrl = mainCtrl; this.server = server; this.localeManager = localeManager; this.ingredientListCtrl = ingredientListCtrl; @@ -149,8 +147,11 @@ public class FoodpalApplicationCtrl implements LocaleAware { refresh(); } private void showName(String name) { + final int NAME_FONT_SIZE = 20; editableTitleArea.getChildren().clear(); - editableTitleArea.getChildren().add(new Label(name)); + Label nameLabel = new Label(name); + nameLabel.setFont(new Font("System Bold", NAME_FONT_SIZE)); + editableTitleArea.getChildren().add(nameLabel); } @Override public void updateText() { diff --git a/client/src/main/java/client/scenes/recipe/IngredientListCtrl.java b/client/src/main/java/client/scenes/recipe/IngredientListCtrl.java index aa33ed2..859c28a 100644 --- a/client/src/main/java/client/scenes/recipe/IngredientListCtrl.java +++ b/client/src/main/java/client/scenes/recipe/IngredientListCtrl.java @@ -1,17 +1,18 @@ package client.scenes.recipe; +import client.utils.LocaleAware; +import client.utils.LocaleManager; +import com.google.inject.Inject; import commons.Recipe; -import java.net.URL; import java.util.ArrayList; import java.util.List; -import java.util.ResourceBundle; import java.util.function.Consumer; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; -import javafx.fxml.Initializable; import javafx.scene.control.Button; +import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.ListView.EditEvent; @@ -19,9 +20,15 @@ import javafx.scene.control.ListView.EditEvent; * Controller for the ingredient list view in the recipe detail scene. * Manages displaying, adding, editing, and deleting ingredients. * - * @see RecipeStepListCell The custom cell implementation. + * @see IngredientListCell The custom cell implementation. */ -public class IngredientListCtrl implements Initializable { +public class IngredientListCtrl implements LocaleAware { + private final LocaleManager localeManager; + @Inject + public IngredientListCtrl(LocaleManager localeManager) { + this.localeManager = localeManager; + } + /** *

* The list of ingredients currently displayed. @@ -43,6 +50,9 @@ public class IngredientListCtrl implements Initializable { @FXML public ListView ingredientListView; + @FXML + public Label ingredientsLabel; + @FXML public Button addIngredientButton; @FXML @@ -129,8 +139,21 @@ public class IngredientListCtrl implements Initializable { this.updateCallback.accept(this.ingredients); } - @FXML - public void initialize(URL location, ResourceBundle resources) { + @Override + public void updateText() { + System.out.println("updatetext called on ingredientListCtrl"); + ingredientsLabel.setText(getLocaleString("menu.label.ingredients")); + addIngredientButton.setText(getLocaleString("menu.button.add.ingredient")); + deleteIngredientButton.setText(getLocaleString("menu.button.remove.ingredient")); + } + + @Override + public LocaleManager getLocaleManager() { + return localeManager; + } + + @Override + public void initializeComponents() { // TODO: set up communication with the server // this would probably be best done with the callback (so this class doesn't // interact with the server at all) diff --git a/client/src/main/java/client/scenes/recipe/RecipeStepListCtrl.java b/client/src/main/java/client/scenes/recipe/RecipeStepListCtrl.java index 2839028..8bfcce4 100644 --- a/client/src/main/java/client/scenes/recipe/RecipeStepListCtrl.java +++ b/client/src/main/java/client/scenes/recipe/RecipeStepListCtrl.java @@ -1,17 +1,18 @@ package client.scenes.recipe; +import client.utils.LocaleAware; +import client.utils.LocaleManager; +import com.google.inject.Inject; import commons.Recipe; -import java.net.URL; import java.util.ArrayList; import java.util.List; -import java.util.ResourceBundle; import java.util.function.Consumer; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; -import javafx.fxml.Initializable; import javafx.scene.control.Button; +import javafx.scene.control.Label; import javafx.scene.control.ListView; import javafx.scene.control.ListView.EditEvent; @@ -21,7 +22,16 @@ import javafx.scene.control.ListView.EditEvent; * * @see RecipeStepListCell The custom cell implementation. */ -public class RecipeStepListCtrl implements Initializable { +public class RecipeStepListCtrl implements LocaleAware { + private final LocaleManager localeManager; + + @FXML + public Label stepsLabel; + + @Inject + public RecipeStepListCtrl(LocaleManager localeManager) { + this.localeManager = localeManager; + } /** *

* The list of recipe steps currently displayed. @@ -129,18 +139,25 @@ public class RecipeStepListCtrl implements Initializable { this.updateCallback.accept(this.steps); } - @FXML - public void initialize(URL location, ResourceBundle resources) { - // TODO: set up communication with the server - // this would probably be best done with the callback (so this class doesn't - // interact with the server at all) + @Override + public void updateText() { + stepsLabel.setText(getLocaleString("menu.label.preparation")); + addStepButton.setText(getLocaleString("menu.button.add.step")); + deleteStepButton.setText(getLocaleString("menu.button.remove.step")); + } + @Override + public LocaleManager getLocaleManager() { + return localeManager; + } + + @Override + public void initializeComponents() { this.recipeStepListView.setEditable(true); this.recipeStepListView.setCellFactory( list -> { return new RecipeStepListCell(); }); - this.recipeStepListView.setOnEditCommit(this::handleIngredientEdit); this.addStepButton.setOnAction(this::handleIngredientAdd); this.deleteStepButton.setOnAction(this::handleIngredientDelete); diff --git a/client/src/main/resources/client/scenes/recipe/IngredientList.fxml b/client/src/main/resources/client/scenes/recipe/IngredientList.fxml index 1ad02e4..1a032ea 100644 --- a/client/src/main/resources/client/scenes/recipe/IngredientList.fxml +++ b/client/src/main/resources/client/scenes/recipe/IngredientList.fxml @@ -15,7 +15,7 @@ -