@PostConstruct
private void initializeDialog() {
loaner = (LoanerState) loanerService.findLoaner(city.getCity());
setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.notice.NoticeBoardFactory.takeLoan", new Object[]{}, locale.getCurrentLocal()));
addDecoratedText("ch.sahits.game.openpatrician.display.dialog.LoanerTakeLoanDialog.dialogSubheading", "introText");
for (final ILoanProposal proposal : loaner.getLoanProposals()) {
int amount = proposal.getAmount();
int payback = (int) (amount * proposal.getInterest());
int duration = proposal.getDurationInWeeks();
String interest = String.format("%.1f", (proposal.getInterest() - 1) * 100);
final DecoratedText entry = addDecoratedText("ch.sahits.game.openpatrician.display.dialog.LoanerTakeLoanDialog.loanProposal", "proposal", amount, duration, payback, interest);
loans.add(entry);
entry.setOnMouseReleased(mouseEvent -> {
selectedProposal.setValue(proposal);
deactivateAll();
entry.applyStyle(SELECTED_STYLE);
});
entry.applyStyle(DEFAULT_NON_SELECTED_STYLE);
}
final OpenPatricianLargeWaxButton acceptBtn = addActionButton("ch.sahits.game.openpatrician.display.dialog.LoanerTakeLoanDialog.btnLabel", "actionBtn");
acceptBtn.setDisable(true);
selectedProposal.addListener((observableValue, oldProposal, newProposal) -> {
if (newProposal != null) {
acceptBtn.setDisable(false);
}
});
acceptBtn.setOnAction(createAcceptHandler());
}
private void deactivateAll() {