@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.title", new Object[]{}, locale.getCurrentLocal())); ICity town = city.getCity(); IPlayer player = city.getPlayer(); resetContent(town, player); final int actionButtonX = (WIDTH - 124) / 2; final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TownInfoNotice.petition", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(box, action)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!canPosePetition(town, player)); // should be disabled when the petition cannot be posed getContent().addAll(action); clientServerEventBus.register(this); timerEventBus.register(this); }
@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() {
acceptBtn.setDisable(disableAcceptButton.get()); disableAcceptButton.addListener((observableValue, oldValue, newValue) -> acceptBtn.setDisable(newValue)); getContent().addAll(nextBtn, acceptBtn);
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchGiftDialog.title", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchGiftDialog.introText", new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); final ICompany company = city.getPlayer().getCompany(); moneyTransfer = fxUtils.getMoneyTransfer(imageLoader); moneyTransfer.setStepSize(500); moneyTransfer.maxTransfereableProperty().bind(company.cashProperty()); moneyTransfer.setAmount(0); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); moneyTransfer.setPadding(new Insets(100, 0, 0, 100)); box.getChildren().addAll(moneyTransfer); final int actionButtonX = (WIDTH - 124) / 2; String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.church.ChurchFeedingDialog.donate", new Object[]{}, locale.getCurrentLocal()); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding(); action.setDisable(!actionEnabled.get()); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue)); getContent().addAll(box, action); }
acceptBtn.setDisable(true); selectedDebt.addListener((observableValue, oldDebt, newDebt) -> { if (newDebt != null) { acceptBtn.setDisable(false);
ship.load(trader.getWare(), trader.getAmount(), trader.getAvgPricePerItem()); } else { acceptButton.setDisable(true); return; acceptButton.setDisable(true); return; acceptButton.setDisable(disable.get()); disable.addListener((observableValue, oldValue, newValue) -> acceptButton.setDisable(newValue));
action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding(); action.setDisable(!actionEnabled.get()); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue));
auctionBtn.setOnAction(event -> { try { auctionBtn.setDisable(true); EBidLevel current = currentBidLevel.get(); EBidLevel next = nextAuction.getBiddingPlayer() == null ? EBidLevel.INITIAL : calculateNextBidLevel(current);
acceptBtn.setDisable(true); selectedRequest.addListener((observableValue, oldRequest, newRequest) -> { if (newRequest != null) { acceptBtn.setDisable(false);
action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!capableShipPresent.get()); getContent().addAll(action); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!capableShipPresent.get()); capableShipPresent.addListener((observable, oldFlag, newFlag) -> action.setDisable(!newFlag));
action.setDisable(true); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue));
@Subscribe public void handleBidLevelChange(AuctionBidLevel change) { currentBidLevel.setValue(change.getNewLevel()); if (!change.getBidder().equals(city.getPlayer())) { auctionBtn.setDisable(false); } // update bid labels int index = dialogHelper.removeById(box, "noBid"); if (index < 0) { index = dialogHelper.removeById(box, "currentBid"); } addCurrentBidInformation(box, change.getAuction(), index); index = dialogHelper.removeById(box, "bidLevel-"+change.getOldLevel()); box.getChildren().remove(index); addBidLevelCountDown(box, change.getAuction(), index); if (change.getNewLevel() == EBidLevel.DONE) { auctionBtn.setVisible(false); clientEventBus.unregister(this); } else { String label = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.nextBid", new Object[]{change.getAuction().getCurrentBid() + AuctionEngine.BID_DELTA}, locale.getCurrentLocal()); auctionBtn.setText(label); } }
action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding(); action.setDisable(!actionEnabled.get()); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue));
action.setDisable(true); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue));
action.setDisable(!enableAction.get()); enableAction.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue)); getContent().add(action); timerEventBus.register(this);
acceptButton.setDisable(disable.get()); disable.addListener((observableValue, oldValue, newValue) -> acceptButton.setDisable(newValue));
action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setDisable(!enableAction.get()); enableAction.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue)); getContent().add(action);
action.setLayoutY(CLOSE_BTN_Y_POS - 24); BooleanBinding actionEnabled = actionEnabledBinding(); action.setDisable(!actionEnabled.get()); actionEnabled.addListener((observableValue, oldValue, newValue) -> action.setDisable(!newValue));