Tournament list #11
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -46,6 +46,15 @@ public class FileIO {
 | 
			
		|||
        return tournamentFiles;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean tournamentExists(String name){
 | 
			
		||||
        for(TournamentFile file : getList()) {
 | 
			
		||||
            if(file.toString().toLowerCase().equals(name.toLowerCase())){
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param tournamentFile
 | 
			
		||||
     * @return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,11 +53,9 @@ public class TournamentListController extends FXController {
 | 
			
		|||
 | 
			
		||||
    @FXML
 | 
			
		||||
    void createTournament(ActionEvent event) {
 | 
			
		||||
        for(FileIO.TournamentFile file : getFileIO().getList()) {
 | 
			
		||||
            if(file.toString().equals(tournamentNameField.getText())){
 | 
			
		||||
                return; //TODO handle and logging
 | 
			
		||||
                // Tournament with same name exists already.
 | 
			
		||||
            }
 | 
			
		||||
        if(getFileIO().tournamentExists(tournamentNameField.getText())){
 | 
			
		||||
            System.out.println("Tournament with same name exists already.");
 | 
			
		||||
            return; //TODO handle and logging
 | 
			
		||||
        }
 | 
			
		||||
        try {
 | 
			
		||||
            Tournament tournament = new Tournament(tournamentNameField.getText(), modusChoiceBox.getValue());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue