this.model.memo.bind(descriptionEdit.textProperty());
this.model.address.bind(addressEdit.textProperty());
coverPhotoSiteLink.setText(COVERPHOTO_SITE);
ValidationLink goalValid = new ValidationLink(goalAmountEdit, str -> !LHUtils.didThrow(() -> valueOrThrow(str)));
goalAmountEdit.textProperty().addListener((obj, prev, cur) -> {
if (goalValid.isValid.get())
this.model.goalAmount.set(valueOrThrow(cur).value);
});
// Figure out the smallest pledge that is allowed based on the goal divided by number of inputs we can have.
model.minPledgeAmountProperty().addListener(o -> {
minPledgeEdit.setPromptText(model.getMinPledgeAmount().toPlainString());
});
ValidationLink minPledgeValue = new ValidationLink(minPledgeEdit, str -> {
if (str.isEmpty())
return true; // default is used
Coin coin = valueOrNull(str);
if (coin == null) return false;
Coin amount = model.getMinPledgeAmount();
// If min pledge == suggested amount it's ok, or if it's between min amount and goal.
return coin.equals(amount) || (coin.isGreaterThan(amount) && coin.isLessThan(Coin.valueOf(this.model.goalAmount.get())));
});
ValidationLink.autoDisableButton(nextButton,
goalValid,
new ValidationLink(titleEdit, str -> !str.isEmpty()),
minPledgeValue);
roundCorners(coverImageView, 10);
Label maxPledgesWarning = new Label(String.format("You can collect a maximum of %d pledges, due to limits in the Bitcoin protocol.", ProjectModel.MAX_NUM_INPUTS));