Java 类javafx.beans.value.ObservableDoubleValue 实例源码

项目:H-Uppaal    文件:BindingHelper.java   
private static <T extends Circular> ObservableDoubleValue calculateXBinding(final T source, final Point target) {
    return new DoubleBinding() {
        {
            super.bind(source.xProperty(), source.yProperty());
            super.bind(target.xProperty(), target.yProperty());
            super.bind(source.radiusProperty());
            super.bind(source.scaleProperty());
        }

        @Override
        protected double computeValue() {
            final double angle = Math.atan2(source.yProperty().get() - target.yProperty().get(), source.xProperty().get() - target.xProperty().get()) - Math.toRadians(180);
            return source.xProperty().get() + source.radiusProperty().get() * source.scaleProperty().get() * Math.cos(angle);
        }
    };
}
项目:H-Uppaal    文件:BindingHelper.java   
private static <T extends Circular> ObservableDoubleValue calculateYBinding(final T source, final Point target) {
    return new DoubleBinding() {
        {
            super.bind(source.xProperty(), source.yProperty());
            super.bind(target.xProperty(), target.yProperty());
            super.bind(source.radiusProperty());
            super.bind(source.scaleProperty());
        }

        @Override
        protected double computeValue() {
            final double angle = Math.atan2(source.yProperty().get() - target.yProperty().get(), source.xProperty().get() - target.xProperty().get()) - Math.toRadians(180);
            return source.yProperty().get() + source.radiusProperty().get() * source.scaleProperty().get() * Math.sin(angle);
        }
    };
}
项目:MacroIIDiscrete    文件:GeographicalMarketPresentation.java   
private IntegerBinding convertXModelCoordinateToXPixelCoordinate(ObservableDoubleValue xModel)
{

    return new IntegerBinding() {
        {
            this.bind(xModel,oneUnitInModelEqualsHowManyPixels,pixelOffsetToSimulateNegativeXCoordinate);
        }
        @Override
        protected int computeValue() {
            int newValue = (int) Math.round(xModel.get() * oneUnitInModelEqualsHowManyPixels.get() +
                    pixelOffsetToSimulateNegativeXCoordinate.doubleValue());
            assert newValue >= 0; //new value must always be positive!
            return newValue;
        }
    };
}
项目:MacroIIDiscrete    文件:GeographicalMarketPresentation.java   
private IntegerBinding convertYModelCoordinateToYPixelCoordinate(ObservableDoubleValue yModel)
{

    return new IntegerBinding() {
        {
            this.bind(yModel,oneUnitInModelEqualsHowManyPixels,pixelOffsetToSimulateNegativeYCoordinate);
        }
        @Override
        protected int computeValue() {
            int newValue = (int) Math.round(yModel.get() * oneUnitInModelEqualsHowManyPixels.get() +
                    pixelOffsetToSimulateNegativeYCoordinate.doubleValue());
            assert newValue >= 0; //new value must always be positive!
            return newValue;
        }
    };
}
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final Link subject, final Circular source, final ObservableDoubleValue x, final ObservableDoubleValue y) {
    // Calculate the bindings (so that the line will be based on the circle circumference instead of in its center)
    final LineBinding lineBinding = LineBinding.getCircularBindings(source, CanvasPresentation.mouseTracker, x, y);

    // Bind the subjects properties accordingly to our calculations
    subject.startXProperty().bind(lineBinding.startX);
    subject.startYProperty().bind(lineBinding.startY);
    subject.endXProperty().bind(lineBinding.endX);
    subject.endYProperty().bind(lineBinding.endY);
}
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final ArrowHead subject, final Circular source, final Circular target) {
    // Calculate the bindings (so that the line will be based on the circle circumference instead of in its center)
    final LineBinding lineBinding = LineBinding.getCircleBindings(source, target);

    ObservableDoubleValue startX = lineBinding.startX;
    ObservableDoubleValue startY = lineBinding.startY;
    ObservableDoubleValue endX = lineBinding.endX;
    ObservableDoubleValue endY = lineBinding.endY;

    subject.xProperty().bind(endX);
    subject.yProperty().bind(endY);

    DoubleBinding rotationBinding = new DoubleBinding() {
        {
            super.bind(startX, startY, endX, endY);
            super.bind(source.scaleProperty());
        }

        @Override
        protected double computeValue() {
            double angle = Math.atan2(startY.get() - endY.get(), startX.get() - endX.get());
            return Math.toDegrees(angle) + 90;
        }
    };


    subject.rotateProperty().bind(rotationBinding);
}
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final ArrowHead subject, final Circular source, final ObservableDoubleValue x, final ObservableDoubleValue y) {
    // Calculate the bindings (so that the line will be based on the circle circumference instead of in its center)
    final LineBinding lineBinding = LineBinding.getCircularBindings(source, CanvasPresentation.mouseTracker, x, y);

    ObservableDoubleValue startX = lineBinding.startX;
    ObservableDoubleValue startY = lineBinding.startY;
    ObservableDoubleValue endX = lineBinding.endX;
    ObservableDoubleValue endY = lineBinding.endY;

    subject.xProperty().bind(endX);
    subject.yProperty().bind(endY);

    DoubleBinding rotationBinding = new DoubleBinding() {
        {
            super.bind(startX, startY, endX, endY);
        }

        @Override
        protected double computeValue() {
            double angle = Math.atan2(startY.get() - endY.get(), startX.get() - endX.get());
            return Math.toDegrees(angle) + 90;
        }
    };


    subject.rotateProperty().bind(rotationBinding);
}
项目:H-Uppaal    文件:BindingHelper.java   
LineBinding(final ObservableDoubleValue startX,
            final ObservableDoubleValue startY,
            final ObservableDoubleValue endX,
            final ObservableDoubleValue endY) {
    this.startX = startX;
    this.startY = startY;
    this.endX = endX;
    this.endY = endY;
}
项目:H-Uppaal    文件:BindingHelper.java   
private static LineBinding getCircularBindings(final Circular source, final MouseTracker target, final ObservableDoubleValue x, final ObservableDoubleValue y) {
    final ObservableDoubleValue mouseX = target.gridXProperty().subtract(x);
    final ObservableDoubleValue mouseY = target.gridYProperty().subtract(y);

    final Point point = new Point(mouseX, mouseY);

    return new BindingHelper.LineBinding(
            calculateXBinding(source, point),
            calculateYBinding(source, point),
            mouseX,
            mouseY
    );
}
项目:H-Uppaal    文件:BindingHelper.java   
private static ObservableDoubleValue calculateXBinding(final Circle source, final Point target) {
    return new DoubleBinding() {
        {
            super.bind(source.centerXProperty(), source.centerYProperty());
            super.bind(target.xProperty(), target.yProperty());
            super.bind(source.radiusProperty());
        }

        @Override
        protected double computeValue() {
            double angle = Math.atan2(source.centerYProperty().get() - target.yProperty().get(), source.centerXProperty().get() - target.xProperty().get()) - Math.toRadians(180);
            return source.centerXProperty().get() + source.radiusProperty().get() * Math.cos(angle);
        }
    };
}
项目:H-Uppaal    文件:BindingHelper.java   
private static ObservableDoubleValue calculateYBinding(final Circle source, final Point target) {
    return new DoubleBinding() {
        {
            super.bind(source.centerXProperty(), source.centerYProperty());
            super.bind(target.xProperty(), target.yProperty());
            super.bind(source.radiusProperty());
        }

        @Override
        protected double computeValue() {
            double angle = Math.atan2(source.centerYProperty().get() - target.yProperty().get(), source.centerXProperty().get() - target.xProperty().get()) - Math.toRadians(180);
            return source.centerYProperty().get() + source.radiusProperty().get() * Math.sin(angle);
        }
    };
}
项目:H-Uppaal    文件:JorkController.java   
@Override
public ItemDragHelper.DragBounds getDragBounds() {
    final ObservableDoubleValue minX = new SimpleDoubleProperty(CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxX = getComponent().widthProperty().subtract(JorkPresentation.JORK_WIDTH + CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue minY = new SimpleDoubleProperty(ComponentPresentation.TOOL_BAR_HEIGHT + CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxY = getComponent().heightProperty().subtract(JorkPresentation.JORK_HEIGHT + CanvasPresentation.GRID_SIZE);
    return new ItemDragHelper.DragBounds(minX, maxX, minY, maxY);
}
项目:H-Uppaal    文件:SubComponentController.java   
@Override
public ItemDragHelper.DragBounds getDragBounds() {
    final ObservableDoubleValue minX = new SimpleDoubleProperty(CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxX = getParentComponent().widthProperty().subtract(getSubComponent().widthProperty().add(CanvasPresentation.GRID_SIZE));
    final ObservableDoubleValue minY = new SimpleDoubleProperty(ComponentPresentation.TOOL_BAR_HEIGHT + CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxY = getParentComponent().heightProperty().subtract(getSubComponent().heightProperty().add(CanvasPresentation.GRID_SIZE));
    return new ItemDragHelper.DragBounds(minX, maxX, minY, maxY);
}
项目:H-Uppaal    文件:NailController.java   
@Override
public ItemDragHelper.DragBounds getDragBounds() {
    final ObservableDoubleValue minX = new SimpleDoubleProperty(CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxX = getComponent().widthProperty().subtract(CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue minY = new SimpleDoubleProperty(ComponentPresentation.TOOL_BAR_HEIGHT + CanvasPresentation.GRID_SIZE);
    final ObservableDoubleValue maxY = getComponent().heightProperty().subtract(CanvasPresentation.GRID_SIZE);

    return new ItemDragHelper.DragBounds(minX, maxX, minY, maxY);
}
项目:H-Uppaal    文件:LocationController.java   
@Override
public ItemDragHelper.DragBounds getDragBounds() {
    final ObservableDoubleValue minX = new SimpleDoubleProperty(GRID_SIZE * 2);
    final ObservableDoubleValue maxX = getComponent().widthProperty().subtract(GRID_SIZE * 2);
    final ObservableDoubleValue minY = new SimpleDoubleProperty(ComponentPresentation.TOOL_BAR_HEIGHT + GRID_SIZE * 2);
    final ObservableDoubleValue maxY = getComponent().heightProperty().subtract(GRID_SIZE * 2);
    return new ItemDragHelper.DragBounds(minX, maxX, minY, maxY);
}
项目:LoliXL    文件:GlobalVariablesProvider.java   
@SuppressWarnings("unchecked")
@Activate
public void active(ComponentContext compCtx) {
    ctx = compCtx.getBundleContext();

    register(GlobalVariables.VALUE_ANIMATION_TIME_MULTIPLIER, new SimpleDoubleProperty(1.0), ObservableDoubleValue.class, DoubleProperty.class);
}
项目:j.commons    文件:FunctionDoubleBinding.java   
/**
 * Creates a new instance of FunctionDoubleBinding with a given {@link java.util.function.Function} on a supplied dependency.
 * @param function Function to modify the dependency value
 * @param dependency The dependency
 */
public FunctionDoubleBinding(Function<Double, Double> function, ObservableDoubleValue dependency) {
    requireNonNull(dependency, "Parameter 'dependency' is null");
    requireNonNull(function, "Parameter 'function' is null");

    this.dependency = dependency;
    this.function = function;
    bind(dependency);
}
项目:j.commons    文件:ReductionDoubleBinding.java   
/**
 * Creates a new instance of ReductionDoubleBonding with a given {@link java.util.function.BinaryOperator} and an optional set of initial dependencies.
 * @param binaryOperator The associative accumulation function (see {@link java.util.function.BinaryOperator} for more details)
 * @param dependencies An optional set of dependencies to be initially bound
 */
public ReductionDoubleBinding(BinaryOperator<Double> binaryOperator, ObservableDoubleValue... dependencies) {
    requireNonNull(binaryOperator, "Parameter 'binaryOperator' is null");

    this.binaryOperator = binaryOperator;

    for (ObservableDoubleValue dependency : dependencies) {
        requireNonNull(dependency, "At least one of the dependecies is null");
        add(dependency);
    }
}
项目:j.commons    文件:ReductionDoubleBinding.java   
/**
 * Bind the new (not previously bound) dependency.
 * @param dependency The dependency to be bound
 */
public final void add(ObservableDoubleValue dependency) {
    requireNonNull(dependency, "Parameter 'dependency' is null");

    if (!dependencies.contains(dependency)) {

        dependencies.add(dependency);
        bind(dependency);
        invalidate();

    } else {
        LOGGER.warn("Dependency already included: " + dependency + ", Skipping.");
    }
}
项目:j.commons    文件:ReductionDoubleBinding.java   
/**
 * Unbind the existing (previously bound) dependency.
 * @param dependency The dependency to be unbound
 */
public final void remove(ObservableDoubleValue dependency) {
    requireNonNull(dependency, "Parameter 'dependency' is null");

    if (dependencies.contains(dependency)) {

        dependencies.remove(dependency);
        unbind(dependency);
        invalidate();

    } else {
        LOGGER.warn("Dependency not included: " + dependency + ", Skipping.");
    }
}
项目:SocialPhotoNetworkClient    文件:SearchController.java   
public SearchController(ClientAPI client, StringProperty input, ObservableDoubleValue x, ObservableDoubleValue y, ObservableDoubleValue width) {
    this.client = client;
    this.input  = input;
    this.x      = x;
    this.y      = y;
    this.width  = width;
}
项目:assertj-javafx    文件:DoubleTest.java   
@Test
public void testObservableDoubleValue(){
    ObservableDoubleValue actual = new SimpleDoubleProperty(10.2);

    assertThat(actual).hasValue(10.2);

    assertThat(actual).hasSameValue(actual);
}
项目:assertj-javafx    文件:ObservableValueAssertions_hasValue_double_Test.java   
@Test
public void should_fail_if_actual_has_wrong_value(){
    try{
        ObservableDoubleValue actual = new SimpleDoubleProperty(10.123);

        new ObservableValueAssertions<>(actual).hasValue(10.12);
        fail("Should throw an AssertionError");
    }catch(AssertionError error){
        assertThat(error).hasMessageContaining("<10.12> but was <10.123>");
    }
}
项目:MacroIIDiscrete    文件:Firm.java   
/**
 * get the latest observation of a sales department datum that updates itself
 * @param goodType the good being sold
 * @param salesDataType the kind of datum you are looking form
 * @return an observable (and so listeneable) object updating
 */
public ObservableDoubleValue getLatestObservableObservation( GoodType goodType, SalesDataType salesDataType)
{
    SalesDepartment department = getSalesDepartment(goodType);
    Preconditions.checkState(department != null);
    return department.getLatestObservationObservable(salesDataType);

}
项目:creacoinj    文件:NotificationBarPane.java   
public Item(String label, @Nullable ObservableDoubleValue progress) {
    this.label = new SimpleStringProperty(label);
    this.progress = progress;
}
项目:creacoinj    文件:NotificationBarPane.java   
public Item pushItem(String string, @Nullable ObservableDoubleValue progress) {
    Item i = new Item(string, progress);
    items.add(i);
    return i;
}
项目:legendary-guide    文件:NotificationBarPane.java   
public Item(String label, @Nullable ObservableDoubleValue progress) {
    this.label = new SimpleStringProperty(label);
    this.progress = progress;
}
项目:legendary-guide    文件:NotificationBarPane.java   
public Item pushItem(String string, @Nullable ObservableDoubleValue progress) {
    Item i = new Item(string, progress);
    items.add(i);
    return i;
}
项目:H-Uppaal    文件:Nail.java   
public Nail(final ObservableDoubleValue x, final ObservableDoubleValue y) {
    this(x.get(), y.get());
}
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final Circular subject, final ObservableDoubleValue x, final ObservableDoubleValue y) {
    subject.xProperty().bind(CanvasPresentation.mouseTracker.gridXProperty().subtract(x));
    subject.yProperty().bind(CanvasPresentation.mouseTracker.gridYProperty().subtract(y));
}
项目:H-Uppaal    文件:BindingHelper.java   
public static void bind(final Link lineSubject, final ArrowHead arrowHeadSubject, final Circular source, final ObservableDoubleValue x, final ObservableDoubleValue y) {
    BindingHelper.bind(lineSubject, source, x, y);
    BindingHelper.bind(arrowHeadSubject, source, x, y);
    BindingHelper.bind(lineSubject, arrowHeadSubject);
}
项目:H-Uppaal    文件:BindingHelper.java   
Point(final ObservableDoubleValue x, final ObservableDoubleValue y) {
    this.x = x;
    this.y = y;
}
项目:H-Uppaal    文件:BindingHelper.java   
private ObservableDoubleValue xProperty() {
    return x;
}
项目:H-Uppaal    文件:BindingHelper.java   
private ObservableDoubleValue yProperty() {
    return y;
}
项目:H-Uppaal    文件:ItemDragHelper.java   
public DragBounds(final ObservableDoubleValue minX, final ObservableDoubleValue maxX, final ObservableDoubleValue minY, final ObservableDoubleValue maxY) {
    this.minX = minX;
    this.maxX = maxX;
    this.minY = minY;
    this.maxY = maxY;
}
项目:H-Uppaal    文件:ItemDragHelper.java   
public double trimX(final ObservableDoubleValue x) {
    return trimX(x.get());
}
项目:H-Uppaal    文件:ItemDragHelper.java   
public double trimY(final ObservableDoubleValue y) {
    return trimY(y.get());
}
项目:fx-animation-editor    文件:ChainedBindingFunctions.java   
public DoubleBinding selectDouble(Function<S, ? extends ObservableDoubleValue> childPropertyAccessor) {
    return selectDouble(childPropertyAccessor, 0.0);
}
项目:fx-animation-editor    文件:ChainedBindingFunctions.java   
public DoubleBinding selectDouble(Function<S, ? extends ObservableDoubleValue> childPropertyAccessor, double defaultValue) {
    return new DoubleBindingAdapter(new ChainBinding<>(rootProperty, childPropertyAccessor), defaultValue);
}
项目:cryptwallet    文件:NotificationBarPane.java   
public Item(String label, @Nullable ObservableDoubleValue progress) {
    this.label = new SimpleStringProperty(label);
    this.progress = progress;
}