extracted Method delete Tournament in TournamentDecorator.java
This commit is contained in:
		
							parent
							
								
									61b943b091
								
							
						
					
					
						commit
						678060ecc0
					
				| 
						 | 
				
			
			@ -50,6 +50,15 @@ public class TournamentDecorator implements IsObservable{
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void deleteTournament(FileIO.TournamentFile tournamentFile){
 | 
			
		||||
        try {
 | 
			
		||||
            fileIO.deleteTournament(tournamentFile);
 | 
			
		||||
            informListener();
 | 
			
		||||
        } catch (IOException e) {
 | 
			
		||||
            e.printStackTrace();  //TODO handle and logging
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public void informListener() {
 | 
			
		||||
        for(IsObserver observer : listener) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,15 +67,10 @@ public class TournamentListController extends FXController {
 | 
			
		|||
 | 
			
		||||
    @FXML
 | 
			
		||||
    void deleteTournament(ActionEvent event) {
 | 
			
		||||
        File tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0);
 | 
			
		||||
        FileIO.TournamentFile tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0);
 | 
			
		||||
        AlertDelete alert = new AlertDelete(tournamentFile.toString());
 | 
			
		||||
        if(alert.showAndGetResult()){
 | 
			
		||||
            try {
 | 
			
		||||
                getFileIO().deleteTournament(tournamentFile);
 | 
			
		||||
                loadContent();
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
                e.printStackTrace();  //TODO handle and logging
 | 
			
		||||
            }
 | 
			
		||||
           getTournamentDecorator().deleteTournament(tournamentFile);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue