diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/participantAddFormular/ParticipantFormularController.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/participantAddFormular/ParticipantFormularController.java index 64a010b..b6562e3 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/participantAddFormular/ParticipantFormularController.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/main/participantAddFormular/ParticipantFormularController.java @@ -14,6 +14,11 @@ import javafx.scene.input.MouseEvent; import javafx.scene.layout.GridPane; import javafx.scene.layout.VBox; +import java.util.logging.Logger; + +/** + * Controller of Participant + */ public class ParticipantFormularController extends FXController { @FXML @@ -68,8 +73,14 @@ public class ParticipantFormularController extends FXController { @FXML private Button saveBtn; + private static final Logger logger = Logger.getLogger(ParticipantFormularController.class.getCanonicalName()); + + /** + * Shares GUI Elements with the LanguageConfigurator + */ @Override public void shareGUIElementWithLanguageConfigurator() { + logger.fine("sharing GUI Elements"); getLanguageConfigurator().recieveLabel(participantListTitle); getLanguageConfigurator().recieveLabel(closeBtn); getLanguageConfigurator().recieveLabel(deleteBtn); @@ -81,8 +92,11 @@ public class ParticipantFormularController extends FXController { getLanguageConfigurator().recieveLabel(saveBtn); } + /** + * Changes the current selection + */ @FXML - void changedSelection(MouseEvent event){ + void changedSelection(){ Player participant = (Player) participantListView.getSelectionModel().getSelectedItems().get(0); participantNameTextField.setText(participant.getName()); firstNameTextField.setText(participant.getFirstName()); @@ -90,12 +104,18 @@ public class ParticipantFormularController extends FXController { birthDateTextField.setText(participant.getFormattedDateOfBirth()); } + /** + * Saves a new Participant and clears form + */ @FXML - void saveParticipant(ActionEvent event) { + void saveParticipant() { getTournamentDecorator().savePlayer(firstNameTextField.getText(), participantNameTextField.getText(), phoneNumberTextField.getText(), birthDateTextField.getText()); clearFormular(); } + /** + * Clears current form + */ private void clearFormular() { firstNameTextField.clear(); participantNameTextField.clear(); @@ -103,19 +123,30 @@ public class ParticipantFormularController extends FXController { birthDateTextField.clear(); } + /** + * Deletes the selected participant. + */ @FXML - void delete(ActionEvent event) { + void delete() { Participant participant = participantListView.getSelectionModel().getSelectedItems().get(0); + logger.fine("deleting participant:" + participant); getTournamentDecorator().deleteParticipant(participant); } + /** + * Closes the participant form + */ @FXML - void close(ActionEvent event) { + void close() { getFactoryDecorator().openScheduleView(); } + /** + * Loads the previously saved content and puts it in the list + */ @Override public void loadContent() { + logger.fine("loading and placing it into the list"); Tournament tournament = getTournamentDecorator().getTournament(); if(tournament != null){ participantListView.setItems(tournament.getParticipants());