added pane to FXController.java
This commit is contained in:
parent
a103174739
commit
6245e32f73
|
@ -1,14 +1,18 @@
|
|||
package ch.zhaw.projekt2.turnierverwaltung;
|
||||
|
||||
import javafx.scene.layout.Pane;
|
||||
|
||||
public abstract class FXController {
|
||||
Tournament tournament;
|
||||
Factory factory;
|
||||
FileIO fileIO;
|
||||
Pane pane;
|
||||
|
||||
public void setup(Tournament tournament, FileIO fileIO, Factory factory){
|
||||
public void setup(Tournament tournament, FileIO fileIO, Factory factory, Pane pane){
|
||||
this.tournament = tournament;
|
||||
this.fileIO = fileIO;
|
||||
this.factory = factory;
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
public abstract void loadContent();
|
||||
|
@ -24,4 +28,8 @@ public abstract class FXController {
|
|||
protected Factory getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
protected Pane getPane() {
|
||||
return pane;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class Factory {
|
|||
FXMLLoader loader = new FXMLLoader(location);
|
||||
pane.setCenter(loader.load());
|
||||
controller = loader.getController();
|
||||
controller.setup(tournament, fileIO, this);
|
||||
controller.setup(tournament, fileIO, this, pane);
|
||||
controller.loadContent();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -11,7 +11,7 @@ import javafx.scene.input.MouseEvent;
|
|||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
public class participantFormularController extends FXController {
|
||||
public class ParticipantFormularController extends FXController {
|
||||
|
||||
@FXML
|
||||
private Button addBtn;
|
||||
|
@ -76,4 +76,8 @@ public class participantFormularController extends FXController {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContent() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package ch.zhaw.projekt2.turnierverwaltung.main.tournamentList;
|
||||
|
||||
import ch.zhaw.projekt2.turnierverwaltung.FXController;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.Factory;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.FileIO;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.Tournament;
|
||||
import ch.zhaw.projekt2.turnierverwaltung.main.MainWindow;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.collections.FXCollections;
|
||||
|
@ -12,9 +14,11 @@ import javafx.scene.control.Button;
|
|||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TournamentListController extends FXController {
|
||||
|
||||
|
@ -52,7 +56,15 @@ public class TournamentListController extends FXController {
|
|||
|
||||
@FXML
|
||||
void openTournament(ActionEvent event) {
|
||||
|
||||
try {
|
||||
File tournamentFile = tournierListView.getSelectionModel().getSelectedItems().get(0);
|
||||
getFactory().setTournament(getFileIO().loadTournament(tournamentFile));
|
||||
getFactory().loadParticipantFormular((BorderPane) getPane());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue