Last javadoc and logger implemented

This commit is contained in:
Leonardo Brandenberger 2022-05-13 23:56:26 +02:00
parent 1aa05d6251
commit c11d6f8ef7
1 changed files with 35 additions and 4 deletions

View File

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