Fxml #8

Merged
fassband merged 31 commits from fxml into main 2022-04-30 18:09:54 +02:00
5 changed files with 27 additions and 3 deletions
Showing only changes of commit 7af48449e0 - Show all commits

View File

@ -0,0 +1,19 @@
package ch.zhaw.projekt2.turnierverwaltung;
public abstract class FXController {
Tournament tournament;
Factory factory;
public void setup(Tournament tournament, Factory factory){
this.tournament = tournament;
this.factory = factory;
}
protected Tournament getTournament() {
return tournament;
}
protected Factory getFactory() {
return factory;
}
}

View File

@ -51,6 +51,8 @@ public class Factory {
try {
FXMLLoader loader = new FXMLLoader(location);
pane.setCenter(loader.load());
FXController controller = loader.getController();
controller.setup(tournament, this);
} catch (IOException e) {
e.printStackTrace();
//TODO handle and logging?

View File

@ -1,9 +1,10 @@
package ch.zhaw.projekt2.turnierverwaltung.main;
import ch.zhaw.projekt2.turnierverwaltung.FXController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
public class MainWindowController {
public class MainWindowController extends FXController {
@FXML
void changeLangToGerman(ActionEvent event) {

View File

@ -1,5 +1,6 @@
package ch.zhaw.projekt2.turnierverwaltung.main.participantAddFormular;
import ch.zhaw.projekt2.turnierverwaltung.FXController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
@ -10,7 +11,7 @@ import javafx.scene.input.MouseEvent;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
public class participantFormularController {
public class participantFormularController extends FXController {
@FXML
private Button addBtn;

View File

@ -1,5 +1,6 @@
package ch.zhaw.projekt2.turnierverwaltung.main.tournamentList;
import ch.zhaw.projekt2.turnierverwaltung.FXController;
import ch.zhaw.projekt2.turnierverwaltung.main.MainWindow;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
@ -9,7 +10,7 @@ import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.layout.GridPane;
public class tournamentListController {
public class tournamentListController extends FXController {
@FXML
private Button createBtn;