Logging and docs added in several classes #27 #28 #53

Merged
brandleo merged 13 commits from logging_and_docs into main 2022-05-13 22:54:04 +02:00
1 changed files with 24 additions and 6 deletions
Showing only changes of commit 92360ad607 - Show all commits

View File

@ -119,8 +119,8 @@ public class Factory {
* Method to load a Game View * Method to load a Game View
* @param box the box where the game view should be added. * @param box the box where the game view should be added.
* @param gameDecorator the gameDecorator instance of the game. * @param gameDecorator the gameDecorator instance of the game.
* @param factoryDecorator * @param factoryDecorator the factoryDecorator instance.
* @return * @return the controller of the GameView
*/ */
public GameController loadGameView(VBox box, GameDecorator gameDecorator, FactoryDecorator factoryDecorator) { public GameController loadGameView(VBox box, GameDecorator gameDecorator, FactoryDecorator factoryDecorator) {
try { try {
@ -136,6 +136,12 @@ public class Factory {
return null; return null;
} }
/**
* Method to print information for the user to the footer of mainwindow.
* @param pane the pane where the footer should be shown.
* @param msg the text to show.
* @param error true if it's a error message.
*/
public void printMessageToFooter(BorderPane pane, String msg, boolean error) { public void printMessageToFooter(BorderPane pane, String msg, boolean error) {
VBox bottom = (VBox) pane.getBottom(); VBox bottom = (VBox) pane.getBottom();
Label label = new Label(); Label label = new Label();
@ -164,9 +170,9 @@ public class Factory {
} }
/** /**
* * Method to remove the messages in the footer.
* @param pane * @param pane the pane were the footer should be reseted
* @param error * @param error true if the error message should be cleared.
*/ */
public void resetFooter(BorderPane pane,boolean error) { public void resetFooter(BorderPane pane,boolean error) {
VBox bottom = (VBox) pane.getBottom(); VBox bottom = (VBox) pane.getBottom();
@ -181,7 +187,7 @@ public class Factory {
} }
/** /**
* Enum for keeping the different fxml form views * Enum of all views which can be set to the center of the mainwindow.
*/ */
public enum View { public enum View {
tournamentList("tournamentList/tournamentList.fxml"), tournamentList("tournamentList/tournamentList.fxml"),
@ -192,6 +198,10 @@ public class Factory {
private String fxmlFileName; private String fxmlFileName;
private Pane pane; private Pane pane;
/**
* Constructor of View
* @param fxmlFileName The name of the FXML File to load.
*/
private View(String fxmlFileName) { private View(String fxmlFileName) {
this.fxmlFileName = fxmlFileName; this.fxmlFileName = fxmlFileName;
} }
@ -200,6 +210,14 @@ public class Factory {
return pane; return pane;
} }
/**
* Method to laod the view
* @param tournamentDecorator the tournamentDecorator object which will be passed to the controller.
* @param fileIO the fileIO object which will be passed to the controller.
* @param factoryDecorator the factoryDecorator object which will be passed to the controller.
* @param borderPane the borderPane object which will be passed to the controller.
* @throws IOException if the fxml file is not found or can not be loaded correctly.
*/
public void loadView(TournamentDecorator tournamentDecorator, FileIO fileIO, FactoryDecorator factoryDecorator, BorderPane borderPane) throws IOException { public void loadView(TournamentDecorator tournamentDecorator, FileIO fileIO, FactoryDecorator factoryDecorator, BorderPane borderPane) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFileName)); FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFileName));
this.pane = loader.load(); this.pane = loader.load();