本文整理汇总了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));
}
示例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();
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
});
}
示例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);
}