Skip to content

Commit

Permalink
fix(Start-MVC): Notification when player not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
PawelSapula committed May 24, 2026
1 parent 05e2e1a commit b324732
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public void initializeGame() {
model.isNewGame().set(true);
}

if (model.isFirstNewGame()) {
model.getError().set("No player with this name found. Create new player.");
model.setFirstNewGame(false);
return;
}

if (model.getBalance().get() == null) {
model.getError().set("Balance field can't be empty");
return;
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/edu/ntnu/idi/idatt/view/entry/StartModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ public class StartModel implements Model {
private final StringProperty fileName = new SimpleStringProperty();

private final BooleanProperty newGame = new SimpleBooleanProperty();
private boolean firstNewGame = false;
private final BooleanProperty predefinedCSV = new SimpleBooleanProperty(true);

public StartModel() {
newGame.addListener((obs) -> {
firstNewGame = true;
});
}

public StringProperty getName() {
return name;
}
Expand All @@ -36,6 +43,14 @@ public BooleanProperty isNewGame() {
return newGame;
}

public boolean isFirstNewGame() {
return firstNewGame;
}

public void setFirstNewGame(boolean val) {
firstNewGame = val;
}

public BooleanProperty isPredefinedCSV() {
return predefinedCSV;
}
Expand Down

0 comments on commit b324732

Please sign in to comment.