Compare commits

..
Author SHA1 Message Date
schrom01 a1b73e22ca removed "äöü" from error messages. 2022-05-13 17:51:04 +02:00
schrom01 11d6ca1852 changed error Message numberOfParticipants. 2022-05-13 17:10:32 +02:00
schrom01 a78d1d9de7 changed error Message numberOfParticipants. 2022-05-13 16:51:17 +02:00
schrom01 5f6193d8b2 Merge branch 'main' into develop_footer
# Conflicts:
#	app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Tournament.java
2022-05-13 16:50:35 +02:00
Roman SchenkandGitHub Enterprise 3d522dd13c Merge pull request #49 from PM2-IT21bWIN-ruiz-mach-krea/gameSchedule_Alert
Create alert popup if user wants to create new game schedule
2022-05-13 16:12:29 +02:00
Andrin Fassbind 7dea7919c5 AlertDelete shortened code 2022-05-13 16:12:06 +02:00
fassbandandGitHub Enterprise f575bb94d3 Merge pull request #48 from PM2-IT21bWIN-ruiz-mach-krea/fixes_in_layout
Fixes in layout
2022-05-13 16:06:23 +02:00
Andrin Fassbind 55517a531e Create alert popup if user wants to create new game schedule 2022-05-13 16:04:19 +02:00
schrom01 54a428cde2 throw PlaceExistsExceptoin if place exists already. 2022-05-13 13:48:38 +02:00
4 changed files with 38 additions and 8 deletions
@@ -85,7 +85,7 @@ public class TournamentDecorator implements IsObservable{
} catch (Tournament.InvalidTypeException e) { } catch (Tournament.InvalidTypeException e) {
e.printStackTrace(); e.printStackTrace();
//TODO: Logger //TODO: Logger
factoryDecorator.printMessageToFooter("Turniermodus nicht möglich",true); factoryDecorator.printMessageToFooter("Turniermodus nicht moeglich",true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
@@ -113,7 +113,7 @@ public class TournamentDecorator implements IsObservable{
factoryDecorator.clearMessage(true); factoryDecorator.clearMessage(true);
} catch (Tournament.NumberOfParticipantInvalidException e) { } catch (Tournament.NumberOfParticipantInvalidException e) {
e.printStackTrace(); e.printStackTrace();
factoryDecorator.printMessageToFooter("Anzahl Teilnehmer nicht vielfaches von 2",true); factoryDecorator.printMessageToFooter("Anzahl Teilnehmer muss mindestens 4 betragen und eine Potenz von 2 sein.",true);
} }
informListener(); informListener();
} }
@@ -131,7 +131,7 @@ public class TournamentDecorator implements IsObservable{
factoryDecorator.printMessageToFooter("Invalide Telefonnummer",true); factoryDecorator.printMessageToFooter("Invalide Telefonnummer",true);
} catch (Player.InvalidDateException e) { } catch (Player.InvalidDateException e) {
e.printStackTrace(); e.printStackTrace();
factoryDecorator.printMessageToFooter("Ungültiges Geburtsdatum", true); factoryDecorator.printMessageToFooter("Ungueltiges Geburtsdatum", true);
} }
} }
@@ -0,0 +1,26 @@
package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
public class AlertNewSchedule extends Alert {
private ButtonType yesButton = new ButtonType("Ja", ButtonBar.ButtonData.YES);
private ButtonType noButton = new ButtonType("Nein", ButtonBar.ButtonData.NO);
private boolean result;
public AlertNewSchedule() {
super(AlertType.WARNING);
setTitle("Neu erstellen");
setHeaderText("Spielplan neu erstellen?");
setContentText("Sind Sie sicher, dass Sie den Spielplan neu erstellen moechten?\nAlle Spielfortschritte gehen daraufhin verloren!");
getButtonTypes().setAll(yesButton,noButton);
}
public boolean showAndGetResult() {
showAndWait().ifPresent(input -> {
result = input == yesButton;
});
return result;
}
}
@@ -1,7 +1,6 @@
package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView; package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
import ch.zhaw.projekt2.turnierverwaltung.FXController; import ch.zhaw.projekt2.turnierverwaltung.FXController;
import ch.zhaw.projekt2.turnierverwaltung.Tournament;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Button; import javafx.scene.control.Button;
@@ -30,7 +29,14 @@ public class GameScheduleController extends FXController {
@FXML @FXML
void createNewSchedule(ActionEvent event) { void createNewSchedule(ActionEvent event) {
getTournamentDecorator().createNewGameSchedule(); if (getTournamentDecorator().getTournament().getGameList().size() > 0) {
AlertNewSchedule alert = new AlertNewSchedule();
if (alert.showAndGetResult()) {
getTournamentDecorator().createNewGameSchedule();
}
} else {
getTournamentDecorator().createNewGameSchedule();
}
} }
@FXML @FXML
@@ -21,9 +21,7 @@ public class AlertDelete extends Alert {
public boolean showAndGetResult() { public boolean showAndGetResult() {
result = false; result = false;
showAndWait().ifPresent(type -> { showAndWait().ifPresent(type -> {
if (type == yesButton) { result = type == yesButton;
result = true;
}
}); });
return result; return result;
} }