コード例 #1
0
  /**
   * Sets the person to be edited in the dialog.
   *
   * @param person
   */
  public void setPerson(Person person) {
    this.person = person;

    firstNameField.setText(person.getFirstName());
    lastNameField.setText(person.getLastName());
    streetField.setText(person.getStreet());
    postalCodeField.setText(Integer.toString(person.getPostalCode()));
    cityField.setText(person.getCity());
    birthdayField.setOnAction(
        e -> {
          person.setBirthday(birthdayField.getValue());
        });
  }
コード例 #2
0
 /**
  * Método llamado cada vez que se selecciona un objeto de la tabla. Actualiza el form de
  * PersonOverview
  *
  * @param person el objeto de la lista seleccionado en la tabla
  */
 public void showPersonDetails(Person person) {
   if (person != null) {
     firstNameLabel.setText(person.getFirstName());
     lastNameLabel.setText(person.getLastName());
     streetLabel.setText(person.getStreet());
     postalCodeLabel.setText(String.valueOf(person.getPostalCode()));
     cityLabel.setText(person.getCity());
     birthdayLabel.setText(DateUtil.format(person.getBirthday()));
   } else {
     // Person is null, remove all the text.
     firstNameLabel.setText("");
     lastNameLabel.setText("");
     streetLabel.setText("");
     postalCodeLabel.setText("");
     cityLabel.setText("");
     birthdayLabel.setText("");
   }
 }
コード例 #3
0
  /**
   * Fills all text fields to show details about the person. If the specified person is null, all
   * text fields are cleared.
   *
   * @param person the person or null
   */
  private void showPersonDetails(Person person) {
    if (person != null) {
      // Fill the labels with info from the person object.
      firstNameLabel.setText(person.getFirstName());
      lastNameLabel.setText(person.getLastName());
      streetLabel.setText(person.getStreet());
      postalCodeLabel.setText(Integer.toString(person.getPostalCode()));
      cityLabel.setText(person.getCity());

      birthdayLabel.setText(DateUtil.format(person.getBirthday()));
      // birthdayLabel.setText(...);
    } else {
      // Person is null, remove all the text.
      firstNameLabel.setText("");
      lastNameLabel.setText("");
      streetLabel.setText("");
      postalCodeLabel.setText("");
      cityLabel.setText("");
      birthdayLabel.setText("");
    }
  }