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


Java ReadOnlyDoubleProperty类代码示例

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


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

示例1: initProgressBinding

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
private void initProgressBinding() {
	DoubleExpression tmp = constantOf(0);

	for (Command command : registeredCommands) {
		final ReadOnlyDoubleProperty progressProperty = command.progressProperty();

		/**
		 * When the progress of a command is "undefined", the progress property has a value of -1.
		 * But in our use case we like to have a value of 0 in this case. 
		 * Therefore we create a custom binding here.
		 */
		final DoubleBinding normalizedProgress = Bindings
				.createDoubleBinding(() -> (progressProperty.get() == -1) ? 0.0 : progressProperty.get(),
						progressProperty);

		tmp = tmp.add(normalizedProgress);
	}
	
	int divisor = registeredCommands.isEmpty() ? 1 : registeredCommands.size();
	progress.bind(Bindings.divide(tmp, divisor));
}
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:22,代码来源:CompositeCommand.java

示例2: fillImage

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
static ReadOnlyDoubleProperty fillImage(ImageView imageView, int zoom, long i, long j) {
    Image image = fromFileCache(zoom, i, j);
    if (image == null) {
        String urlString = host + zoom + "/" + i + "/" + j + ".png";
        if (hasFileCache) {
            Task<Object> task = new Task() {
                @Override
                protected Object call() throws Exception {
                    cacheThread.cacheImage(urlString, zoom, i, j);
                    return null; // can't return image yet
                }
            };
            Thread t = new Thread(task);
            t.start();
        }
        image = new Image(urlString, true);
    }
    imageView.setImage(image);
    return image.progressProperty();
}
 
开发者ID:gluonhq,项目名称:maps,代码行数:21,代码来源:ImageRetriever.java

示例3: buildMenuBarWithMenus

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
public MenuBar buildMenuBarWithMenus(HTMLEditor editor, final ReadOnlyDoubleProperty menuWidthProperty, String STYLE_CSS){
    MenuBar menuBar = new MenuBar();
    menuBar.setStyle(STYLE_CSS);
    
    
    // Add File menu to menu bar
    menuBar.getMenus().add(new FileMenuBuilder().getProduct(editor));
    //Add Edit menu to menu bar
    menuBar.getMenus().add(new EditMenuBuilder().getProduct(editor)) ;
    //Add Insert menu to menu bar
    menuBar.getMenus().add(new InsertMenuBuilder().getProduct(editor));
    //Add Indent menu to menu bar
    menuBar.getMenus().add(new IndentMenuBuilder().getProduct(editor));
    // Add View menu to menu bar
    menuBar.getMenus().add(new ViewMenuBuilder().getProduct(editor));
    
    
    // bind width of menu bar to width of associated stage
    menuBar.prefWidthProperty().bind(menuWidthProperty);
    return menuBar;
}
 
开发者ID:Hydral1k,项目名称:HTMLEditor,代码行数:22,代码来源:MenuBuilder.java

示例4: DraggableItem

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
public DraggableItem(SpriteObject item, ReadOnlyDoubleProperty width, ReadOnlyDoubleProperty height, SimpleDoubleProperty x, SimpleDoubleProperty y){
	myItem=item;
	myWidth=item.getImage().getFitWidth();
	myHeight=item.getImage().getFitHeight();
	gridWidth=width.getValue().doubleValue();
	gridHeight=height.getValue().doubleValue();
	startX=x.getValue().doubleValue();
	startY=y.getValue().doubleValue();
	addListener(x, (toChange)->changeX(toChange));
	addListener(y, (toChange)->changeY(toChange));
	addListener(myItem.getObservableWidth(), (toChange)->changeWidth(toChange));
	addListener(myItem.getObservableHeight(), (toChange)->changeHeight(toChange));
	addListener(width, (toChange)->changeGridWidth(toChange));
	addListener(height, (toChange)->changeGridHeight(toChange));
	drag();
}
 
开发者ID:ngbalk,项目名称:VOOGASalad,代码行数:17,代码来源:DraggableItem.java

示例5: arcWidthProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
/** Replies the property for the arc width.
 *
 * @return the arcWidth property.
 */
