extend dictionary
This commit is contained in:
		
							parent
							
								
									d530d89db4
								
							
						
					
					
						commit
						ac68af3638
					
				| 
						 | 
					@ -134,6 +134,10 @@ public class Factory {
 | 
				
			||||||
        vBox.setBorder(null);
 | 
					        vBox.setBorder(null);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LanguageConfigurator getLanguageConfigurator() {
 | 
				
			||||||
 | 
					        return languageConfigurator;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public enum View {
 | 
					    public enum View {
 | 
				
			||||||
        tournamentList("tournamentList/tournamentList.fxml"),
 | 
					        tournamentList("tournamentList/tournamentList.fxml"),
 | 
				
			||||||
        participantFormular("participantAddFormular/participantFormular.fxml"),
 | 
					        participantFormular("participantAddFormular/participantFormular.fxml"),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,7 +54,8 @@ public class FactoryDecorator implements IsObservable{
 | 
				
			||||||
            clearMessage(false);
 | 
					            clearMessage(false);
 | 
				
			||||||
        } catch (IOException | ClassNotFoundException e) {
 | 
					        } catch (IOException | ClassNotFoundException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            printMessageToFooter("Fehler beim lesen der Datei.", true);
 | 
					            String msg = factory.getLanguageConfigurator().getSelectedLanguage("IOException");
 | 
				
			||||||
 | 
					            printMessageToFooter(msg, true);
 | 
				
			||||||
        }  //TODO handle and logging
 | 
					        }  //TODO handle and logging
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -169,6 +170,10 @@ public class FactoryDecorator implements IsObservable{
 | 
				
			||||||
        factory.resetFooter((BorderPane) pane, error);
 | 
					        factory.resetFooter((BorderPane) pane, error);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public LanguageConfigurator getLanguageConfigurator() {
 | 
				
			||||||
 | 
					        return factory.getLanguageConfigurator();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void informListener() {
 | 
					    public void informListener() {
 | 
				
			||||||
        for(IsObserver observer : listener) {
 | 
					        for(IsObserver observer : listener) {
 | 
				
			||||||
            observer.update();
 | 
					            observer.update();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,10 +80,52 @@ public class LanguageConfigurator {
 | 
				
			||||||
        germanDictionary.put("phoneNumberLabel","Telefon:");
 | 
					        germanDictionary.put("phoneNumberLabel","Telefon:");
 | 
				
			||||||
        englishDictionary.put("phoneNumberLabel","Phone:");
 | 
					        englishDictionary.put("phoneNumberLabel","Phone:");
 | 
				
			||||||
        germanDictionary.put("birthDateLabel","Geb. Datum:");
 | 
					        germanDictionary.put("birthDateLabel","Geb. Datum:");
 | 
				
			||||||
        englishDictionary.put("birthDateLabel","Birthday:");
 | 
					        englishDictionary.put("birthDateLabel","Birthdate:");
 | 
				
			||||||
        //Game
 | 
					        //Game
 | 
				
			||||||
        germanDictionary.put("locationLabel","Ort:");
 | 
					        germanDictionary.put("locationLabel","Ort:");
 | 
				
			||||||
        englishDictionary.put("locationLabel","Location:");
 | 
					        englishDictionary.put("locationLabel","Location:");
 | 
				
			||||||
 | 
					        //Error
 | 
				
			||||||
 | 
					        germanDictionary.put("IOException","Fehler beim lesen der Datei");
 | 
				
			||||||
 | 
					        englishDictionary.put("IOException","Could not read file");
 | 
				
			||||||
 | 
					        germanDictionary.put("tournamentExists","Turniername vergeben");
 | 
				
			||||||
 | 
					        englishDictionary.put("tournamentExists","Tournament exists already");
 | 
				
			||||||
 | 
					        germanDictionary.put("invalidName","Name nicht gueltig");
 | 
				
			||||||
 | 
					        englishDictionary.put("invalidName","Name not valid");
 | 
				
			||||||
 | 
					        germanDictionary.put("invalidMode","Modus nicht gueltig");
 | 
				
			||||||
 | 
					        englishDictionary.put("invalidMode","Mode not valid");
 | 
				
			||||||
 | 
					        germanDictionary.put("numberParticipant","Anzahl Spieler muss mindestens 4 sein und eine Potenz von 2");
 | 
				
			||||||
 | 
					        englishDictionary.put("numberParticipant","Number of players must be greater than 3 and power of 2");
 | 
				
			||||||
 | 
					        germanDictionary.put("invalidPhone","Telefonnummer nicht gueltig");
 | 
				
			||||||
 | 
					        englishDictionary.put("invalidPhone","Phonenumber not valid");
 | 
				
			||||||
 | 
					        germanDictionary.put("invalidDate","Geburtsdatum nicht gueltig");
 | 
				
			||||||
 | 
					        englishDictionary.put("invalidDate","Birthdate not valid");
 | 
				
			||||||
 | 
					        germanDictionary.put("participantNotExist","Teilnehmer existiert nicht");
 | 
				
			||||||
 | 
					        englishDictionary.put("participantNotExist","Participant does not exist");
 | 
				
			||||||
 | 
					        germanDictionary.put("placeNotExist","Teilnehmer existiert nicht");
 | 
				
			||||||
 | 
					        englishDictionary.put("placeNotExist","Participant does not exist");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //SaveMsg
 | 
				
			||||||
 | 
					        germanDictionary.put("save","Zuletzt gespeichert: ");
 | 
				
			||||||
 | 
					        englishDictionary.put("save","Last saved: ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        //Alert
 | 
				
			||||||
 | 
					        germanDictionary.put("yes","Ja");
 | 
				
			||||||
 | 
					        englishDictionary.put("yes","Yes");
 | 
				
			||||||
 | 
					        germanDictionary.put("no","Nein");
 | 
				
			||||||
 | 
					        englishDictionary.put("no","No");
 | 
				
			||||||
 | 
					        germanDictionary.put("titleDelete","Entfernen");
 | 
				
			||||||
 | 
					        englishDictionary.put("titleDelete","Remove");
 | 
				
			||||||
 | 
					        germanDictionary.put("headerDelete","Turnier entfernen?");
 | 
				
			||||||
 | 
					        englishDictionary.put("headerDelete","Delete Tournament?");
 | 
				
			||||||
 | 
					        germanDictionary.put("contentDelete","Sind Sie sicher, dass sie das Turnier entfernen wollen?\nNach diesem Vorgang kann es nicht wiederhergestellt werden.");
 | 
				
			||||||
 | 
					        englishDictionary.put("contentDelete","Are you shure you want to delete the tournament?\nAfter that there is no way to restore.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        germanDictionary.put("titleSchedule","Neu erstellen");
 | 
				
			||||||
 | 
					        englishDictionary.put("titleSchedule","Create new");
 | 
				
			||||||
 | 
					        germanDictionary.put("headerSchedule","Spielplan neu erstellen?");
 | 
				
			||||||
 | 
					        englishDictionary.put("headerSchedule","Create new Schedule?");
 | 
				
			||||||
 | 
					        germanDictionary.put("contentSchedule","Sind Sie sicher, dass Sie den Spielplan neu erstellen moechten?\nAlle Spielfortschritte gehen daraufhin verloren!");
 | 
				
			||||||
 | 
					        englishDictionary.put("contentSchedule","Are you shure you want to create a new game schedule?\nAll results will be lost!");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void translateGUI() {
 | 
					    public void translateGUI() {
 | 
				
			||||||
| 
						 | 
					@ -136,6 +178,18 @@ public class LanguageConfigurator {
 | 
				
			||||||
        translateGUI();
 | 
					        translateGUI();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getSelectedLanguage(String getMsg) {
 | 
				
			||||||
 | 
					        String word = "";
 | 
				
			||||||
 | 
					        switch (selectedLanguage) {
 | 
				
			||||||
 | 
					            case GERMAN -> word = germanDictionary.getOrDefault(getMsg,"check Logs");
 | 
				
			||||||
 | 
					            case ENGLISH -> word = englishDictionary.getOrDefault(getMsg,"check Logs");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (word.equals("check Logs")) {
 | 
				
			||||||
 | 
					            //TODO Log
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return word;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public enum Language {
 | 
					    public enum Language {
 | 
				
			||||||
        ENGLISH,GERMAN
 | 
					        ENGLISH,GERMAN
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,7 +61,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
    public void saveTournament(){
 | 
					    public void saveTournament(){
 | 
				
			||||||
        executorService.execute(new saveTask());
 | 
					        executorService.execute(new saveTask());
 | 
				
			||||||
        factoryDecorator.clearMessage(false);
 | 
					        factoryDecorator.clearMessage(false);
 | 
				
			||||||
        factoryDecorator.printMessageToFooter("Zuletzt gespeichert: " + new Date().toString(),false);
 | 
					        String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("save");
 | 
				
			||||||
 | 
					        factoryDecorator.printMessageToFooter(msg + new Date().toString(),false);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,7 +72,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            if(fileIO.tournamentExists(name)){
 | 
					            if(fileIO.tournamentExists(name)){
 | 
				
			||||||
                //TODO:Logger
 | 
					                //TODO:Logger
 | 
				
			||||||
                factoryDecorator.printMessageToFooter("Turniername existiert bereits",true);
 | 
					                String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("tournamentExists");
 | 
				
			||||||
 | 
					                factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            Tournament tournament = new Tournament(name, type);
 | 
					            Tournament tournament = new Tournament(name, type);
 | 
				
			||||||
| 
						 | 
					@ -81,16 +83,19 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
        } catch (InvalidNameException e) {
 | 
					        } catch (InvalidNameException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            //TODO: Logger
 | 
					            //TODO: Logger
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Invalider Turniername",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidName");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        } catch (Tournament.InvalidTypeException e) {
 | 
					        } catch (Tournament.InvalidTypeException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            //TODO: Logger
 | 
					            //TODO: Logger
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Turniermodus nicht moeglich",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidMode");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } catch (IOException e) {
 | 
					        } catch (IOException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            //TODO: Logger
 | 
					            //TODO: Logger
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Fehler bei Dateizugriff",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("IOException");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -102,7 +107,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            informListener();
 | 
					            informListener();
 | 
				
			||||||
        } catch (IOException e) {
 | 
					        } catch (IOException e) {
 | 
				
			||||||
            e.printStackTrace();  //TODO handle and logging
 | 
					            e.printStackTrace();  //TODO handle and logging
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Fehler bei Dateizugriff",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("IOException");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -113,7 +119,8 @@ 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 muss mindestens 4 betragen und eine Potenz von 2 sein.",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("numberParticipant");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        informListener();
 | 
					        informListener();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -125,13 +132,16 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            informListener();
 | 
					            informListener();
 | 
				
			||||||
        } catch (InvalidNameException e) {
 | 
					        } catch (InvalidNameException e) {
 | 
				
			||||||
            e.printStackTrace(); //TODO handle and logging
 | 
					            e.printStackTrace(); //TODO handle and logging
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Invalider Teilnehmername",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidName");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        } 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);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidPhone");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        } catch (Player.InvalidDateException e) {
 | 
					        } catch (Player.InvalidDateException e) {
 | 
				
			||||||
            e.printStackTrace();
 | 
					            e.printStackTrace();
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Ungueltiges Geburtsdatum", true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidDate");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,8 +152,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            informListener();
 | 
					            informListener();
 | 
				
			||||||
        } catch (Tournament.ParticipantNotExistsException e) {
 | 
					        } catch (Tournament.ParticipantNotExistsException e) {
 | 
				
			||||||
            e.printStackTrace(); //TODO handle and logging
 | 
					            e.printStackTrace(); //TODO handle and logging
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Teilnehmer existiert nicht",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("participantNotExist");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,7 +164,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            informListener();
 | 
					            informListener();
 | 
				
			||||||
        } catch (InvalidNameException e) {
 | 
					        } catch (InvalidNameException e) {
 | 
				
			||||||
            e.printStackTrace(); //TODO handle and logging
 | 
					            e.printStackTrace(); //TODO handle and logging
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Invalider Ortsname",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("invalidName");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,7 +176,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            informListener();
 | 
					            informListener();
 | 
				
			||||||
        } catch (Tournament.PlaceNotExistsException e) {
 | 
					        } catch (Tournament.PlaceNotExistsException e) {
 | 
				
			||||||
            e.printStackTrace(); //TODO handle and logging
 | 
					            e.printStackTrace(); //TODO handle and logging
 | 
				
			||||||
            factoryDecorator.printMessageToFooter("Ort existiert nicht",true);
 | 
					            String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("placeNotExist");
 | 
				
			||||||
 | 
					            factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -190,7 +202,8 @@ public class TournamentDecorator implements IsObservable{
 | 
				
			||||||
            } catch (IOException e) {
 | 
					            } catch (IOException e) {
 | 
				
			||||||
                e.printStackTrace();
 | 
					                e.printStackTrace();
 | 
				
			||||||
                Platform.runLater(() -> {
 | 
					                Platform.runLater(() -> {
 | 
				
			||||||
                    factoryDecorator.printMessageToFooter("Datenzugriff nicht moeglich",true);
 | 
					                    String msg = factoryDecorator.getLanguageConfigurator().getSelectedLanguage("IOException");
 | 
				
			||||||
 | 
					                    factoryDecorator.printMessageToFooter(msg, true);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +1,33 @@
 | 
				
			||||||
package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
 | 
					package ch.zhaw.projekt2.turnierverwaltung.main.gameScheduleView;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ch.zhaw.projekt2.turnierverwaltung.LanguageConfigurator;
 | 
				
			||||||
import javafx.scene.control.Alert;
 | 
					import javafx.scene.control.Alert;
 | 
				
			||||||
import javafx.scene.control.ButtonBar;
 | 
					import javafx.scene.control.ButtonBar;
 | 
				
			||||||
import javafx.scene.control.ButtonType;
 | 
					import javafx.scene.control.ButtonType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class AlertNewSchedule extends Alert {
 | 
					public class AlertNewSchedule extends Alert {
 | 
				
			||||||
    private ButtonType yesButton = new ButtonType("Ja", ButtonBar.ButtonData.YES);
 | 
					    private ButtonType yesButton;
 | 
				
			||||||
    private ButtonType noButton = new ButtonType("Nein", ButtonBar.ButtonData.NO);
 | 
					    private ButtonType noButton;
 | 
				
			||||||
    private boolean result;
 | 
					    private Boolean result;
 | 
				
			||||||
 | 
					    private String yes;
 | 
				
			||||||
 | 
					    private String no;
 | 
				
			||||||
 | 
					    private String titleDelete;
 | 
				
			||||||
 | 
					    private String headerDelete;
 | 
				
			||||||
 | 
					    private String contentDelete;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public AlertNewSchedule() {
 | 
					    public AlertNewSchedule(LanguageConfigurator languageConfigurator){
 | 
				
			||||||
        super(AlertType.WARNING);
 | 
					        super(Alert.AlertType.WARNING);
 | 
				
			||||||
        setTitle("Neu erstellen");
 | 
					        yes = languageConfigurator.getSelectedLanguage("yes");
 | 
				
			||||||
        setHeaderText("Spielplan neu erstellen?");
 | 
					        no = languageConfigurator.getSelectedLanguage("no");
 | 
				
			||||||
        setContentText("Sind Sie sicher, dass Sie den Spielplan neu erstellen moechten?\nAlle Spielfortschritte gehen daraufhin verloren!");
 | 
					        titleDelete = languageConfigurator.getSelectedLanguage("titleSchedule");
 | 
				
			||||||
        getButtonTypes().setAll(yesButton,noButton);
 | 
					        headerDelete = languageConfigurator.getSelectedLanguage("headerSchedule");
 | 
				
			||||||
 | 
					        contentDelete = languageConfigurator.getSelectedLanguage("contentSchedule");
 | 
				
			||||||
 | 
					        yesButton = new ButtonType(yes, ButtonBar.ButtonData.YES);
 | 
				
			||||||
 | 
					        noButton = new ButtonType(no, ButtonBar.ButtonData.NO);
 | 
				
			||||||
 | 
					        setTitle(titleDelete);
 | 
				
			||||||
 | 
					        setHeaderText(headerDelete);
 | 
				
			||||||
 | 
					        setContentText(contentDelete);
 | 
				
			||||||
 | 
					        getButtonTypes().setAll(yesButton, noButton);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public boolean showAndGetResult() {
 | 
					    public boolean showAndGetResult() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ public class GameScheduleController extends FXController {
 | 
				
			||||||
    @FXML
 | 
					    @FXML
 | 
				
			||||||
    void createNewSchedule(ActionEvent event) {
 | 
					    void createNewSchedule(ActionEvent event) {
 | 
				
			||||||
        if (getTournamentDecorator().getTournament().getGameList().size() > 0) {
 | 
					        if (getTournamentDecorator().getTournament().getGameList().size() > 0) {
 | 
				
			||||||
            AlertNewSchedule alert = new AlertNewSchedule();
 | 
					            AlertNewSchedule alert = new AlertNewSchedule(getLanguageConfigurator());
 | 
				
			||||||
            if (alert.showAndGetResult()) {
 | 
					            if (alert.showAndGetResult()) {
 | 
				
			||||||
                getTournamentDecorator().createNewGameSchedule();
 | 
					                getTournamentDecorator().createNewGameSchedule();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +1,32 @@
 | 
				
			||||||
package ch.zhaw.projekt2.turnierverwaltung.main.tournamentList;
 | 
					package ch.zhaw.projekt2.turnierverwaltung.main.tournamentList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import ch.zhaw.projekt2.turnierverwaltung.LanguageConfigurator;
 | 
				
			||||||
import javafx.scene.control.Alert;
 | 
					import javafx.scene.control.Alert;
 | 
				
			||||||
import javafx.scene.control.ButtonBar;
 | 
					import javafx.scene.control.ButtonBar;
 | 
				
			||||||
import javafx.scene.control.ButtonType;
 | 
					import javafx.scene.control.ButtonType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class AlertDelete extends Alert {
 | 
					public class AlertDelete extends Alert {
 | 
				
			||||||
    ButtonType yesButton = new ButtonType("Ja", ButtonBar.ButtonData.YES);
 | 
					    ButtonType yesButton;
 | 
				
			||||||
    ButtonType noButton = new ButtonType("Nein", ButtonBar.ButtonData.NO);
 | 
					    ButtonType noButton;
 | 
				
			||||||
    Boolean result;
 | 
					    Boolean result;
 | 
				
			||||||
 | 
					    String yes;
 | 
				
			||||||
 | 
					    String no;
 | 
				
			||||||
 | 
					    String titleDelete;
 | 
				
			||||||
 | 
					    String headerDelete;
 | 
				
			||||||
 | 
					    String contentDelete;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public AlertDelete(String name){
 | 
					    public AlertDelete(LanguageConfigurator languageConfigurator){
 | 
				
			||||||
        super(Alert.AlertType.WARNING);
 | 
					        super(Alert.AlertType.WARNING);
 | 
				
			||||||
        setTitle("Entfernen");
 | 
					        yes = languageConfigurator.getSelectedLanguage("yes");
 | 
				
			||||||
        setHeaderText("Turnier entfernen?");
 | 
					        no = languageConfigurator.getSelectedLanguage("no");
 | 
				
			||||||
        setContentText("Sind Sie sicher, dass sie das Turnier " + name + " entfernen wollen?\n" +
 | 
					        titleDelete = languageConfigurator.getSelectedLanguage("titleDelete");
 | 
				
			||||||
                "Nach diesem Vorgang kann es nicht wiederhergestellt werden.");
 | 
					        headerDelete = languageConfigurator.getSelectedLanguage("headerDelete");
 | 
				
			||||||
 | 
					        contentDelete = languageConfigurator.getSelectedLanguage("contentDelete");
 | 
				
			||||||
 | 
					        yesButton = new ButtonType(yes, ButtonBar.ButtonData.YES);
 | 
				
			||||||
 | 
					        noButton = new ButtonType(no, ButtonBar.ButtonData.NO);
 | 
				
			||||||
 | 
					        setTitle(titleDelete);
 | 
				
			||||||
 | 
					        setHeaderText(headerDelete);
 | 
				
			||||||
 | 
					        setContentText(contentDelete);
 | 
				
			||||||
        getButtonTypes().setAll(yesButton, noButton);
 | 
					        getButtonTypes().setAll(yesButton, noButton);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ public class TournamentListController extends FXController {
 | 
				
			||||||
    @FXML
 | 
					    @FXML
 | 
				
			||||||
    void deleteTournament(ActionEvent event) {
 | 
					    void deleteTournament(ActionEvent event) {
 | 
				
			||||||
        FileIO.TournamentFile tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0);
 | 
					        FileIO.TournamentFile tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0);
 | 
				
			||||||
        AlertDelete alert = new AlertDelete(tournamentFile.toString());
 | 
					        AlertDelete alert = new AlertDelete(getLanguageConfigurator());
 | 
				
			||||||
        if(alert.showAndGetResult()){
 | 
					        if(alert.showAndGetResult()){
 | 
				
			||||||
           getTournamentDecorator().deleteTournament(tournamentFile);
 | 
					           getTournamentDecorator().deleteTournament(tournamentFile);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue