From 177f548e07ec3cf770ceddd1dbc3085af1618808 Mon Sep 17 00:00:00 2001 From: Trym Hamer Gudvangen <trym.gudvangen@gmail.com> Date: Sun, 21 May 2023 21:02:03 +0200 Subject: [PATCH] styles: add back button to the bottom of parent pane --- .../paths/view/components/pop_up/PassagePopUp.java | 2 ++ .../paths/view/components/table/PassageTable.java | 4 ++++ .../paths/view/views/CreatePlayerView.java | 14 ++++++++------ .../group_30/paths/view/views/LoadGameView.java | 6 ++---- .../group_30/paths/view/views/NewStoryView.java | 5 ++++- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java index 41cfaf6..1bf38ef 100644 --- a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java +++ b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/pop_up/PassagePopUp.java @@ -11,6 +11,8 @@ public class PassagePopUp { private TextArea contentArea; private Button saveButton; + + public PassagePopUp() { titleField = new TextField(); titleField.setPromptText("Enter the title of the passage"); diff --git a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/table/PassageTable.java b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/table/PassageTable.java index 1a3f146..3fce06f 100644 --- a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/table/PassageTable.java +++ b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/components/table/PassageTable.java @@ -1,5 +1,9 @@ package edu.ntnu.idatt2001.group_30.paths.view.components.table; +/** + * This class concerns itself with the aspects intrinsic to a passage table. + * @param <Passage> The type of the table, represented using a Passage object. + */ public class PassageTable<Passage> extends TableDisplay<Passage> { /** diff --git a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/CreatePlayerView.java b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/CreatePlayerView.java index 7da1049..adde9df 100644 --- a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/CreatePlayerView.java +++ b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/CreatePlayerView.java @@ -112,13 +112,15 @@ public class CreatePlayerView extends View<BorderPane> { nameField.setMinWidth(200); continueButton = new Button("Continue"); - returnButton = new Button("Return"); - HBox viewButtons = new HBox(returnButton, continueButton); - returnButton.setAlignment(Pos.CENTER_LEFT); - continueButton.setAlignment(Pos.CENTER_RIGHT); - viewButtons.setSpacing(200); + returnButton = new Button("Back"); - VBox bottomBox = new VBox(nameField, viewButtons); + getParentPane().setBottom(returnButton); + getParentPane().getBottom().setTranslateY(-50); + getParentPane().getBottom().setTranslateX(10); + + + + VBox bottomBox = new VBox(nameField, continueButton); bottomBox.setSpacing(20); bottomBox.setAlignment(Pos.CENTER); bottomBox.setPadding(new Insets(0, 0, 0, 0)); diff --git a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/LoadGameView.java b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/LoadGameView.java index 9c070d5..7e3bb4a 100644 --- a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/LoadGameView.java +++ b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/LoadGameView.java @@ -56,14 +56,12 @@ public class LoadGameView extends View<BorderPane> { Button backButton = new Button("Back"); backButton.setOnAction(e -> StageManager.getInstance().goBack()); + getParentPane().setBottom(backButton); startButton = DefaultButton.medium("Start game", newGameController.goTo(PlaythroughView.class)); startButton.setVisible(false); - HBox buttonBox = new HBox(10, backButton, startButton); - buttonBox.setAlignment(Pos.CENTER); - - VBox containerWithButtons = new VBox(mainContainer, buttonBox); + VBox containerWithButtons = new VBox(mainContainer, startButton); containerWithButtons.setSpacing(20); containerWithButtons.setAlignment(Pos.CENTER); diff --git a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java index 0cfe660..5a34588 100644 --- a/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java +++ b/src/main/java/edu/ntnu/idatt2001/group_30/paths/view/views/NewStoryView.java @@ -4,7 +4,6 @@ import edu.ntnu.idatt2001.group_30.paths.controller.NewStoryController; import edu.ntnu.idatt2001.group_30.paths.model.Link; import edu.ntnu.idatt2001.group_30.paths.model.Passage; import edu.ntnu.idatt2001.group_30.paths.model.Story; -import static edu.ntnu.idatt2001.group_30.paths.view.components.common.DefaultInputField.inputWithLabelAndPrompt; import static edu.ntnu.idatt2001.group_30.paths.PathsSingleton.INSTANCE; @@ -88,7 +87,11 @@ public class NewStoryView extends View<BorderPane> { display.setSpacing(10); display.setPrefWidth(500); + Button backButton = new Button("Back"); + backButton.setOnAction(newStoryController.goBack()); + getParentPane().setCenter(display); + getParentPane().setBottom(backButton); } -- GitLab