/** * Add the action button centered at the bottom. * @param textKey for the label on the button * @param id for the button * @return button */ public OpenPatricianLargeWaxButton addActionButton(String textKey, String id) { OpenPatricianLargeWaxButton button = new OpenPatricianLargeWaxButton(messageSource.getMessage(textKey, new Object[]{}, locale.getCurrentLocal())); button.setId(id); final int actionButtonX = (WIDTH - 124) / 2; button.setLayoutX(actionButtonX); button.setLayoutY(CLOSE_BTN_Y_POS - 24); getContent().add(button); return button; }
@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); }
final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setId("offerShip");
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); }
s = messageSource.getMessage(buttonTemplate.getLabelKey(), template.getMessageArgs(), locale.getCurrentLocal()); if (buttonTemplate.isLargeButton()) { OpenPatricianLargeWaxButton btn = new OpenPatricianLargeWaxButton(s); btn.getStyleClass().add("actionButton"); btn.setOnAction((evt) -> {
@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() { 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);
next.setId("next"); 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"); OpenPatricianLargeWaxButton meetings = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.meetings", new Object[]{}, locale.getCurrentLocal())); meetings.getStyleClass().add("actionButton"); meetings.setId("meetings");
getContent().add(text); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.OutriggerNoticeDialog.discharge", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(contract)); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(minStrength, refund));
@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); }
final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setOnAction(getAction(church));
OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(template); action.getStyleClass().add("actionButton"); action.setId("withdrawlButton");
final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(s); action.getStyleClass().add("actionButton"); action.setOnAction(getAction());
OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(template); action.getStyleClass().add("actionButton"); action.setId("donateButton");
final OpenPatricianLargeWaxButton acceptButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2;
next.setDisable(notices.size() <= 1); final OpenPatricianLargeWaxButton action = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); action.getStyleClass().add("actionButton"); action.setOnAction(getAction());
DecoratedText dt = decoratedTextFactory.createDecoratedText(loadedText, parameters); final OpenPatricianLargeWaxButton acceptButton = new OpenPatricianLargeWaxButton(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernBaseSideRoomPersonDialog.accept", new Object[]{}, locale.getCurrentLocal())); acceptButton.getStyleClass().add("actionButton"); int BUTTON_X = (WIDTH - 124) / 2;