public DoubleProperty arcWidthProperty() {
	if (this.arcWidth == null) {
		this.arcWidth = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
				this, MathFXAttributeNames.ARC_WIDTH, widthProperty()) {
			@Override
			protected void invalidated(ReadOnlyDoubleProperty dependency) {
				final double value = get();
				if (value < 0.) {
					set(0.);
				} else {
					final double maxArcWidth = dependency.get() / 2.;
					if (value > maxArcWidth) {
						set(maxArcWidth);
					}
				}
			}
		};
	}
	return this.arcWidth;
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:25,代码来源:RoundRectangle2dfx.java

示例6: arcHeightProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
/** Replies the property for the arc height.
 *
 * @return the arcHeight property.
 */
public DoubleProperty arcHeightProperty() {
	if (this.arcHeight == null) {
		this.arcHeight = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
				this, MathFXAttributeNames.ARC_HEIGHT, heightProperty()) {
			@Override
			protected void invalidated(ReadOnlyDoubleProperty dependency) {
				final double value = get();
				if (value < 0.) {
					set(0.);
				} else {
					final double maxArcHeight = dependency.get() / 2.;
					if (value > maxArcHeight) {
						set(maxArcHeight);
					}
				}
			}
		};
	}
	return this.arcHeight;
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:25,代码来源:RoundRectangle2dfx.java

