@Override public DoubleBinding multiply(long other) { return getDelegate().multiply(other); }
/** * This is the snapXY method for using in a binding, for example: * p1.bind( snapXY( p2.multiply(0.1) )); * * @param position (x or y) * @return */ public static DoubleBinding snapXY(final ObservableNumberValue position) { return new DoubleBinding() { { super.bind(position); } @Override public void dispose() { super.unbind(position); } @Override protected double computeValue() { return NodeUtil.snapXY(position.doubleValue()); } @Override public ObservableList<?> getDependencies() { return FXCollections.singletonObservableList(position); } }; }
@Override public DoubleBinding add(int other) { return getDelegate().add(other); }
@Override public DoubleBinding divide(double other) { return getDelegate().divide(other); }
DoubleBinding contentWidthBinding = control.contentMaxWidthProperty() .subtract(control.paddingLocalProperty().getValue().getLeft()) .subtract(control.paddingLocalProperty().getValue().getRight()) .subtract(2*DROP_SHADOW_PADDING); contentWidth.bind(contentWidthBinding); control.paddingLocalProperty().addListener((observable, oldValue, newValue) -> { double sideInsets = newValue.getLeft() + newValue.getRight(); contentWidth.set(control.contentMaxWidthProperty().subtract(sideInsets).doubleValue());
@Override protected double computeValue() { return endYBinding.get(); } };
DoubleBinding totalBinding = new DoubleBinding() { { super.bind(currentPrice, volumeHeld); } @Override protected double computeValue() { return currentPrice.get() * volumeHeld.get(); } };
DoubleProperty x = new SimpleDoubleProperty(3); DoubleProperty y = new SimpleDoubleProperty(4); DoubleBinding hyp = new DoubleBinding() { { bind(x); bind(y); } @Override protected double computeValue() { System.out.println("Computing distance"); return Math.sqrt(x.get()*x.get() + y.get()*y.get()); } }; Label hypLabel = new Label(); hypLabel.textProperty().bind(hyp.asString("Hypotenuse: %f"));
@Override public StringBinding asString(String format) { return getDelegate().asString(format); }
@Override public void addListener(InvalidationListener listener) { getDelegate().addListener(listener); }
@Override public DoubleBinding add(float other) { return getDelegate().add(other); }
@Override public DoubleBinding divide(long other) { return getDelegate().divide(other); }
@Override protected double computeValue() { return startYBinding.get(); } };
DoubleBinding vSliderBind = new DoubleBinding() { { super.bind(vSlider.valueProperty()); } @Override protected double computeValue() { return vSlider.getValue(); } }; rectangle.heightProperty().bind(vSliderBind);
@Override public StringBinding asString(Locale locale, String format) { return getDelegate().asString(locale, format); }
@Override public void addListener(ChangeListener<? super Number> listener) { getDelegate().addListener(listener); }
@Override public DoubleBinding multiply(double other) { return getDelegate().multiply(other); }