private void addBidLevelCountDown(VBox box, IAuction nextAuction, int index) { String template = getBidLevelTemplate(nextAuction); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("bidLevel-"+currentBidLevel.get()); box.getChildren().add(index, dt); }
@Override protected Group createFooterText() { int costs = calculateRepairCosts(); Group g = new Group(); String t = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.ShipyardConstructionDialogV2.totalSum", new Object[]{}, locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("price", costs); DecoratedText dt = decoratedTextFactory.createDecoratedText(t, parameters); dt.setId("totalPrice"); g.getChildren().add(dt); g.setId("footerText"); return g; }
private void addCurrentBidInformation(VBox box, IAuction nextAuction, int index) { if (nextAuction.getBiddingPlayer() == null) { // no bid String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.noBid", new Object[]{}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("noBid"); box.getChildren().add(index, dt); } else { // current bid IPlayer bidder = nextAuction.getBiddingPlayer(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.currentBid", new Object[]{nextAuction.getCurrentBid(), bidder.getName(), bidder.getLastName()}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("currentBid"); box.getChildren().add(index, dt); } box.getChildren().add(dialogHelper.createVerticalSpacer(20)); }
@Override protected Group createFooterText() { IntegerBinding totalPriceBinding = new IntegerBinding() { { for (EWare ware : MATERIALS) { RequiredWareCityStorage requiredWare = requirementsMap.get(ware); super.bind(requiredWare.buyPriceProperty()); } } @Override protected int computeValue() { return calculateTotalBuildCosts(); } }; Group g = new Group(); String t = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.ShipyardConstructionDialogV2.totalSum", new Object[]{}, locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("price", totalPriceBinding.get()); DecoratedText dt = decoratedTextFactory.createDecoratedText(t, parameters); dt.setId("totalSum"); g.getChildren().add(dt); g.setId("footerText"); return g; }
@Override protected Group createFooterText() { IntegerBinding totalPriceBinding = new IntegerBinding() { { // Bind to amount in office and in city for (EWare ware : MATERIALS) { RequiredWareCityStorage requiredWare = requirementsMap.get(ware); super.bind(requiredWare.buyPriceProperty()); } } @Override protected int computeValue() { return calculateTotalUpgradeCosts(); } }; Group g = new Group(); String t = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.ShipyardConstructionDialogV2.totalSum", new Object[]{}, locale.getCurrentLocal()); HashMap<String, Object> parameters = new HashMap<>(); parameters.put("price", totalPriceBinding.get()); DecoratedText dt = decoratedTextFactory.createDecoratedText(t, parameters); dt.setId("totalSum"); g.getChildren().add(dt); g.setId("footerText"); return g; }
private void addAuctionDescription(VBox box, IAuction nextAuction) { if (nextAuction instanceof IBuildingAuction) { IBuilding building = ((IBuildingAuction) nextAuction).getAuctionedBuilding(); IPlayer owner = nextAuction.getOwner().get(); String name = owner.getName()+" "+owner.getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.buildingAuction", new Object[]{modelTranslations.getLocalDisplayName(building), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("buildingAuction"); box.getChildren().add(dt); } else { IShip ship = ((IShipAuction)nextAuction).getAuctionedShip(); String name = ship.getOwner().getName()+" "+ship.getOwner().getLastName(); String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.AuctionGuildDialog.shipAuction", new Object[]{ship.getName(), name}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("shipAuction"); box.getChildren().add(dt); } box.getChildren().add(dialogHelper.createVerticalSpacer(20)); }
private ObjectProperty<DecoratedText> createWeaponStrength(IShip currentShip) { int strength = shipService.calculateShipsWeaponsStrength(currentShip); String key = null; if (strength > 0) { if (strength % 2 != 0) { if (strength == 1) { key = "ch.sahits.game.openpatrician.model.ship.impl.Ship.weaponStrengthOne"; } else { key = "ch.sahits.game.openpatrician.model.ship.impl.Ship.weaponStrengthUneven"; } } else { key = "ch.sahits.game.openpatrician.model.ship.impl.Ship.weaponStrengthEven"; } strength /= 2; String template = messageSource.getMessage(key, new Object[]{strength}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("weaponStrength"); return new SimpleObjectProperty<>(text); } else { return new SimpleObjectProperty<>(new DecoratedText()); } }
new Object[]{}, locale.getCurrentLocal()); final DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("registerShip"); box.getChildren().add(text); if (city.getPlayersNavalVessels().isEmpty()) { new Object[]{}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(template, new HashMap<>()); dt.setId("noShipInPort"); box.getChildren().add(dt); } else {
@PostConstruct private void initializeDialog() { setTitle(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.GuildMembersDialog.title", new Object[]{}, locale.getCurrentLocal())); ICity city = this.city.getCity(); IGuild guild = guildList.findGuild(city).get(); if (guild.getMembers().isEmpty()) { String template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.guild.GuildMembersDialog.noMembers", new Object[]{city.getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("noMembers"); box = new VBox(text); box.setLayoutY(CLOSE_BTN_Y_POS - 500); getContent().addAll(box); } else { List<IPlayer> members = guild.getMembers(); List<IItemNavigatorLabelWrapper<IPlayer>> wrappedList = itemWrapperFactory.createNonLabeledListForPlayer(members); ItemNavigator<IPlayer> itemNavigator = new ItemNavigator<>(wrappedList); initializeContent(itemNavigator); if (members.size() > 1) { Group centerPane = dialogHelper.center(itemNavigator); box.getChildren().addAll(dialogHelper.createVerticalSpacer(50), centerPane); } } }
private void addConvoyList(VBox box, List<IConvoy> presentConvoys, IShip ship) { VBox innerBox = new VBox(); int i = 0; for (IConvoy convoy : presentConvoys) { final String key = "ch.sahits.game.javafx.service.NoticeBoardShipSelectionMenuProvider.ship"; String loadedText = messageSource.getMessage(key, new Object[]{convoy.getName(), convoy.getCapacity()}, locale.getCurrentLocal()); DecoratedText dt = textFactory.createDecoratedText(loadedText, new HashMap<>()); dt.setId("convoy"+i); innerBox.getChildren().add(dt); dt.setOnMouseReleased(evt -> { convoy.addShip(ship); ship.parentShipProperty().setValue(convoy.getOrlegShip()); final ICityPlayerProxyJFX proxy = viewState.getCurrentCityProxy().get(); proxy.leave(ship); proxy.getPlayer().removeSelectableVessel(ship); executeOnCloseButtonClicked(); }); i++; } innerBox.setLayoutX(50); box.getChildren().add(innerBox); }
new Object[]{}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("noAuction"); box.getChildren().add(text); } else { new Object[]{modelTranslations.toDisplayString(date)}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("nextAuction"); box.getChildren().add(text);
template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.noPunishment", new Object[]{}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("noPunishment"); text.setOnMouseReleased((evt) -> { office.setViolation(Optional.empty()); template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.smallFine", new Object[]{fine}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("smallFine"); text.setOnMouseReleased((evt) -> { ((CityViolation) violation).setPunishment(ECityViolationPunishment.SMALL_FINE); template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.mediumFine", new Object[]{fine}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("mediumFine"); text.setOnMouseReleased((evt) -> { ((CityViolation) violation).setPunishment(ECityViolationPunishment.MEDIUM_FINE); template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.largeFine", new Object[]{fine}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("largeFine"); text.setOnMouseReleased((evt) -> { ((CityViolation) violation).setPunishment(ECityViolationPunishment.LARGE_FINE); template = messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.cityhall.AldermanOfficeDialog.boycott", new Object[]{fine}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("boycott"); text.setOnMouseReleased((evt) -> { ((CityViolation) violation).setPunishment(ECityViolationPunishment.BLOCKADE);
modelTranslations.toDisplayString(foundingDate), oldest.getCity().getName()}, locale.getCurrentLocal()); DecoratedText text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("summary"); box.getChildren().add(text); box.getChildren().add(new PlaceHolder(1, 30)); new Object[]{personalData.getAge(date.getCurrentDate())}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("age"); box.getChildren().add(text); new Object[]{spouseData.getName(), spouseData.getLastName(), spouseData.getBirthPlace().getName()}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("married"); box.getChildren().add(text); } else { new Object[]{personalData.getAge(date.getCurrentDate())}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("notMarried"); box.getChildren().add(text); new Object[]{offices.size(), member.getFleet().size()}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>()); text.setId("details"); box.getChildren().add(text); new Object[]{bestCity.getName()}, locale.getCurrentLocal()); text = textFactory.createDecoratedText(template, new HashMap<>());