java docs in Factory.java
This commit is contained in:
parent
f94572c1fe
commit
30ae77a11d
|
@ -13,7 +13,7 @@ import java.io.IOException;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class to load the views from FXML Files and switch between the views.
|
||||
*/
|
||||
public class Factory {
|
||||
private TournamentDecorator tournamentDecorator;
|
||||
|
@ -21,16 +21,29 @@ public class Factory {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(Factory.class.getCanonicalName());
|
||||
|
||||
/**
|
||||
* Contructor to create Factory instance.
|
||||
* @param fileIO the fileIO instance which saves and reads the tournament from files.
|
||||
* @param tournamentDecorator the touramanetDecorator class to access the tournament.
|
||||
*/
|
||||
public Factory(FileIO fileIO, TournamentDecorator tournamentDecorator) {
|
||||
this.fileIO = fileIO;
|
||||
this.tournamentDecorator = tournamentDecorator;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter Method of tournament
|
||||
* @param tournament the new tournament Object.
|
||||
*/
|
||||
public void setTournament(Tournament tournament) {
|
||||
this.tournamentDecorator.setTournament(tournament);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to load the main Window (without the content in the center)
|
||||
* @return the boarder Pane which is loaded.
|
||||
*/
|
||||
public BorderPane loadMainWindow() {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("mainWindow.fxml"));
|
||||
try {
|
||||
|
@ -42,6 +55,11 @@ public class Factory {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class which loads all views of Enum View
|
||||
* @param factoryDecorator the FactoryDecorator which is used to setup the controller.
|
||||
* @param pane the pane where the loaded view will be visible
|
||||
*/
|
||||
public void loadAllViews(FactoryDecorator factoryDecorator, BorderPane pane){
|
||||
for(View view : View.values()){
|
||||
try {
|
||||
|
@ -53,32 +71,57 @@ public class Factory {
|
|||
}
|
||||
}
|
||||
|
||||
public void showTournamentList(BorderPane pane, FactoryDecorator factoryDecorator) {
|
||||
/**
|
||||
* Method to show the view TournamentList
|
||||
* @param pane the Pane where the View will be visible
|
||||
*/
|
||||
public void showTournamentList(BorderPane pane) {
|
||||
tournamentDecorator.setTournament(null);
|
||||
setCenterOfBorderPane(pane, View.tournamentList);
|
||||
}
|
||||
|
||||
//Can be used to Open new Scene in same Stage.
|
||||
//This way possible to later give object to Controller
|
||||
public void showParticipantFormular(BorderPane pane, FactoryDecorator factoryDecorator) {
|
||||
/**
|
||||
* Method to show the view ParticipantFormular
|
||||
* @param pane the Pane where the View will be visible
|
||||
*/
|
||||
public void showParticipantFormular(BorderPane pane) {
|
||||
setCenterOfBorderPane(pane, View.participantFormular);
|
||||
}
|
||||
|
||||
public void showPlacesFormular(BorderPane pane, FactoryDecorator factoryDecorator) {
|
||||
/**
|
||||
* Method to show the view PlacesFormular
|
||||
* @param pane the Pane where the View will be visible
|
||||
*/
|
||||
public void showPlacesFormular(BorderPane pane) {
|
||||
setCenterOfBorderPane(pane, View.placesFormular);
|
||||
}
|
||||
|
||||
public void showGameScheduler(BorderPane pane, FactoryDecorator factoryDecorator) {
|
||||
/**
|
||||
* Method to show the view GameScheduler
|
||||
* @param pane the Pane where the View will be visible
|
||||
*/
|
||||
public void showGameScheduler(BorderPane pane) {
|
||||
setCenterOfBorderPane(pane, View.gameScheduler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to change the view in the center of the boarder pane in the mainWindow
|
||||
* @param pane the Pane where the View will be visible
|
||||
* @param view the view which should be visible
|
||||
*/
|
||||
private void setCenterOfBorderPane(BorderPane pane, View view) {
|
||||
FXController controller = null;
|
||||
pane.setCenter(view.getPane());
|
||||
resetFooter(pane, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to load a Game View
|
||||
* @param box the box where the game view should be added.
|
||||
* @param gameDecorator the gameDecorator instance of the game.
|
||||
* @param factoryDecorator
|
||||
* @return
|
||||
*/
|
||||
public GameController loadGameView(VBox box, GameDecorator gameDecorator, FactoryDecorator factoryDecorator) {
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("gameScheduleView/Game.fxml"));
|
||||
|
|
|
@ -116,7 +116,7 @@ public class FactoryDecorator implements IsObservable {
|
|||
*/
|
||||
public void openTournamentList() {
|
||||
logger.fine("Showing TournamentList view");
|
||||
factory.showTournamentList((BorderPane) pane, this);
|
||||
factory.showTournamentList((BorderPane) pane);
|
||||
informListener();
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class FactoryDecorator implements IsObservable {
|
|||
*/
|
||||
public void openParticipantForm() {
|
||||
logger.fine("Showing participant form view");
|
||||
factory.showParticipantFormular((BorderPane) pane, this);
|
||||
factory.showParticipantFormular((BorderPane) pane);
|
||||
informListener();
|
||||
}
|
||||
|
||||
|
@ -134,12 +134,12 @@ public class FactoryDecorator implements IsObservable {
|
|||
*/
|
||||
public void openPlacesForm() {
|
||||
logger.fine("Showing places form view");
|
||||
factory.showPlacesFormular((BorderPane) pane, this);
|
||||
factory.showPlacesFormular((BorderPane) pane);
|
||||
informListener();
|
||||
}
|
||||
|
||||
public void openScheduleView() {
|
||||
factory.showGameScheduler((BorderPane) pane, this);
|
||||
factory.showGameScheduler((BorderPane) pane);
|
||||
informListener();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue