private StringBinding getAmountInArmoryAsStringBinding(EWeapon weapon) { return new StringBinding() { { super.bind(getAmountInArmory(weapon)); } @Override protected String computeValue() { ReadOnlyIntegerProperty amountInArmory = getAmountInArmory(weapon); return String.valueOf(amountInArmory.getValue()); } }; }
private StringBinding getAmountInArmoryAsStringBinding(EWeapon weapon) { return new StringBinding() { { super.bind(getAmountInArmory(weapon)); } @Override protected String computeValue() { ReadOnlyIntegerProperty amountInArmory = getAmountInArmory(weapon); return String.valueOf(amountInArmory.getValue()); } }; }
LevelBinding(ObjectBinding<ELevel> levelBinding) { this.levelBinding = levelBinding; super.bind(levelBinding); }
private void initStorageDestionationBinding() { if (storageDestinationBinding == null) { storageDestinationBinding = new StringBinding() { { super.bind(currentStorageIndex); } @Override protected String computeValue() { return messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.TavernWeaponsDealerDialog.tradingOffice", new Object[]{}, locale.getCurrentLocal()); } }; } }
/** * Create the binding for the buy price for the indicated ware. * @param ware for which to calculate the buy price * @param availableAmount available amount in the city * @return String binding representign the buy price. */ private StringBinding buyPrice(final IWare ware, final ReadOnlyIntegerProperty availableAmount) { return new StringBinding() { { super.bind(availableAmount); } @Override protected String computeValue() { return String.valueOf(computablePrice.buyPrice(ware, availableAmount, ONE_INT_BINDING)); } }; } /**
/** * Create a binding for the sell price for the indicated ware. * @param ware for which to calculate the sell price * @param availableAmount amount in the city * @return String binding for hte sell price. */ private StringBinding sellPrice(final IWare ware, final ReadOnlyIntegerProperty availableAmount) { return new StringBinding() { { super.bind(availableAmount); } @Override protected String computeValue() { return String.valueOf(computablePrice.sellPrice(ware, availableAmount, ONE_INT_BINDING)); } }; } }
/** * Create the binding for the buy price for the indicated ware. * @param ware to be bought * @param availableAmount available amount of the ware * @param amountToBuy amount to be bought * @return buy price for the amount */ private StringBinding buyPrice(final IWare ware, final ReadOnlyIntegerProperty availableAmount, final IntegerBinding amountToBuy) { return new StringBinding() { { super.bind(availableAmount, amountToBuy); } @Override protected String computeValue() { switch (type) { case PORT_CITY_TO_SHIP: case PORT_CITY_TO_STORAGE: if (availableAmount.get() > 0){ return String.valueOf(computablePrice.buyPrice(ware, availableAmount, amountToBuy)); } else { return "0"; // cannot buy anything if nothing is there } default: return "<"; } } }; } /**
return new StringBinding() { super.bind(availableAmount, amountToSell);
private HireButtonTextBinding(ITradingOffice office) { this.office = office; super.bind(office.storageManagerPresentBinding()); }
SimpleSailorOnShipBinding(ObjectProperty<IShip> currentShip) { super.bind(currentShip, currentShip.get().numberOfSailorsProperty()); this.currentShip = currentShip; } @Override
SailorOnShipBinding(ObjectProperty<IShip> currentShip) { super.bind(currentShip, currentShip.get().numberOfSailorsProperty()); this.currentShip = currentShip; } @Override
StringBinding firstLineBinding = new StringBinding() { super.bind(sailorState.numberOfSailorsProperty());
StringBinding labelBinding = new StringBinding() { super.bind(currentPosition);
ship.textProperty().bind(new StringBinding() { super.bind(currentShip);
StringBinding damageBinding = new StringBinding() { super.bind(currentShip);
StringBinding avgPriceStringBinding = new StringBinding() { super.bind(avgPriceProperty);