示例7: widthProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
@Test
public void widthProperty() {
	assertEpsilonEquals(5, this.shape.getWidth());

	ReadOnlyDoubleProperty property = this.shape.widthProperty();
	assertNotNull(property);
	assertEpsilonEquals(5, property.get());
	
	this.shape.setMinX(7);
	assertEpsilonEquals(3, property.get());

	this.shape.setMinX(-5);
	assertEpsilonEquals(15, property.get());

	this.shape.setMaxX(0);
	assertEpsilonEquals(5, property.get());
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:18,代码来源:Ellipse2dfxTest.java

示例8: heightProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
@Test
public void heightProperty() {
	assertEpsilonEquals(10, this.shape.getHeight());

	ReadOnlyDoubleProperty property = this.shape.heightProperty();
	assertNotNull(property);
	assertEpsilonEquals(10, property.get());
	
	this.shape.setMinY(9);
	assertEpsilonEquals(9, property.get());

	this.shape.setMinY(-5);
	assertEpsilonEquals(23, property.get());

	this.shape.setMaxY(0);
	assertEpsilonEquals(5, property.get());
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:18,代码来源:Ellipse2dfxTest.java

示例9: heightProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
@Test
public void heightProperty() {
    assertEpsilonEquals(10, this.shape.getHeight());
    
    ReadOnlyDoubleProperty property = this.shape.heightProperty();
    assertNotNull(property);
    assertEpsilonEquals(10, property.get());
    
    this.shape.setMinY(9);
    assertEpsilonEquals(9, property.get());
    
    this.shape.setMinY(-5);
    assertEpsilonEquals(23, property.get());
    
    this.shape.setMaxY(0);
    assertEpsilonEquals(5, property.get());
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:18,代码来源:RectangularPrism3dfxTest.java

示例10: depthProperty

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
@Test
public void depthProperty() {
	assertEpsilonEquals(0, this.shape.getDepth());

	ReadOnlyDoubleProperty property = this.shape.depthProperty();
	assertNotNull(property);
	assertEpsilonEquals(0, property.get());
	
	this.shape.setMinZ(9);
	assertEpsilonEquals(0, property.get());

	this.shape.setMinZ(-5);
	assertEpsilonEquals(14, property.get());

	this.shape.setMaxZ(0);
	assertEpsilonEquals(5, property.get());
}
 
开发者ID:gallandarakhneorg,项目名称:afc,代码行数:18,代码来源:RectangularPrism3dfxTest.java

示例11: createTraceWidget

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
private Pane createTraceWidget(ITraceExtractor<Step<?>, State<?,?>, TracedObject<?>, Dimension<?>, Value<?>> extractor, String label, ReadOnlyDoubleProperty width) {
	final Pane pane = new Pane();
	pane.setBackground(TRANSPARENT_BACKGROUND);
	final Rectangle rectangle = new Rectangle(0, 0, 0, 12);
	rectangle.setFill(Color.LIGHTGRAY);
	rectangle.widthProperty().bind(width.subtract(10));
	rectangle.setArcHeight(12);
	rectangle.setArcWidth(12);
	Label text = new Label(label);
	text.setTextOverrun(OverrunStyle.ELLIPSIS);
	text.setAlignment(Pos.CENTER);
	text.setMouseTransparent(true);
	text.setTextFill(Color.WHITE);
	text.setFont(FONT);
	text.setMaxWidth(0);
	text.maxWidthProperty().bind(rectangle.widthProperty());
	StackPane layout = new StackPane();
	layout.getChildren().addAll(rectangle, text);
	pane.getChildren().add(layout);
	layout.setTranslateY(13);
	layout.setTranslateX(5);
	pane.setPrefHeight(25);
	pane.setMinHeight(25);
	pane.setMaxHeight(25);

	final Shape arrow1 = createCursor();
	final Shape arrow2 = createCursor();
	arrow1.setTranslateX(5);
	arrow1.setTranslateY(4);
	arrow2.translateXProperty().bind(rectangle.widthProperty().add(5));
	arrow2.setTranslateY(4);
	pane.getChildren().add(arrow1);
	pane.getChildren().add(arrow2);
	
	return pane;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:37,代码来源:TraceSectionsDialog.java

示例12: createAxis

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
/**
 * create a horizontal axis
 *
 * @param maxReadLength
 * @return axis
 */
public static Pane createAxis(final ReadOnlyIntegerProperty maxReadLength, final ReadOnlyDoubleProperty widthProperty) {
    final Pane pane = new Pane();
    pane.prefWidthProperty().bind(widthProperty);

    final NumberAxis axis = new NumberAxis();
    axis.setSide(Side.TOP);
    axis.setAutoRanging(false);
    axis.setLowerBound(0);
    axis.prefHeightProperty().set(20);
    axis.prefWidthProperty().bind(widthProperty.subtract(60));

    final ChangeListener<Number> changeListener = new ChangeListener<Number>() {
        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            int minX = Math.round(maxReadLength.get() / 2000.0f); // at most 2000 major ticks
            for (int x = 10; x < 10000000; x *= 10) {
                if (x >= minX && widthProperty.doubleValue() * x >= 50 * maxReadLength.doubleValue()) {
                    axis.setUpperBound(maxReadLength.get());
                    axis.setTickUnit(x);
                    return;
                }
            }
            axis.setTickUnit(maxReadLength.get());
            axis.setUpperBound(maxReadLength.get());
        }
    };

    maxReadLength.addListener(changeListener);
    widthProperty.addListener(changeListener);

    pane.getChildren().add(axis);
    return pane;
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:40,代码来源:LRInspectorController.java

示例13: TableItemTask

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
/**
 * constructor
 *
 * @param doc
 * @param cNames
 * @param classificationName
 * @param tableView
 */
public TableItemTask(Document doc, String[] cNames, String classificationName, Set<Integer> classIds, TableView<TableItem> tableView, FloatProperty maxBitScore, FloatProperty maxNormalizedBitScore, IntegerProperty maxReadLength, ReadOnlyDoubleProperty layoutWidth) {
    this.doc = doc;
    this.cNames = cNames;
    this.classificationName = classificationName;
    this.classIds = classIds;
    this.tableView = tableView;
    this.maxBitScore = maxBitScore;
    this.maxNormalizedBitScore = maxNormalizedBitScore;
    this.maxReadLength = maxReadLength;
    this.layoutWidth = layoutWidth;
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:20,代码来源:TableItemTask.java

示例14: WCFXPanel

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
public WCFXPanel(RecordingManager r, ReadOnlyDoubleProperty heightProp, ReadOnlyDoubleProperty widthProp) {
    rManager = r;
    wcImg = new ImageView();
    setCenter(wcImg);

    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            initView(heightProp, widthProp);
        }
    });
}
 
开发者ID:UofIVespucci,项目名称:DriverStation,代码行数:13,代码来源:WCFXPanel.java

示例15: initView

import javafx.beans.property.ReadOnlyDoubleProperty; //导入依赖的package包/类
private void initView(ReadOnlyDoubleProperty heightProp, ReadOnlyDoubleProperty widthProp)
{
    wcImg.fitWidthProperty().bind(widthProp);
    wcImg.fitHeightProperty().bind(heightProp);
    wcImg.setPreserveRatio(true);
    wcImg.minWidth(0);
    wcImg.minHeight(0);
    minWidth(0);
    minHeight(0);
}
 
开发者ID:UofIVespucci,项目名称:DriverStation,代码行数:11,代码来源:WCFXPanel.java


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