@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.title", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.text", new Object[]{ship.getName(), convoy.getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); OpenPatricianLargeWaxButton acceptBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.LeaveConvoyDialog.leave", new Object[]{}, locale.getCurrentLocal())); acceptBtn.getStyleClass().add("actionButton"); acceptBtn.setId("actionButton"); acceptBtn.setLayoutX(BUTTON_X); acceptBtn.setOnAction(createAcceptHandler(ship)); acceptBtn.setLayoutY(UPPER_BUTTON_Y); getContent().addAll(box, acceptBtn); }
@PostConstruct private void initializeModelAndDialog() { Table model = createModel(); if (model != null) { setModel(model); } final Optional<ITradingOffice> optOffice = city.getPlayer().findTradingOffice(city.getCity()); Preconditions.checkArgument(optOffice.isPresent(), "Ther must be a trading office present."); final ITradingOffice office = optOffice.get(); HBox box = new HBox(); box.setSpacing(15); box.setLayoutX(2*FRAME_BORDER); box.setLayoutY(CLOSE_BTN_Y_POS); Text label = new Text(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.AutomaticTradingOverviewDialog.office.manager", new Object[]{}, locale.getCurrentLocal())); label.getStyleClass().add("dialogText"); box.getChildren().add(label); OpenPatricianLargeWaxButton hireButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.AutomaticTradingOverviewDialog.hire", new Object[]{}, locale.getCurrentLocal())); hireButton.getStyleClass().add("actionButton"); hireButton.textProperty().bind(new HireButtonTextBinding(office)); hireButton.onActionProperty().bind(new HireActionBinding(office)); box.getChildren().add(hireButton); getContent().add(box); } private Table createModel() {
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.title", new Object[]{informant.getName()}, locale.getCurrentLocal())); String loadedText = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.dialog", new Object[0], locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); final int price = informant.getPrice(city.getPlayer()); parameters.put("price", price); DecoratedText dt = decoratedTextFactory.createDecoratedText(loadedText, parameters); final OpenPatricianLargeWaxButton acceptButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernInformantDialogPageOne.buy", new Object[]{}, locale.getCurrentLocal())); acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X); int LOWER_BUTTON_Y = CLOSE_BTN_Y_POS - 24; acceptButton.setLayoutY(LOWER_BUTTON_Y); acceptButton.setOnAction(mouseEvent -> { try { city.getPlayer().getCompany().updateCash(-price); clientEventBus.post(new ViewChangeEvent(MainGameView.class, EDialogType.TAVERN_INFORMANT_2)); } catch (RuntimeException e) { logger.error("Failed to accept informant offer", e); } }); getContent().addAll(dt, acceptButton); }
private void initializeDissolveConvoyDialog(IConvoy vessel) { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.dissolveTitle", new Object[]{}, locale.getCurrentLocal())); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.areYouSure", new Object[]{vessel.getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); final int actionButtonX = (WIDTH - 124) / 2; String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.sea.ConvoyDialog.dissolve", new Object[]{}, locale.getCurrentLocal()); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("dissolve"); ICity city = viewState.getCurrentCityProxy().get().getCity(); action.setOnAction(dissolve(vessel, city)); action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); getContent().addAll(box, action); }
new Object[]{}, locale.getCurrentLocal()); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("offerShip"); Pane centeredButton = dialogHelper.center(action);
@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); }
if (buttonTemplate.isLargeButton()) { OpenPatricianLargeWaxButton btn = new OpenPatricianLargeWaxButton(s); btn.getStyleClass().add("actionButton"); btn.setOnAction((evt) -> { try {
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.title", new Object[]{}, locale.getCurrentLocal())); IHumanPlayer player = city.getPlayer(); ICity city = this.city.getCity(); int fee = guildService.getEntryFee(player); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.text", new Object[]{city.getName(), player.getName(), player.getLastName(), fee}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); VBox box = new VBox(text); String s = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.JoinGuildDialog.joinBtn", new Object[]{}, locale.getCurrentLocal()); OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("joinGuild"); final int actionButtonX = (WIDTH - 124) / 2; action.setLayoutX(actionButtonX); action.setLayoutY(CLOSE_BTN_Y_POS - 24); action.setOnAction(joinGuild(player, city, fee)); box.setLayoutX(50); box.setLayoutY(CLOSE_BTN_Y_POS - 500); getContent().addAll(box, action); }
protected final void initializeButtons(){ final BooleanBinding hasMorePersons = hasNextPersonBinding(); acceptBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); acceptBtn.getStyleClass().add("actionButton"); acceptBtn.setLayoutX(BUTTON_X); acceptBtn.setOnAction(createAcceptHandler()); OpenPatricianLargeWaxButton nextBtn = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.next", new Object[]{}, locale.getCurrentLocal())); nextBtn.getStyleClass().add("actionButton"); nextBtn.setLayoutX(BUTTON_X); nextBtn.setLayoutY(LOWER_BUTTON_Y);
new Object[]{nextAuction.getCurrentBid() + AuctionEngine.BID_DELTA}, locale.getCurrentLocal()); auctionBtn = new OpenPatricianLargeWaxButton(s); auctionBtn.getStyleClass().add("actionButton"); auctionBtn.setId("auctionButton"); Pane centeredAuction = dialogHelper.center(auctionBtn);
next.setOnAction(createNextAction()); OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setId("action"); action.setOnAction(createAction(tasks.get(currentIndex.get()), aldermanOffice)); meetings.getStyleClass().add("actionButton"); meetings.setId("meetings"); meetings.setOnAction(createMeetingsAction());
action.getStyleClass().add("actionButton"); action.setOnAction(getAction(contract)); action.setLayoutX(actionButtonX); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(minStrength, refund)); action.setLayoutX(actionButtonX);
@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); }
action.getStyleClass().add("actionButton"); action.setOnAction(getAction(church)); action.setLayoutX(actionButtonX);
String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.TreasuryDialog.withdraw", new Object[]{}, locale.getCurrentLocal()); OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(template); action.getStyleClass().add("actionButton"); action.setId("withdrawlButton"); selectionBox.getChildren().addAll(moneyTransfer, action);
action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX);
action.getStyleClass().add("actionButton"); action.setId("donateButton");
acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X);
action.getStyleClass().add("actionButton"); action.setOnAction(getAction()); action.setLayoutX(actionButtonX);
acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2; acceptButton.setLayoutX(BUTTON_X);