implemented Button and Method deleteTournament in Tournament List
This commit is contained in:
		
							parent
							
								
									a3bd207610
								
							
						
					
					
						commit
						58b1692181
					
				| 
						 | 
					@ -36,6 +36,9 @@ public class TournamentListController extends FXController {
 | 
				
			||||||
    @FXML
 | 
					    @FXML
 | 
				
			||||||
    private Button openBtn;
 | 
					    private Button openBtn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @FXML
 | 
				
			||||||
 | 
					    private Button deleteBtn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @FXML
 | 
					    @FXML
 | 
				
			||||||
    private Label tournamentListTitle;
 | 
					    private Label tournamentListTitle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,6 +85,17 @@ public class TournamentListController extends FXController {
 | 
				
			||||||
        } //TODO handle and logging
 | 
					        } //TODO handle and logging
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @FXML
 | 
				
			||||||
 | 
					    void deleteTournament(ActionEvent event) {
 | 
				
			||||||
 | 
					        //TODO Ask first to delete?
 | 
				
			||||||
 | 
					        File tournamentFile = tournamentListView.getSelectionModel().getSelectedItems().get(0);
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            getFileIO().deleteTournament(tournamentFile);
 | 
				
			||||||
 | 
					        } catch (IOException e) {
 | 
				
			||||||
 | 
					            e.printStackTrace();  //TODO handle and logging
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void loadContent() {
 | 
					    public void loadContent() {
 | 
				
			||||||
        tournamentListView.setItems(getFileIO().getList());
 | 
					        tournamentListView.setItems(getFileIO().getList());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,11 +22,15 @@
 | 
				
			||||||
                        <Insets />
 | 
					                        <Insets />
 | 
				
			||||||
                    </VBox.margin>
 | 
					                    </VBox.margin>
 | 
				
			||||||
                </ListView>
 | 
					                </ListView>
 | 
				
			||||||
                <Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen">
 | 
					            <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0">
 | 
				
			||||||
                    <VBox.margin>
 | 
					               <VBox.margin>
 | 
				
			||||||
                        <Insets bottom="20.0" top="40.0" />
 | 
					                  <Insets bottom="20.0" top="40.0" />
 | 
				
			||||||
                    </VBox.margin>
 | 
					               </VBox.margin>
 | 
				
			||||||
                </Button>
 | 
					               <children>
 | 
				
			||||||
 | 
					                      <Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen" />
 | 
				
			||||||
 | 
					                  <Button fx:id="deleteBtn" layoutX="138.0" layoutY="28.0" mnemonicParsing="false" onAction="#deleteTournament" text="Löschen" />
 | 
				
			||||||
 | 
					               </children>
 | 
				
			||||||
 | 
					            </HBox>
 | 
				
			||||||
            </children>
 | 
					            </children>
 | 
				
			||||||
            <HBox.margin>
 | 
					            <HBox.margin>
 | 
				
			||||||
                <Insets left="40.0" />
 | 
					                <Insets left="40.0" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue