当前位置: 首页>>代码示例>>Java>>正文


Java ObservableDoubleValue类代码示例

本文整理汇总了Java中javafx.beans.value.ObservableDoubleValue的典型用法代码示例。如果您正苦于以下问题:Java ObservableDoubleValue类的具体用法?Java ObservableDoubleValue怎么用?Java ObservableDoubleValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObservableDoubleValue类属于javafx.beans.value包,在下文中一共展示了ObservableDoubleValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateXBinding

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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);
        }
    };
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:17,代码来源:BindingHelper.java

示例2: calculateYBinding

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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);
        }
    };
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:17,代码来源:BindingHelper.java

示例3: convertXModelCoordinateToXPixelCoordinate

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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;
        }
    };
}
 
开发者ID:CarrKnight,项目名称:MacroIIDiscrete,代码行数:17,代码来源:GeographicalMarketPresentation.java

示例4: convertYModelCoordinateToYPixelCoordinate

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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;
        }
    };
}
 
开发者ID:CarrKnight,项目名称:MacroIIDiscrete,代码行数:17,代码来源:GeographicalMarketPresentation.java

示例5: bind

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:11,代码来源:BindingHelper.java

示例6: LineBinding

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:10,代码来源:BindingHelper.java

示例7: getCircularBindings

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
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
    );
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:14,代码来源:BindingHelper.java

示例8: getDragBounds

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
@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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:9,代码来源:JorkController.java

示例9: getDragBounds

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
@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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:9,代码来源:SubComponentController.java

示例10: getDragBounds

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
@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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:10,代码来源:NailController.java

示例11: getDragBounds

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
@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);
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:9,代码来源:LocationController.java

示例12: active

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
@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);
}
 
开发者ID:to2mbn,项目名称:LoliXL,代码行数:8,代码来源:GlobalVariablesProvider.java

示例13: FunctionDoubleBinding

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:14,代码来源:FunctionDoubleBinding.java

示例14: ReductionDoubleBinding

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:16,代码来源:ReductionDoubleBinding.java

示例15: add

import javafx.beans.value.ObservableDoubleValue; //导入依赖的package包/类
/**
 * 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.");
    }
}
 
开发者ID:dejv78,项目名称:j.commons,代码行数:18,代码来源:ReductionDoubleBinding.java


注:本文中的javafx.beans.value.ObservableDoubleValue类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。