javafx.beans.property.SimpleDoubleProperty Java Examples

The following examples show how to use javafx.beans.property.SimpleDoubleProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Edge.java    From fxgraph with Do What The F*ck You Want To Public License 7 votes vote down vote up
public EdgeGraphic(Graph graph, Edge edge, StringProperty textProperty) {
	group = new Group();
	line = new Line();

	final DoubleBinding sourceX = edge.getSource().getXAnchor(graph, edge);
	final DoubleBinding sourceY = edge.getSource().getYAnchor(graph, edge);
	final DoubleBinding targetX = edge.getTarget().getXAnchor(graph, edge);
	final DoubleBinding targetY = edge.getTarget().getYAnchor(graph, edge);

	line.startXProperty().bind(sourceX);
	line.startYProperty().bind(sourceY);

	line.endXProperty().bind(targetX);
	line.endYProperty().bind(targetY);
	group.getChildren().add(line);

	final DoubleProperty textWidth = new SimpleDoubleProperty();
	final DoubleProperty textHeight = new SimpleDoubleProperty();
	text = new Text();
	text.textProperty().bind(textProperty);
	text.getStyleClass().add("edge-text");
	text.xProperty().bind(line.startXProperty().add(line.endXProperty()).divide(2).subtract(textWidth.divide(2)));
	text.yProperty().bind(line.startYProperty().add(line.endYProperty()).divide(2).subtract(textHeight.divide(2)));
	final Runnable recalculateWidth = () -> {
		textWidth.set(text.getLayoutBounds().getWidth());
		textHeight.set(text.getLayoutBounds().getHeight());
	};
	text.parentProperty().addListener((obs, oldVal, newVal) -> recalculateWidth.run());
	text.textProperty().addListener((obs, oldVal, newVal) -> recalculateWidth.run());
	group.getChildren().add(text);
	getChildren().add(group);
}
 
Example #2
Source File: TestDatatypes.java    From mzmine3 with GNU General Public License v2.0 7 votes vote down vote up
@Test
public void simpleSumBinding() {
  DoubleProperty a = new SimpleDoubleProperty();
  DoubleProperty b = new SimpleDoubleProperty();
  DoubleProperty sum = new SimpleDoubleProperty();

  sum.bind(a.add(b));
  sum.add(b);
  logger.info("Sum=" + sum.get() + "   " + sum.getValue());
  a.set(10);
  logger.info("Sum=" + sum.get() + "   " + sum.getValue());
  b.set(5);
  logger.info("Sum=" + sum.get() + "   " + sum.getValue());
}
 
Example #3
Source File: UiUtil.java    From Recaf with MIT License 6 votes vote down vote up
private static void animate(Node node, long millis, int r, int g, int b) {
	DoubleProperty dblProp = new SimpleDoubleProperty(1);
	dblProp.addListener((ob, o, n) -> {
		InnerShadow innerShadow = new InnerShadow();
		innerShadow.setBlurType(BlurType.ONE_PASS_BOX);
		innerShadow.setChoke(1);
		innerShadow.setRadius(5);
		innerShadow.setColor(Color.rgb(r, g, b, n.doubleValue()));
		node.setEffect(innerShadow);
	});
	Timeline timeline = new Timeline();
	KeyValue kv = new KeyValue(dblProp, 0);
	KeyFrame kf = new KeyFrame(Duration.millis(millis), kv);
	timeline.getKeyFrames().add(kf);
	timeline.play();
}
 
Example #4
Source File: DataAppPreloader.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    preloaderStage = stage;
    preloaderStage.setScene(preloaderScene);
    preloaderStage.show();
    
    if (DEMO_MODE) {
        final DoubleProperty prog = new SimpleDoubleProperty(0){
            @Override protected void invalidated() {
                handleProgressNotification(new ProgressNotification(get()));
            }
        };
        Timeline t = new Timeline();
        t.getKeyFrames().add(new KeyFrame(Duration.seconds(20), new KeyValue(prog, 1)));
        t.play();
    }
}
 
