Skip to content
Snippets Groups Projects
Commit 76a17268 authored by Trym Hamer Gudvangen's avatar Trym Hamer Gudvangen
Browse files

styles: use auto-checkstyle to format code

parent 75600fe9
No related branches found
No related tags found
2 merge requests!34Feat/create story gui,!7Feat/part three
Pipeline #230714 passed
Showing
with 151 additions and 141 deletions
......@@ -3,7 +3,6 @@ package edu.ntnu.idatt2001.group_30.paths;
import edu.ntnu.idatt2001.group_30.paths.model.Player;
import edu.ntnu.idatt2001.group_30.paths.model.Story;
import edu.ntnu.idatt2001.group_30.paths.model.goals.*;
import java.io.File;
import java.util.List;
import java.util.Objects;
......
......@@ -5,8 +5,6 @@ import static edu.ntnu.idatt2001.group_30.paths.PathsSingleton.INSTANCE;
import edu.ntnu.idatt2001.group_30.paths.model.filehandling.StoryFileReader;
import edu.ntnu.idatt2001.group_30.paths.view.views.NewStoryView;
import edu.ntnu.idatt2001.group_30.paths.view.views.PlaythroughView;
import java.io.File;
import java.io.IOException;
......@@ -25,5 +23,4 @@ public class NewGameController extends Controller {
throw new RuntimeException(ex);
}
}
}
package edu.ntnu.idatt2001.group_30.paths.controller;
import static edu.ntnu.idatt2001.group_30.paths.PathsSingleton.INSTANCE;
import edu.ntnu.idatt2001.group_30.paths.model.Passage;
import edu.ntnu.idatt2001.group_30.paths.model.Story;
import edu.ntnu.idatt2001.group_30.paths.model.filehandling.StoryFileWriter;
import edu.ntnu.idatt2001.group_30.paths.view.views.NewStoryView;
import javafx.stage.FileChooser;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import javafx.stage.FileChooser;
import static edu.ntnu.idatt2001.group_30.paths.PathsSingleton.INSTANCE;
public class NewStoryController extends Controller{
public class NewStoryController extends Controller {
public NewStoryController() {
super(NewStoryView.class);
}
public void addStory(String title, List<Passage> passages) throws IOException {
Story story = new Story(title, passages.isEmpty() ? null: passages.get(0));
Story story = new Story(title, passages.isEmpty() ? null : passages.get(0));
passages.forEach(story::addPassage);
INSTANCE.setStory(story);
saveStory(story);
saveStory(story);
}
public void saveStory(Story story) throws IOException {
FileChooser fileChooser = new FileChooser();
fileChooser.setInitialDirectory(new File("./src/main/resources/story-files"));
fileChooser.getExtensionFilters().add(
new FileChooser.ExtensionFilter("Paths files", "*.paths")
);
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Paths files", "*.paths"));
File selectedFile = fileChooser.showSaveDialog(null);
if (selectedFile != null) {
......
......@@ -107,7 +107,7 @@ public class Story {
*/
public void setTitle(String title) {
if (title == null || title.isBlank()) throw new IllegalArgumentException(
"Title cannot be blank, empty, or contain special characters."
"Title cannot be blank, empty, or contain special characters."
);
this.title = title;
}
......
......@@ -79,14 +79,13 @@ public class StoryFileWriter {
Objects.requireNonNull(file, "File cannot be null");
if (FileHandler.fileExists(file)) throw new FileAlreadyExistsException(
"You cannot overwrite a pre-existing story file"
"You cannot overwrite a pre-existing story file"
);
/* propagate any errors while writing */
writeStory(story, file);
}
//TODO: add test for story files...
/**
......
......@@ -23,5 +23,4 @@ public class DefaultInputField {
textField.setPromptText(prompt);
return new HBox(labelText, textField);
}
}
......@@ -9,9 +9,7 @@ public abstract class AbstractPopUp {
protected abstract void setupUiComponents();
protected abstract void setupBehavior();
protected abstract void createPopUp();
}
......@@ -16,7 +16,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
public class GoalsPopUp extends AbstractPopUp{
public class GoalsPopUp extends AbstractPopUp {
private TextField healthField;
private TextField goldField;
......@@ -40,25 +40,25 @@ public class GoalsPopUp extends AbstractPopUp{
protected void setupUiComponents() {
healthField = new TextField();
healthField.setTextFormatter(
TextValidation.createIntegerTextFormatter(
INSTANCE.getHealthGoal() == null ? 100 : INSTANCE.getHealthGoal().getGoalValue()
)
TextValidation.createIntegerTextFormatter(
INSTANCE.getHealthGoal() == null ? 100 : INSTANCE.getHealthGoal().getGoalValue()
)
);
healthField.setPromptText("Add health goal");
goldField = new TextField();
goldField.setTextFormatter(
TextValidation.createIntegerTextFormatter(
INSTANCE.getGoldGoal() == null ? 100 : INSTANCE.getGoldGoal().getGoalValue()
)
TextValidation.createIntegerTextFormatter(
INSTANCE.getGoldGoal() == null ? 100 : INSTANCE.getGoldGoal().getGoalValue()
)
);
goldField.setPromptText("Add gold goal");
scoreField = new TextField();
scoreField.setTextFormatter(
TextValidation.createIntegerTextFormatter(
INSTANCE.getScoreGoal() == null ? 100 : INSTANCE.getScoreGoal().getGoalValue()
)
TextValidation.createIntegerTextFormatter(
INSTANCE.getScoreGoal() == null ? 100 : INSTANCE.getScoreGoal().getGoalValue()
)
);
scoreField.setPromptText("Add score goal");
......@@ -100,7 +100,8 @@ public class GoalsPopUp extends AbstractPopUp{
System.err.println("Something is wrong with the trash image resource link");
}
content = new VBox(
content =
new VBox(
new Label("Health:"),
healthField,
new Label("Gold:"),
......@@ -112,7 +113,7 @@ public class GoalsPopUp extends AbstractPopUp{
inventoryTable,
deleteButton,
saveButton
);
);
content.setAlignment(Pos.CENTER);
content.setSpacing(20);
......@@ -149,19 +150,18 @@ public class GoalsPopUp extends AbstractPopUp{
popUp.close();
}
});
}
@Override
protected void createPopUp() {
popUp = PopUp
popUp =
PopUp
.<ScrollPane>create()
.withTitle("Add goals to your player")
.withoutCloseButton()
.withContent(scrollPane)
.withDialogSize(400, 750);
popUp.showAndWait();
}
}
......@@ -8,6 +8,7 @@ import edu.ntnu.idatt2001.group_30.paths.model.actions.ActionType;
import edu.ntnu.idatt2001.group_30.paths.model.utils.TextValidation;
import edu.ntnu.idatt2001.group_30.paths.view.components.table.ActionTable;
import edu.ntnu.idatt2001.group_30.paths.view.components.table.TableDisplay;
import java.util.HashMap;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
......@@ -15,9 +16,7 @@ import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import java.util.HashMap;
public class LinkPopUp extends AbstractPopUp{
public class LinkPopUp extends AbstractPopUp {
private TextField textField;
private TextField actionTextField;
......@@ -56,7 +55,6 @@ public class LinkPopUp extends AbstractPopUp{
createPopUp();
}
@Override
protected void setupUiComponents() {
textField = new TextField();
......@@ -74,25 +72,27 @@ public class LinkPopUp extends AbstractPopUp{
actionTextField = new TextField();
removeActionButton = new Button("Remove Action");
removeActionButton.setDisable(true);
addActionButton = new Button("Add Action");
HBox actionHbox = new HBox(actionComboBox, actionTextField, addActionButton);
actionHbox.setAlignment(Pos.CENTER);
actionTable = new ActionTable<>(new TableDisplay.Builder<Action<?>>()
.addColumnWithComplexValue("Type", action -> action.getClass().getSimpleName())
.addColumnWithComplexValue("Value", action -> action.getActionValue().toString()));
actionTable =
new ActionTable<>(
new TableDisplay.Builder<Action<?>>()
.addColumnWithComplexValue("Type", action -> action.getClass().getSimpleName())
.addColumnWithComplexValue("Value", action -> action.getActionValue().toString())
);
actionTable.setItems(actions);
actionTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
content = new VBox(
content =
new VBox(
new Label("Link Text:"),
textField,
new Label("Link Reference:"),
......@@ -102,23 +102,22 @@ public class LinkPopUp extends AbstractPopUp{
actionTable,
removeActionButton,
saveButton
);
);
content.setAlignment(Pos.CENTER);
content.setSpacing(20);
}
@Override
protected void setupBehavior() {
removeActionButton.setOnAction(event -> actions.remove(actionTable.getSelectionModel().getSelectedItem()));
actionTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
removeActionButton.setDisable(newSelection == null);
});
actionTable
.getSelectionModel()
.selectedItemProperty()
.addListener((obs, oldSelection, newSelection) -> {
removeActionButton.setDisable(newSelection == null);
});
addActionButton.setOnAction(e -> {
if (actionComboBox.getValue() != null) {
......@@ -137,28 +136,33 @@ public class LinkPopUp extends AbstractPopUp{
}
});
actionComboBox.setCellFactory(listView -> new ListCell<>() {
@Override
protected void updateItem(ActionType actionType, boolean empty) {
super.updateItem(actionType, empty);
if (empty || actionType == null) {
setText(null);
} else {
setText(actionType.getDisplayName());
switch(actionType) {
case SCORE_ACTION, GOLD_ACTION, HEALTH_ACTION -> actionTextField.setTextFormatter(TextValidation.createIntegerTextFormatter());
case INVENTORY_ACTION -> actionTextField.setTextFormatter(null);
actionComboBox.setCellFactory(listView ->
new ListCell<>() {
@Override
protected void updateItem(ActionType actionType, boolean empty) {
super.updateItem(actionType, empty);
if (empty || actionType == null) {
setText(null);
} else {
setText(actionType.getDisplayName());
switch (actionType) {
case SCORE_ACTION, GOLD_ACTION, HEALTH_ACTION -> actionTextField.setTextFormatter(
TextValidation.createIntegerTextFormatter()
);
case INVENTORY_ACTION -> actionTextField.setTextFormatter(null);
}
}
}
}
});
);
actionComboBox.setButtonCell(actionComboBox.getCellFactory().call(null));
}
@Override
protected void createPopUp() {
popUp = PopUp
popUp =
PopUp
.<VBox>create()
.withTitle("Create a Link")
.withoutCloseButton()
......
package edu.ntnu.idatt2001.group_30.paths.view.components.pop_up;
import edu.ntnu.idatt2001.group_30.paths.model.Passage;
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.view.components.table.LinkTable;
import edu.ntnu.idatt2001.group_30.paths.view.components.table.TableDisplay;
import javafx.collections.FXCollections;
......@@ -16,7 +16,7 @@ import javafx.scene.layout.VBox;
*
* @author Trym Hamer Gudvangen
*/
public class PassagePopUp extends AbstractPopUp{
public class PassagePopUp extends AbstractPopUp {
private TextField titleField;
private TextArea contentArea;
......@@ -63,9 +63,10 @@ public class PassagePopUp extends AbstractPopUp{
saveButton = new Button("Save");
linkTable = new LinkTable<>(new TableDisplay.Builder<Link>()
.addColumn("Link Title", "text")
.addColumn("Reference", "reference"));
linkTable =
new LinkTable<>(
new TableDisplay.Builder<Link>().addColumn("Link Title", "text").addColumn("Reference", "reference")
);
linkTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
linkTable.setItems(links);
......@@ -77,12 +78,13 @@ public class PassagePopUp extends AbstractPopUp{
removeLinkButton.setDisable(true);
addLinkButton = new Button("Add Link");
if(passages.isEmpty()) addLinkButton.setDisable(true);
if (passages.isEmpty()) addLinkButton.setDisable(true);
HBox linkTableButtonHBox = new HBox(editLinkButton, addLinkButton, removeLinkButton);
linkTableButtonHBox.setAlignment(Pos.CENTER);
content = new VBox(
content =
new VBox(
new Label("Passage Title:"),
titleField,
new Label("Passage Content:"),
......@@ -91,7 +93,7 @@ public class PassagePopUp extends AbstractPopUp{
linkTable,
linkTableButtonHBox,
saveButton
);
);
content.setAlignment(Pos.CENTER);
content.setSpacing(20);
......@@ -101,33 +103,35 @@ public class PassagePopUp extends AbstractPopUp{
protected void setupBehavior() {
editLinkButton.setOnAction(e -> {
Link newLink = new LinkPopUp(this.passages, linkTable.getSelectionModel().getSelectedItem()).getLink();
if(newLink != null) {
if (newLink != null) {
this.links.remove(linkTable.getSelectionModel().getSelectedItem());
this.links.add(newLink);
}
});
removeLinkButton.setOnAction(e -> links.remove(linkTable.getSelectionModel().getSelectedItem()));
linkTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
removeLinkButton.setDisable(newSelection == null);
editLinkButton.setDisable(newSelection == null);
});
linkTable
.getSelectionModel()
.selectedItemProperty()
.addListener((obs, oldSelection, newSelection) -> {
removeLinkButton.setDisable(newSelection == null);
editLinkButton.setDisable(newSelection == null);
});
addLinkButton.setOnAction(e -> {
Link newLink = new LinkPopUp(this.passages).getLink();
if(newLink != null) {
if (newLink != null) {
this.links.add(newLink);
}
});
saveButton.setOnAction(e -> {
if (titleField.getText().isBlank() || contentArea.getText().isBlank()) {
AlertDialog.showWarning("The title or content cannot be blank.");
} else if (this.passages.stream().anyMatch(passage1 -> passage1.getTitle().equals(titleField.getText())
&& passage != passage1)) {
} else if (
this.passages.stream()
.anyMatch(passage1 -> passage1.getTitle().equals(titleField.getText()) && passage != passage1)
) {
AlertDialog.showWarning("A passage with the title " + titleField.getText() + " already exists.");
} else {
this.passage = new Passage(titleField.getText(), contentArea.getText());
......@@ -140,7 +144,8 @@ public class PassagePopUp extends AbstractPopUp{
@Override
protected void createPopUp() {
popUp = PopUp
popUp =
PopUp
.<VBox>create()
.withTitle("Create a Passage")
.withoutCloseButton()
......
......@@ -9,7 +9,7 @@ import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
public class StatsPopUp extends AbstractPopUp{
public class StatsPopUp extends AbstractPopUp {
private TextField healthField;
private TextField goldField;
......@@ -63,7 +63,8 @@ public class StatsPopUp extends AbstractPopUp{
@Override
protected void createPopUp() {
popUp = PopUp
popUp =
PopUp
.<VBox>create()
.withTitle("Add stats to your player")
.withoutCloseButton()
......
......@@ -6,7 +6,7 @@ package edu.ntnu.idatt2001.group_30.paths.view.components.table;
*
* @author Trym Hamer Gudvangen
*/
public class ActionTable<Action> extends TableDisplay<Action>{
public class ActionTable<Action> extends TableDisplay<Action> {
/**
* This is a constructor which is used to construct a table for different actions.
......
......@@ -4,7 +4,7 @@ package edu.ntnu.idatt2001.group_30.paths.view.components.table;
* This class concerns itself with the aspects intrinsic to a link table.
* @param <Link> The type of the table, represented using a Link object.
*/
public class LinkTable<Link> extends TableDisplay<Link>{
public class LinkTable<Link> extends TableDisplay<Link> {
/**
* This is a constructor which is used to construct a table for different links.
......
......@@ -14,5 +14,4 @@ public class PassageTable<Passage> extends TableDisplay<Passage> {
public PassageTable(Builder<Passage> tableBuilder) {
super(tableBuilder);
}
}
package edu.ntnu.idatt2001.group_30.paths.view.components.table;
import java.util.function.Function;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import java.util.function.Function;
/**
* This class concerns itself with building a table view filled with the desired information in columns. It does so
* by using a TableBuilder.
......@@ -59,7 +58,9 @@ public class TableDisplay<T> extends TableView<T> {
*/
public Builder<T> addColumnWithComplexValue(String infoHeader, Function<T, String> complexValueFunction) {
TableColumn<T, String> column = new TableColumn<>(infoHeader);
column.setCellValueFactory(cellData -> new SimpleStringProperty(complexValueFunction.apply(cellData.getValue())));
column.setCellValueFactory(cellData ->
new SimpleStringProperty(complexValueFunction.apply(cellData.getValue()))
);
column.setStyle("-fx-alignment: CENTER");
this.tableColumns.add(column);
return this;
......
......@@ -117,8 +117,6 @@ public class CreatePlayerView extends View<BorderPane> {
getParentPane().getBottom().setTranslateY(-50);
getParentPane().getBottom().setTranslateX(10);
VBox bottomBox = new VBox(nameField, continueButton);
bottomBox.setSpacing(20);
bottomBox.setAlignment(Pos.CENTER);
......
......@@ -48,7 +48,7 @@ public class LoadGameView extends View<BorderPane> {
VBox mainContainer = createMainContainerVBox(titlePane);
if(INSTANCE.getStory() != null) {
if (INSTANCE.getStory() != null) {
try {
addStoryPane();
} catch (IOException e) {
......@@ -151,9 +151,9 @@ public class LoadGameView extends View<BorderPane> {
private void addStoryPane() throws IOException {
VBox storyVBox = new StoryDisplay.Builder(INSTANCE.getStory())
.addStoryName()
.addFileInfo(INSTANCE.getStoryFile())
.build();
.addStoryName()
.addFileInfo(INSTANCE.getStoryFile())
.build();
storyVBox.setAlignment(Pos.CENTER);
Button pencilButton = createIconButton("/images/pencil.png", 16, 16);
......
package edu.ntnu.idatt2001.group_30.paths.view.views;
import static edu.ntnu.idatt2001.group_30.paths.PathsSingleton.INSTANCE;
import edu.ntnu.idatt2001.group_30.paths.controller.NewStoryController;
import edu.ntnu.idatt2001.group_30.paths.controller.StageManager;
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.PathsSingleton.INSTANCE;
import edu.ntnu.idatt2001.group_30.paths.view.components.common.DefaultText;
import edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.AlertDialog;
import edu.ntnu.idatt2001.group_30.paths.view.components.pop_up.PassagePopUp;
import edu.ntnu.idatt2001.group_30.paths.view.components.table.PassageTable;
import edu.ntnu.idatt2001.group_30.paths.view.components.table.TableDisplay;
import java.net.URL;
import java.util.Objects;
import java.util.stream.Collectors;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
......@@ -25,10 +28,6 @@ import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import java.net.URL;
import java.util.Objects;
import java.util.stream.Collectors;
public class NewStoryView extends View<BorderPane> {
private final NewStoryController newStoryController;
......@@ -38,28 +37,26 @@ public class NewStoryView extends View<BorderPane> {
private final Button removePassageButton;
private final Button editPassageButton;
public NewStoryView() {
super(BorderPane.class);
newStoryController = new NewStoryController();
if (INSTANCE.getStory() != null) {
story = INSTANCE.getStory();
}
if(story != null) title = story.getTitle();
if (story != null) title = story.getTitle();
passages = story == null ? FXCollections.observableArrayList() :
FXCollections.observableArrayList(story.getPassages());
passages =
story == null
? FXCollections.observableArrayList()
: FXCollections.observableArrayList(story.getPassages());
Text titleText = DefaultText.big("Create a new/edit a Story");
Text labelText = new Text("Story Title: ");
TextField textField = new TextField(title);
textField.setPromptText("Enter story title");
HBox titleBox = new HBox(labelText, textField);
titleBox.setSpacing(20);
......@@ -67,17 +64,18 @@ public class NewStoryView extends View<BorderPane> {
titleBox.setAlignment(Pos.CENTER);
PassageTable<Passage> passageTable = new PassageTable<>(new TableDisplay.Builder<Passage>()
PassageTable<Passage> passageTable = new PassageTable<>(
new TableDisplay.Builder<Passage>()
.addColumn("Name of Passage", "title")
.addColumn("Passage Content", "content")
.addColumnWithComplexValue("Links", passage -> passage == null ?
null :
passage.getLinks().stream()
.map(Link::getText)
.collect(Collectors.joining(", "))
));
.addColumnWithComplexValue(
"Links",
passage ->
passage == null
? null
: passage.getLinks().stream().map(Link::getText).collect(Collectors.joining(", "))
)
);
passageTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
passageTable.setItems(passages);
......@@ -86,8 +84,16 @@ public class NewStoryView extends View<BorderPane> {
removePassageButton = new Button("Remove Passage");
removePassageButton.setDisable(true);
removePassageButton.setOnAction(e -> {
passages.forEach(passage -> passage.getLinks().removeIf(link ->
Objects.equals(link.getReference(), passageTable.getSelectionModel().getSelectedItem().getTitle())));
passages.forEach(passage ->
passage
.getLinks()
.removeIf(link ->
Objects.equals(
link.getReference(),
passageTable.getSelectionModel().getSelectedItem().getTitle()
)
)
);
passages.remove(passageTable.getSelectionModel().getSelectedItem());
});
......@@ -97,22 +103,29 @@ public class NewStoryView extends View<BorderPane> {
Passage selectedPassage = passageTable.getSelectionModel().getSelectedItem();
if (selectedPassage != null) {
Passage updatedPassage = new PassagePopUp(passages, selectedPassage).getPassage();
if(updatedPassage != null && !selectedPassage.equals(updatedPassage)) {
passages.forEach(passage -> passage.getLinks().replaceAll(link ->
link.getReference().equals(selectedPassage.getTitle()) ?
new Link(link.getText(), updatedPassage.getTitle()) : link
));
if (updatedPassage != null && !selectedPassage.equals(updatedPassage)) {
passages.forEach(passage ->
passage
.getLinks()
.replaceAll(link ->
link.getReference().equals(selectedPassage.getTitle())
? new Link(link.getText(), updatedPassage.getTitle())
: link
)
);
passages.remove(selectedPassage);
passages.add(updatedPassage);
}
}
});
passageTable.getSelectionModel().selectedItemProperty().addListener((obs, oldSelection, newSelection) -> {
removePassageButton.setDisable(newSelection == null);
editPassageButton.setDisable(newSelection == null);
});
passageTable
.getSelectionModel()
.selectedItemProperty()
.addListener((obs, oldSelection, newSelection) -> {
removePassageButton.setDisable(newSelection == null);
editPassageButton.setDisable(newSelection == null);
});
Button addPassageButton = new Button();
URL imageUrl = getClass().getResource("/images/plus.png");
......@@ -130,12 +143,14 @@ public class NewStoryView extends View<BorderPane> {
editTableButtons.setSpacing(20);
addPassageButton.setOnAction(event -> {
if(passages.isEmpty()) {
AlertDialog.showInformation("Every story needs an opening passage.", "The opening passage" +
" will by default be the first passage added.");
if (passages.isEmpty()) {
AlertDialog.showInformation(
"Every story needs an opening passage.",
"The opening passage" + " will by default be the first passage added."
);
}
PassagePopUp passagePopUp = new PassagePopUp(passages);
if(passagePopUp.getPassage() != null) this.passages.addAll(passagePopUp.getPassage());
if (passagePopUp.getPassage() != null) this.passages.addAll(passagePopUp.getPassage());
});
Button saveButton = new Button("Save Story");
......@@ -143,8 +158,7 @@ public class NewStoryView extends View<BorderPane> {
try {
newStoryController.addStory(title, passages);
StageManager.getInstance().setCurrentView(new LoadGameView());
}
catch (Exception ex) {
} catch (Exception ex) {
AlertDialog.showWarning(ex.getMessage());
}
});
......@@ -162,5 +176,4 @@ public class NewStoryView extends View<BorderPane> {
getParentPane().setRight(editTableButtons);
getParentPane().getRight().setTranslateX(-50);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment