Logging and docs #57

Merged
schrom01 merged 3 commits from logging_and_docs into main 2022-05-13 23:57:50 +02:00
3 changed files with 31 additions and 6 deletions
Showing only changes of commit 003f065662 - Show all commits

View File

@ -70,7 +70,7 @@ public class Factory {
view.loadView(tournamentDecorator, fileIO, factoryDecorator, pane);
} catch (IOException e) {
e.printStackTrace();
//TODO Handle and logging.
logger.warning("failed to load views.");
}
}
}
@ -82,6 +82,7 @@ public class Factory {
public void showTournamentList(BorderPane pane) {
tournamentDecorator.setTournament(null);
setCenterOfBorderPane(pane, View.tournamentList);
logger.fine("showing Tournament List");
}
/**
@ -90,6 +91,7 @@ public class Factory {
*/
public void showParticipantFormular(BorderPane pane) {
setCenterOfBorderPane(pane, View.participantFormular);
logger.fine("showing Participant Formular");
}
/**
@ -98,6 +100,7 @@ public class Factory {
*/
public void showPlacesFormular(BorderPane pane) {
setCenterOfBorderPane(pane, View.placesFormular);
logger.fine("showing Places Formular");
}
/**
@ -106,6 +109,7 @@ public class Factory {
*/
public void showGameScheduler(BorderPane pane) {
setCenterOfBorderPane(pane, View.gameScheduler);
logger.fine("showing Game Scheduler");
}
/**
@ -132,6 +136,7 @@ public class Factory {
box.getChildren().add(loader.load());
GameController controller = loader.getController();
controller.setup(tournamentDecorator, fileIO, factoryDecorator, box, gameDecorator, languageConfigurator);
logger.fine("loaded game view");
return controller;
} catch (IOException e) {
logger.warning("Fatal error program can not continue after this: " + e );
@ -147,6 +152,7 @@ public class Factory {
* @param error true if it's a error message.
*/
public void printMessageToFooter(BorderPane pane, String msg, boolean error) {
logger.fine("message is printed to footer of window.");
VBox bottom = (VBox) pane.getBottom();
Label label = new Label();
VBox innerVbox;
@ -179,6 +185,7 @@ public class Factory {
* @param error true if the error message should be cleared.
*/
public void resetFooter(BorderPane pane,boolean error) {
logger.fine("messages are removed from footer of window.");
VBox bottom = (VBox) pane.getBottom();
VBox vBox;
if (error) {

View File

@ -140,11 +140,20 @@ public class FactoryDecorator implements IsObservable {
informListener();
}
/**
* Initializes the view of gameSchedule
*/
public void openScheduleView() {
factory.showGameScheduler((BorderPane) pane);
informListener();
}
/**
* Method to load all game views to show.
* @param hBoxCenter the box where the games should be shown.
* @param tournamentDecorator the tournamentDecorator to communicate to tournament
* @param treeView true if the games should be arranged like a tree.
*/
public void loadGameList(HBox hBoxCenter, TournamentDecorator tournamentDecorator, boolean treeView) {
hBoxCenter.getChildren().clear();
@ -194,6 +203,13 @@ public class FactoryDecorator implements IsObservable {
}
}
/**
* Method to draw the lines between the game views in the tree view.
* @param gameVBox the box with the games where lines should be drawn.
* @param gameBoxHeight the heigth of a single game box.
* @param lineLength the length of the horizontal lines.
* @return a box which contains the drawn lines.
*/
public VBox drawLines(VBox gameVBox, double gameBoxHeight, double lineLength) {
VBox completeLineVBox = new VBox();
completeLineVBox.setAlignment(Pos.CENTER_LEFT);
@ -227,8 +243,8 @@ public class FactoryDecorator implements IsObservable {
/**
* Method Initializes the Game View, in order to do that a vbox is needed and the gameDecorator
* @param vBox used for display
* @param gameDecorator
* @return
* @param gameDecorator the gameDecorator Object to communicate with game
* @return the controller of the loaded game view.
*/
public GameController openGameView(VBox vBox, GameDecorator gameDecorator) {
@ -255,9 +271,10 @@ public class FactoryDecorator implements IsObservable {
factory.resetFooter((BorderPane) pane, error);
}
/**
* getter Method of languageConfigurator
* @return the languageConfigurator object.
*/
public LanguageConfigurator getLanguageConfigurator() {
return factory.getLanguageConfigurator();
}

View File

@ -10,6 +10,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class TournamentDecorator implements IsObservable{
private Tournament tournament;
private FileIO fileIO;