Merge pull request #39 from PM2-IT21bWIN-ruiz-mach-krea/develop_footer
Develop footer
This commit is contained in:
commit
92d121890c
|
@ -51,11 +51,11 @@ public class FactoryDecorator implements IsObservable{
|
||||||
try {
|
try {
|
||||||
factory.setTournament(fileIO.loadTournament(tournamentFile));
|
factory.setTournament(fileIO.loadTournament(tournamentFile));
|
||||||
openScheduleView();
|
openScheduleView();
|
||||||
} catch (IOException e) {
|
clearMessage(false);
|
||||||
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} catch (ClassNotFoundException e) {
|
printMessageToFooter("Fehler beim lesen der Datei.", true);
|
||||||
e.printStackTrace();
|
} //TODO handle and logging
|
||||||
} //TODO handle and logging
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openTournamentList() {
|
public void openTournamentList() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class Player extends Person implements Participant{
|
||||||
|
|
||||||
private LocalDate dateOfBirth;
|
private LocalDate dateOfBirth;
|
||||||
|
|
||||||
public Player(String firstName, String name, String phoneNumber, String dateOfBirth) throws InvalidNameException, InvalidPhoneNumberException {
|
public Player(String firstName, String name, String phoneNumber, String dateOfBirth) throws InvalidNameException, InvalidPhoneNumberException, InvalidDateException {
|
||||||
super(firstName, name, phoneNumber);
|
super(firstName, name, phoneNumber);
|
||||||
setDateOfBirth(dateOfBirth);
|
setDateOfBirth(dateOfBirth);
|
||||||
}
|
}
|
||||||
|
@ -28,10 +28,16 @@ public class Player extends Person implements Participant{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDateOfBirth(String dateOfBirth) {
|
public void setDateOfBirth(String dateOfBirth) throws InvalidDateException {
|
||||||
if(dateOfBirth.length() > 0) {
|
if(dateOfBirth.length() > 0) {
|
||||||
String[] date = dateOfBirth.split("\\.");
|
String[] date = dateOfBirth.split("\\.");
|
||||||
this.dateOfBirth = LocalDate.of(Integer.valueOf(date[2]), Integer.valueOf(date[1]), Integer.valueOf(date[0]));
|
try{
|
||||||
|
this.dateOfBirth = LocalDate.of(Integer.valueOf(date[2]), Integer.valueOf(date[1]), Integer.valueOf(date[0]));
|
||||||
|
} catch (NumberFormatException | IndexOutOfBoundsException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new InvalidDateException("Date invalid");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dateOfBirth = null;
|
dateOfBirth = null;
|
||||||
}
|
}
|
||||||
|
@ -52,4 +58,16 @@ public class Player extends Person implements Participant{
|
||||||
setDateOfBirth(player.getDateOfBirth());
|
setDateOfBirth(player.getDateOfBirth());
|
||||||
setPhoneNumber(player.getPhoneNumber());
|
setPhoneNumber(player.getPhoneNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class InvalidDateException extends Exception {
|
||||||
|
public InvalidDateException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidDateException(String errorMessage) {
|
||||||
|
super(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,9 @@ public class TournamentDecorator implements IsObservable{
|
||||||
} catch (Person.InvalidPhoneNumberException e) {
|
} catch (Person.InvalidPhoneNumberException e) {
|
||||||
e.printStackTrace(); //TODO handle and logging
|
e.printStackTrace(); //TODO handle and logging
|
||||||
factoryDecorator.printMessageToFooter("Invalide Telefonnummer",true);
|
factoryDecorator.printMessageToFooter("Invalide Telefonnummer",true);
|
||||||
|
} catch (Player.InvalidDateException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
factoryDecorator.printMessageToFooter("Ungültiges Geburtsdatum", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue