Tournament list #11
|
@ -36,6 +36,9 @@ public class TournamentListController extends FXController {
|
|||
@FXML
|
||||
private Button openBtn;
|
||||
|
||||
@FXML
|
||||
private Button deleteBtn;
|
||||
|
||||
@FXML
|
||||
private Label tournamentListTitle;
|
||||
|
||||
|
@ -82,6 +85,17 @@ public class TournamentListController extends FXController {
|
|||
} //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
|
||||
public void loadContent() {
|
||||
tournamentListView.setItems(getFileIO().getList());
|
||||
|
|
|
@ -22,11 +22,15 @@
|
|||
<Insets />
|
||||
</VBox.margin>
|
||||
</ListView>
|
||||
<Button fx:id="openBtn" mnemonicParsing="false" onAction="#openTournament" text="Öffnen">
|
||||
<VBox.margin>
|
||||
<Insets bottom="20.0" top="40.0" />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
<HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0" spacing="20.0">
|
||||
<VBox.margin>
|
||||
<Insets bottom="20.0" top="40.0" />
|
||||
</VBox.margin>
|
||||
<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>
|
||||
<HBox.margin>
|
||||
<Insets left="40.0" />
|
||||
|
|
Loading…
Reference in New Issue