Example #5
Source File: Minimal.java    From JavaFX with MIT License 5 votes vote down vote up
private void nextPane(Service<Rectangle> recBuilder) {
	loading[counter].textProperty().bind(recBuilder.messageProperty());
	indicators[counter].visibleProperty().bind(
			recBuilder.progressProperty().isNotEqualTo(
					new SimpleDoubleProperty(
							ProgressBar.INDETERMINATE_PROGRESS)));
	recBuilder.restart();
}
 
Example #6
Source File: GridBase.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an abstract grid.
 * @param pt The position
 */
GridBase(final Point pt) {
	super(pt);
	originx = new SimpleDoubleProperty(0d);
	originy = new SimpleDoubleProperty(0d);
	gridStartx = new SimpleDoubleProperty(0d);
	gridStarty = new SimpleDoubleProperty(0d);
	gridEndx = new SimpleDoubleProperty(2d);
	gridEndy = new SimpleDoubleProperty(2d);
	labelSize = new SimpleIntegerProperty(10);
}
 
Example #7
Source File: GridImpl.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a grid with a predefined point.
 * @param pt The position.
 */
GridImpl(final Point pt) {
	super(pt);
	xLabelSouth = new SimpleBooleanProperty(true);
	yLabelWest = new SimpleBooleanProperty(true);
	gridDots = new SimpleIntegerProperty(PSTricksConstants.DEFAULT_GRIDDOTS);
	gridLabelsColour = new SimpleObjectProperty<>(PSTricksConstants.DEFAULT_LABELGRIDCOLOR);
	labelSize.set((int) PSTricksConstants.DEFAULT_GRID_LABEL);
	gridWidth = new SimpleDoubleProperty(PSTricksConstants.DEFAULT_GRID_WIDTH * PPC);
	subGridColour = new SimpleObjectProperty<>(PSTricksConstants.DEFAULT_SUB_GRID_COLOR);
	subGridDiv = new SimpleIntegerProperty(PSTricksConstants.DEFAULT_SUBGRIDDIV);
	subGridDots = new SimpleIntegerProperty(PSTricksConstants.DEFAULT_SUBGRIDDOTS);
	subGridWidth = new SimpleDoubleProperty(PSTricksConstants.DEFAULT_SUB_GRID_WIDTH * PPC);
	unit = new SimpleDoubleProperty(PSTricksConstants.DEFAULT_UNIT);
}
 
Example #8
Source File: ConcentricRingChartBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B maxHeight(final double MAX_HEIGHT) {
    properties.put("maxHeight", new SimpleDoubleProperty(MAX_HEIGHT));
    return (B) this;
}
 
Example #9
Source File: ConcentricRingChartBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B prefHeight(final double PREF_HEIGHT) {
    properties.put("prefHeight", new SimpleDoubleProperty(PREF_HEIGHT));
    return (B) this;
}
 
Example #10
Source File: LcdClockBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B layoutX(final double LAYOUT_X) {
    properties.put("layoutX", new SimpleDoubleProperty(LAYOUT_X));
    return (B)this;
}
 
Example #11
Source File: BaseMap.java    From maps with GNU General Public License v3.0 4 votes vote down vote up
public MapPoint getMapPosition(double sceneX, double sceneY) {
    final SimpleDoubleProperty _lat = new SimpleDoubleProperty();
    final SimpleDoubleProperty _lon = new SimpleDoubleProperty();
    calculateCoords(sceneX - getTranslateX(), sceneY - getTranslateY(), _lat, _lon);  
    return new MapPoint(_lat.get(), _lon.get());
}
 
Example #12
Source File: NestedBarChartBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B scaleX(final double SCALE_X) {
    properties.put("scaleX", new SimpleDoubleProperty(SCALE_X));
    return (B)this;
}
 
