Skip to content
Snippets Groups Projects
Commit 7d0f5c95 authored by Jakob Behrens's avatar Jakob Behrens
Browse files

Implemented a warning for starting an empty tournamentt

parent affcdd08
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,13 @@ public class BracketViewController extends TournamentController {
* @throws IOException if the file is not found
*/
public void onPressPlay() throws IOException {
TableTennisApplication.changeScene("create-tournament-match.fxml");
if (TournamentController.tournamentRegister.getParticipants().size() <= 2) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setContentText("No players are added!");
alert.setTitle("UNABLE TO CREATE BRACKET");
alert.showAndWait();
} else {
TableTennisApplication.changeScene("create-tournament-match.fxml");
}
}
}
......@@ -94,6 +94,13 @@ public class BracketViewController4 extends TournamentController {
* @throws IOException If the file is not found
*/
public void onPressPlay() throws IOException {
TableTennisApplication.changeScene("create-tournament-match.fxml");
if (TournamentController.tournamentRegister.getParticipants().size() <= 2) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setContentText("No players are added!");
alert.setTitle("UNABLE TO CREATE BRACKET");
alert.showAndWait();
} else {
TableTennisApplication.changeScene("create-tournament-match.fxml");
}
}
}
......@@ -21,7 +21,7 @@ import java.nio.file.Path;
public class BracketViewController8 extends TournamentController {
@FXML
private Label playersAddedMessage;
private Label playersAddedMessage;
@FXML
private TextField textFieldPlayer1;
@FXML
......@@ -59,8 +59,7 @@ public class BracketViewController8 extends TournamentController {
alert.setContentText("Please enter a name into the text field before proceeding!");
alert.setTitle("WARNING");
alert.showAndWait();
}
else {
} else {
try {
TournamentController.tournamentRegister.clear();
......@@ -89,7 +88,7 @@ public class BracketViewController8 extends TournamentController {
try {
TournamentController.tournamentRegister.clear();
TournamentController.tournamentRegister.addPlayers(
FileHandler.readCsv(Path.of("NEWTOURNAMENT.csv")));
FileHandler.readCsv(Path.of("NEWTOURNAMENT.csv")));
TableTennisApplication.changeScene("tournament-match-view.fxml");
} catch (Exception e) {
......@@ -106,6 +105,13 @@ public class BracketViewController8 extends TournamentController {
* @throws IOException if the fxml file is not found
*/
public void onPressPlay() throws IOException {
TableTennisApplication.changeScene("create-tournament-match.fxml");
if (TournamentController.tournamentRegister.getParticipants().size() <= 2) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setContentText("No players are added!");
alert.setTitle("UNABLE TO CREATE BRACKET");
alert.showAndWait();
} else {
TableTennisApplication.changeScene("create-tournament-match.fxml");
}
}
}
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