Ejemplo n.º 1
0
  @Override
  public void setFields(Shopping shopping) {
    this.shopping = shopping;

    priceField.setText(Double.toString(shopping.getPrice()));
    quantityField.setText(Integer.toString(shopping.getQuantity()));
  }
Ejemplo n.º 2
0
  @FXML
  private void handleOk() {
    if (isInputValid()) {
      shopping.setPrice(Double.parseDouble(priceField.getText()));
      shopping.setQuantity(Integer.parseInt(quantityField.getText()));
      shopping.setId(shopping.hashCode());
      double totalPrice = shopping.getPrice() * shopping.getQuantity();
      shopping.setTotalPrice(totalPrice);

      okClicked = true;
      dialogStage.close();
    }
  }