Example #13
Source File: Waypoint.java    From Motion_Profile_Generator with MIT License 4 votes vote down vote up
public Waypoint(double x, double y, double angle )
{
    this.x = new SimpleDoubleProperty( x );
    this.y = new SimpleDoubleProperty( y );
    this.angle = new SimpleDoubleProperty( angle );
}
 
Example #14
Source File: TButtonBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B maxWidth(final double MAX_WIDTH) {
    properties.put("maxWidth", new SimpleDoubleProperty(MAX_WIDTH));
    return (B)this;
}
 
Example #15
Source File: WorldBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B maxWidth(final double MAX_WIDTH) {
    properties.put("maxWidth", new SimpleDoubleProperty(MAX_WIDTH));
    return (B)this;
}
 
Example #16
Source File: NestedBarChartBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B layoutY(final double LAYOUT_Y) {
    properties.put("layoutY", new SimpleDoubleProperty(LAYOUT_Y));
    return (B)this;
}
 
Example #17
Source File: PaymentTableModel.java    From RentLio with Apache License 2.0 4 votes vote down vote up
public SimpleDoubleProperty totalPriceProperty() {
    return totalPrice;
}
 
Example #18
Source File: TButtonBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B minWidth(final double MIN_WIDTH) {
    properties.put("minWidth", new SimpleDoubleProperty(MIN_WIDTH));
    return (B)this;
}
 
Example #19
Source File: XYSeriesBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B symbolSize(final double SIZE) {
    properties.put("symbolSize", new SimpleDoubleProperty(SIZE));
    return (B)this;
}
 
Example #20
Source File: FGaugeBuilder.java    From Medusa with Apache License 2.0 4 votes vote down vote up
public final B layoutX(final double LAYOUT_X) {
    properties.put("layoutX", new SimpleDoubleProperty(LAYOUT_X));
    return (B)this;
}
 
Example #21
Source File: TButtonBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B layoutX(final double LAYOUT_X) {
    properties.put("layoutX", new SimpleDoubleProperty(LAYOUT_X));
    return (B)this;
}
 
Example #22
Source File: LedBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B prefWidth(final double PREF_WIDTH) {
    properties.put("prefWidth", new SimpleDoubleProperty(PREF_WIDTH));
    return (B)this;
}
 
Example #23
Source File: GaugeBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final GaugeBuilder value(final double VALUE) {
    properties.put("value", new SimpleDoubleProperty(VALUE));
    return this;
}
 
Example #24
Source File: GaugeBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final GaugeBuilder minorTickSpace(final double MINOR_TICK_SPACE) {
    properties.put("minorTickSpace", new SimpleDoubleProperty(MINOR_TICK_SPACE));
    return this;
}
 
Example #25
Source File: TileBuilder.java    From OEE-Designer with MIT License 4 votes vote down vote up
@SuppressWarnings("unchecked")
public final B layoutX(final double LAYOUT_X) {
       properties.put("layoutX", new SimpleDoubleProperty(LAYOUT_X));
       return (B)this;
   }
 
Example #26
Source File: ChartItemBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B value(final double VALUE) {
    properties.put("value", new SimpleDoubleProperty(VALUE));
    return (B)this;
}
 
Example #27
Source File: YSeriesBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B strokeWidth(final double WIDTH) {
    properties.put("strokeWidth", new SimpleDoubleProperty(WIDTH));
    return (B)this;
}
 
Example #28
Source File: TileBuilder.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public final B translateX(final double TRANSLATE_X) {
    properties.put("translateX", new SimpleDoubleProperty(TRANSLATE_X));
    return (B)this;
}
 
Example #29
Source File: ParallelCoordinatesChartBuilder.java    From charts with Apache License 2.0 4 votes vote down vote up
public final B scaleY(final double SCALE_Y) {
    properties.put("scaleY", new SimpleDoubleProperty(SCALE_Y));
    return (B) this;
}
 
Example #30
Source File: GaugeBuilder.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public final B layoutY(final double LAYOUT_Y) {
    properties.put("layoutY", new SimpleDoubleProperty(LAYOUT_Y));
    return (B)this;
}