/** Called when user click on the "new" button */
  @FXML
  private void handleNewPerson() {
    Person person = new Person();
    boolean okClicked = mainApp.showPersonEditDialog(person);

    if (okClicked) {
      mainApp.getPersonData().add(person);
    }
  }
  /**
   * Called when user clicked on the "edit" button. Opens a dialog to edit details for the selected
   * person
   */
  @FXML
  private void handleEditPerson() {
    Person person = personTable.getSelectionModel().getSelectedItem();

    if (person != null) {
      boolean okClicked = mainApp.showPersonEditDialog(person);
      if (okClicked) {
        showPersonDetails(person);
      }
    } else {
      // nothing selected
      Alert alert = new Alert(Alert.AlertType.ERROR);

      alert.setTitle("No selection");
      alert.setHeaderText("No person selected");
      alert.setContentText("Please select a person in the table");

      alert.showAndWait();
    }
  }