@Deprecated void addSublist(JFXListView<?> subList, int index) { if (!sublistsProperty.get().contains(subList)) { sublistsProperty.get().add(subList); sublistsIndices.put(index, subList); subList.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex(); } }); } }
public int getInitialWidth() { return initialWidth.get(); } public Font getFont() {
@Nonnull public static TextField textFieldIntegerReadonly(@Nonnull ReadOnlyIntegerProperty integerProperty, @Nonnull NumberStringConverterForIntegers integerConverter) { TextField textField = new TextField(); integerProperty.addListener((observable, oldValue, newValue) -> textField.setText(integerConverter.toString(newValue))); textField.setText(integerConverter.toString(integerProperty.get())); textField.setEditable(false); return textField; }
Text dealerAmount = new Text(); dealerAmount.getStyleClass().add("dialogText"); dealerAmount.textProperty().bind(dealerOwnedAmount.asString()); row.add(new ControlTableCell(dealerAmount)); OpenPatricianSmallWaxButton buyButton = new OpenPatricianSmallWaxButton(""); if (storage != null) { try { if (dealerOwnedAmount.get() > 0) { int amountToBuy = transferUtil.calculateAvailableAmount(movableAmount, dealerOwnedAmount.get()); int affordableAmount = computablePrice.calculateAffordableAmount(weapon, dealerOwnedAmount.get(), amountToBuy, city.getPlayer().getCompany().getCash());
weaponBuyBtn.disableProperty().bind(getAmountInArmory(weapon).greaterThan(0).not()); weaponBuyBtn.setId("buyWeapon"+weapon); weaponBuyBtn.textProperty().bind(weaponBuyPrice.asString()); weaponSellBtn.disableProperty().bind(weaponStorage.getWeaponProperty(weapon).greaterThan(0).not()); weaponSellBtn.setId("sellWeapon"+weapon); weaponSellBtn.textProperty().bind(weaponSellPrice.asString()); weaponsInStorage.valueProperty().bind(weaponStorage.getWeaponProperty(weapon).asString()); row.add(weaponsInStorage); return row;
@Override public void dispose() { control.getDockables().removeListener(dockablesChangeListener); tabPane.getTabs().removeListener(tabsChangeListener); control.getSelectionModel().selectedIndexProperty().removeListener(dockableSelectedIndexChangeListener); tabPane.getSelectionModel().selectedIndexProperty().removeListener(tabSelectedIndexChangeListener); control = null; tabPane = null; }
removeButton.disableProperty().bind(colorTable.getSelectionModel().selectedIndexProperty().greaterThan(-1).not());
@Override protected int computeValue() { return transferUtil.calculateAvailableAmount(movableAmount, maxAmount.get()); } };
IntegerBinding weaponPrice = buyPriceBinding(weapon); OpenPatricianSmallWaxButton weaponBuyBtn = new OpenPatricianSmallWaxButton(""); weaponBuyBtn.disableProperty().bind(getAmountInArmory(weapon).greaterThan(0).not()); weaponBuyBtn.setId("buyWeapon"+weapon); weaponBuyBtn.textProperty().bind(weaponPrice.asString()); weaponsInStorage.valueProperty().bind(weaponStorage.getWeaponProperty(weapon).asString()); row.add(weaponsInStorage); return row;
@Override public void dispose() { control.getDockables().removeListener(dockablesChangeListener); tabPane.getTabs().removeListener(tabsChangeListener); control.getSelectionModel().selectedIndexProperty().removeListener(dockableSelectedIndexChangeListener); tabPane.getSelectionModel().selectedIndexProperty().removeListener(tabSelectedIndexChangeListener); control = null; tabPane = null; }
this.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex();
@Override protected int computeValue() { return Math.max(0, needed.get() - stored.get()); } }
public DragableRepositoryListCell(BiConsumer<RepositoryLocation<? extends Repository>, Number> onDragDone) { super(); this.onDragDone = onDragDone; this.indexProperty().addListener(this); }
public int getVisibleLineCount() { return scroller.visibleLineCountProperty().get(); }
/** * */ public GridRow() { super(); getStyleClass().add("grid-row"); //$NON-NLS-1$ // we need to do this (or something similar) to allow for mouse wheel // scrolling, as the GridRow has to report that it is non-empty (which // is the second argument going into updateItem). indexProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { updateItem(null, getIndex() == -1); } }); }
@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 "<"; } } };
@Deprecated void addSublist(JFXListView<?> subList, int index) { if (!sublistsProperty.get().contains(subList)) { sublistsProperty.get().add(subList); sublistsIndices.put(index, subList); subList.getSelectionModel().selectedIndexProperty().addListener((o, oldVal, newVal) -> { if (newVal.intValue() != -1) { updateOverAllSelectedIndex(); } }); } }
/** * Retrieve the amount of weapons available in the armory. */ protected int getWeaponAmount(IArmory armory, EWeapon weapon) { switch (weapon) { case HAND_WEAPON: return armory.cutlassAmountProperty().get(); case BALLISTA_BIG: return armory.ballistaBigAmountProperty().get(); case BALLISTA_SMALL: return armory.ballistaSmallAmountProperty().get(); case TREBUCHET_BIG: return armory.trebuchetBigAmountProperty().get(); case TREBUCHET_SMALL: return armory.trebuchetSmallAmountProperty().get(); case BOMBARD: return armory.bombardAmountProperty().get(); case CANNON: return armory.canonAmountProperty().get(); default: throw new IllegalArgumentException("Unhandled weapon type: "+weapon); } }
indexProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { final GridView<T> gridView = getGridView();
private int getAmount(EWeapon weapon) { switch (weapon) { case SWORD: return armory.swordAmountProperty().get(); case BALLISTA_BIG: return armory.ballistaBigAmountProperty().get(); case BALLISTA_SMALL: return armory.ballistaSmallAmountProperty().get(); case BOMBARD: return armory.bombardAmountProperty().get(); case BOW: return armory.bowAmountProperty().get(); case CANNON: return armory.canonAmountProperty().get(); case CROSSBOW: return armory.crossbowAmountProperty().get(); case HAND_WEAPON: return armory.cutlassAmountProperty().get(); case MUSKET: return armory.musketAmountProperty().get(); case TREBUCHET_BIG: return armory.trebuchetBigAmountProperty().get(); case TREBUCHET_SMALL: return armory.trebuchetSmallAmountProperty().get(); default: return 0; } } }