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 { try {
FXMLLoader loader = new FXMLLoader(location); FXMLLoader loader = new FXMLLoader(location);
pane.setCenter(loader.load()); pane.setCenter(loader.load());
FXController controller = loader.getController();
controller.setup(tournament, this);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
//TODO handle and logging? //TODO handle and logging?

View File

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

View File

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

View File

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