javafx.beans.property.DoubleProperty Java Examples
The following examples show how to use
javafx.beans.property.DoubleProperty.
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: Magnifier.java From oim-fx with MIT License | 10 votes |
/** * Property for setting the width of the scope lines that are visible in the circular viewer. The default value is 1.5px. * * @see #setScopeLineWidth(double) * @see #getScopeLineWidth() */ public final DoubleProperty scopeLineWidthProperty() { if (this.scopeLineWidth == null) { this.scopeLineWidth = new DoublePropertyBase(DEFAULT_SCOPELINE_WIDTH) { @Override public String getName() { return "scopeLineWidth"; } @Override public Object getBean() { return Magnifier.this; } }; } return this.scopeLineWidth; }
Example #2
Source File: Magnifier.java From oim-fx with MIT License | 10 votes |
/** * Property for setting the scale factor to which the content need to be magnified. The default value is 3.0D. * * @see #setScaleFactor(double) * @see #getScaleFactor() */ public final DoubleProperty scaleFactorProperty() { if (this.scaleFactor == null) { this.scaleFactor = new DoublePropertyBase(DEFAULT_SCALE_FACTOR) { @Override public String getName() { return "scaleFactor"; } @Override public Object getBean() { return Magnifier.this; } }; } return this.scaleFactor; }
Example #3
Source File: SpatialInformation.java From paintera with GNU General Public License v2.0 | 9 votes |
public void bindTo(final DoubleProperty x, final DoubleProperty y, final DoubleProperty z) { this.x.bindBidirectional(x); this.y.bindBidirectional(y); this.z.bindBidirectional(z); }
Example #4
Source File: ToolbarItemTest.java From WorkbenchFX with Apache License 2.0 | 8 votes |
@Test void testGraphicListenerDefaultCtor() { // create a new image 20x20 DoubleProperty fitHeightProperty = new SimpleDoubleProperty(); ImageView imageView = mock(ImageView.class); when(imageView.fitHeightProperty()).thenReturn(fitHeightProperty); // init a new empty ToolbarItem and set the ImageView toolbarItem = new ToolbarItem(); toolbarItem.setGraphic(imageView); toolbarItem.setPrefHeight(100); // expected outcome: fitheight to 47 (due to factor 0.47) and preserveratio is set assertEquals(47, fitHeightProperty.get(), .1); verify(imageView).setPreserveRatio(true); verify(imageView).fitHeightProperty(); }
Example #5
Source File: TestDatatypes.java From mzmine3 with GNU General Public License v2.0 | 7 votes |
@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 #6
Source File: Converters.java From FxDock with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") public static <T> StringConverter<T> get(Property<T> p) { if(p instanceof BooleanProperty) { return (StringConverter<T>)BOOLEAN(); } else if(p instanceof IntegerProperty) { return (StringConverter<T>)INT(); } else if(p instanceof DoubleProperty) { return (StringConverter<T>)NUMBER_DOUBLE(); } else if(p instanceof StringProperty) { return (StringConverter<T>)STRING(); } else { throw new Error("?" + p); } }
Example #7
Source File: Text3DHelper.java From FXyzLib with GNU General Public License v3.0 | 5 votes |
private double getArea(){ DoubleProperty res=new SimpleDoubleProperty(); IntStream.range(0, list.size()-1) .forEach(i->res.set(res.get()+list.get(i).crossProduct(list.get(i+1)).z)); // System.out.println("path: "+res.doubleValue()/2); return res.doubleValue()/2d; }
Example #8
Source File: LocationBuilder.java From worldfx with Apache License 2.0 | 5 votes |
public final Location build() { final Location LOCATION = new Location(); for (String key : properties.keySet()) { if ("name".equals(key)) { LOCATION.setName(((StringProperty) properties.get(key)).get()); } else if ("latitude".equals(key)) { LOCATION.setLatitude(((DoubleProperty) properties.get(key)).get()); } else if ("longitude".equals(key)) { LOCATION.setLongitude(((DoubleProperty) properties.get(key)).get()); } else if ("info".equals(key)) { LOCATION.setInfo(((StringProperty) properties.get(key)).get()); } else if ("color".equals(key)) { LOCATION.setColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("iconCode".equals(key)) { LOCATION.setIconCode(((ObjectProperty<Ikon>) properties.get(key)).get()); } else if ("iconSize".equals(key)) { LOCATION.setIconSize(((IntegerProperty) properties.get(key)).get()); } else if ("mouseEnterHandler".equals(key)) { LOCATION.setMouseEnterHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get()); } else if ("mousePressHandler".equals(key)) { LOCATION.setMousePressHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get()); } else if ("mouseReleaseHandler".equals(key)) { LOCATION.setMouseReleaseHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get()); } else if ("mouseExitHandler".equals(key)) { LOCATION.setMouseExitHandler(((ObjectProperty<EventHandler<MouseEvent>>) properties.get(key)).get()); } } return LOCATION; }
Example #9
Source File: SimplePropertySheet.java From marathonv5 with Apache License 2.0 | 5 votes |
public static Object get(ObservableValue valueModel) { if (valueModel instanceof DoubleProperty) { return ((DoubleProperty)valueModel).get(); } else if (valueModel instanceof ObjectProperty) { return ((ObjectProperty)valueModel).get(); } return null; }
Example #10
Source File: SizeTransition.java From TweetwallFX with MIT License | 5 votes |
private SizeTransition( final Duration duration, final DoubleProperty widthProperty, final DoubleProperty heightProperty, final double startHeight, final double startWidth, final double targetHeight, final double targetWidth) { setCycleDuration(duration); this.widthProperty = widthProperty; this.heightProperty = heightProperty; this.startHeight = startHeight; this.startWidth = startWidth; this.targetHeight = targetHeight; this.targetWidth = targetWidth; }
Example #11
Source File: SectionBuilder.java From tilesfx with Apache License 2.0 | 5 votes |
public final Section build() { final Section SECTION = new Section(); for (String key : properties.keySet()) { if ("start".equals(key)) { SECTION.setStart(((DoubleProperty) properties.get(key)).get()); } else if("stop".equals(key)) { SECTION.setStop(((DoubleProperty) properties.get(key)).get()); } else if("text".equals(key)) { SECTION.setText(((StringProperty) properties.get(key)).get()); } else if("icon".equals(key)) { SECTION.setIcon(((ObjectProperty<Image>) properties.get(key)).get()); } else if ("color".equals(key)) { SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("highlightColor".equals(key)) { SECTION.setHighlightColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("textColor".equals(key)) { SECTION.setTextColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if("active".equals(key)) { SECTION.setActive(((BooleanProperty) properties.get(key)).get()); } else if ("onSectionEntered".equals(key)) { SECTION.setOnSectionEntered(((ObjectProperty<EventHandler>) properties.get(key)).get()); } else if ("onSectionLeft".equals(key)) { SECTION.setOnSectionLeft(((ObjectProperty<EventHandler>) properties.get(key)).get()); } else if ("styleClass".equals(key)) { SECTION.setStyleClass(((StringProperty) properties.get(key)).get()); } } return SECTION; }
Example #12
Source File: ChartDataBuilder.java From tilesfx with Apache License 2.0 | 5 votes |
public final ChartData build() { final ChartData DATA = new ChartData(); for (String key : properties.keySet()) { if ("name".equals(key)) { DATA.setName(((StringProperty) properties.get(key)).get()); } else if("value".equals(key)) { DATA.setValue(((DoubleProperty) properties.get(key)).get()); } else if ("timestamp".equals(key)) { DATA.setTimestamp(((ObjectProperty<Instant>) properties.get(key)).get()); } else if ("duration".equals(key)) { DATA.setDuration(((ObjectProperty<java.time.Duration>) properties.get(key)).get()); } else if ("location".equals(key)) { DATA.setLocation(((ObjectProperty<Location>) properties.get(key)).get()); } else if ("fillColor".equals(key)) { DATA.setFillColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("strokeColor".equals(key)) { DATA.setStrokeColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("textColor".equals(key)) { DATA.setTextColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("animated".equals(key)) { DATA.setAnimated(((BooleanProperty) properties.get(key)).get()); } else if("formatString".equals(key)) { DATA.setFormatString(((StringProperty) properties.get(key)).get()); } else if("minValue".equals(key)) { DATA.setMinValue(((DoubleProperty) properties.get(key)).get()); } else if("maxValue".equals(key)) { DATA.setMaxValue(((DoubleProperty) properties.get(key)).get()); } else if ("gradientLookup".equals(key)) { DATA.setGradientLookup(((ObjectProperty<GradientLookup>) properties.get(key)).get()); } else if ("useChartDataColor".equals(key)) { DATA.setUseChartDataColors(((BooleanProperty) properties.get(key)).get()); } else if ("onChartDataEvent".equals(key)) { DATA.setOnChartDataEvent(((ObjectProperty<ChartDataEventListener>) properties.get(key)).get()); } else if ("image".equals(key)) { DATA.setImage(((ObjectProperty<Image>) properties.get(key)).get()); } } return DATA; }
Example #13
Source File: MenuItemBuilder.java From Enzo with Apache License 2.0 | 5 votes |
@Override public final MenuItem build() { final MenuItem CONTROL = new MenuItem(); properties.forEach((key, property) -> { if ("tooltip".equals(key)) { CONTROL.setTooltip(((StringProperty) property).get()); } else if("size".equals(key)) { CONTROL.setSize(((DoubleProperty) property).get()); } else if ("backgroundColor".equals(key)) { CONTROL.setBackgroundColor(((ObjectProperty<Color>) property).get()); } else if ("borderColor".equals(key)) { CONTROL.setBorderColor(((ObjectProperty<Color>) property).get()); } else if ("foregroundColor".equals(key)) { CONTROL.setForegroundColor(((ObjectProperty<Color>) property).get()); } else if ("selectedBackgroundColor".equals(key)) { CONTROL.setSelectedBackgroundColor(((ObjectProperty<Color>) property).get()); } else if ("selectedForegroundColor".equals(key)) { CONTROL.setSelectedForegroundColor(((ObjectProperty<Color>) property).get()); } else if ("symbol".equals(key)) { CONTROL.setSymbolType(((ObjectProperty<SymbolType>) property).get()); } else if ("thumbnailImageName".equals(key)) { CONTROL.setThumbnailImageName(((StringProperty) property).get()); } else if ("text".equals(key)) { CONTROL.setText(((StringProperty) property).get()); } else if ("selectable".equals(key)) { CONTROL.setSelectable(((BooleanProperty) property).get()); } else if ("selected".equals(key)) { CONTROL.setSelected(((BooleanProperty) property).get()); } }); return CONTROL; }
Example #14
Source File: ShapeBase.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override public @NotNull DoubleProperty thicknessProperty() { return thickness; }
Example #15
Source File: JFXScrollPane.java From JFoenix with Apache License 2.0 | 4 votes |
private static void customScrolling(ScrollPane scrollPane, DoubleProperty scrollDriection, Function<Bounds, Double> sizeFunc) { final double[] frictions = {0.99, 0.1, 0.05, 0.04, 0.03, 0.02, 0.01, 0.04, 0.01, 0.008, 0.008, 0.008, 0.008, 0.0006, 0.0005, 0.00003, 0.00001}; final double[] pushes = {1}; final double[] derivatives = new double[frictions.length]; Timeline timeline = new Timeline(); final EventHandler<MouseEvent> dragHandler = event -> timeline.stop(); final EventHandler<ScrollEvent> scrollHandler = event -> { if (event.getEventType() == ScrollEvent.SCROLL) { int direction = event.getDeltaY() > 0 ? -1 : 1; for (int i = 0; i < pushes.length; i++) { derivatives[i] += direction * pushes[i]; } if (timeline.getStatus() == Animation.Status.STOPPED) { timeline.play(); } event.consume(); } }; if (scrollPane.getContent().getParent() != null) { scrollPane.getContent().getParent().addEventHandler(MouseEvent.DRAG_DETECTED, dragHandler); scrollPane.getContent().getParent().addEventHandler(ScrollEvent.ANY, scrollHandler); } scrollPane.getContent().parentProperty().addListener((o,oldVal, newVal)->{ if (oldVal != null) { oldVal.removeEventHandler(MouseEvent.DRAG_DETECTED, dragHandler); oldVal.removeEventHandler(ScrollEvent.ANY, scrollHandler); } if (newVal != null) { newVal.addEventHandler(MouseEvent.DRAG_DETECTED, dragHandler); newVal.addEventHandler(ScrollEvent.ANY, scrollHandler); } }); timeline.getKeyFrames().add(new KeyFrame(Duration.millis(3), (event) -> { for (int i = 0; i < derivatives.length; i++) { derivatives[i] *= frictions[i]; } for (int i = 1; i < derivatives.length; i++) { derivatives[i] += derivatives[i - 1]; } double dy = derivatives[derivatives.length - 1]; double size = sizeFunc.apply(scrollPane.getContent().getLayoutBounds()); scrollDriection.set(Math.min(Math.max(scrollDriection.get() + dy / size, 0), 1)); if (Math.abs(dy) < 0.001) { timeline.stop(); } })); timeline.setCycleCount(Animation.INDEFINITE); }
Example #16
Source File: SnowFlake.java From chart-fx with Apache License 2.0 | 4 votes |
public final DoubleProperty radiusProperty() { return radius; }
Example #17
Source File: ArrowImpl.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override public @NotNull DoubleProperty arrowSizeDimProperty() { return arrowSizeDim; }
Example #18
Source File: SpheroidMesh.java From FXyzLib with GNU General Public License v3.0 | 4 votes |
public DoubleProperty minorRadiusProperty() { return minorRadius; }
Example #19
Source File: TButtonBuilder.java From Enzo with Apache License 2.0 | 4 votes |
public final TButton build() { final TButton CONTROL = new TButton(); for (String key : properties.keySet()) { if ("selected".equals(key)) { CONTROL.setSelected(((BooleanProperty) properties.get(key)).get()); } else if ("text".equals(key)) { CONTROL.setText(((StringProperty) properties.get(key)).get()); } else if ("ledColor".equals(key)) { CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("prefSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if("minWidth".equals(key)) { CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get()); } else if("minHeight".equals(key)) { CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get()); } else if("prefWidth".equals(key)) { CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get()); } else if("prefHeight".equals(key)) { CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get()); } else if("maxWidth".equals(key)) { CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get()); } else if("maxHeight".equals(key)) { CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get()); } else if ("layoutX".equals(key)) { CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get()); } else if ("layoutY".equals(key)) { CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get()); } else if ("translateX".equals(key)) { CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get()); } else if ("translateY".equals(key)) { CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get()); } else if ("scaleX".equals(key)) { CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get()); } else if ("scaleY".equals(key)) { CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get()); } } return CONTROL; }
Example #20
Source File: PointerEventHandler.java From jfxvnc with Apache License 2.0 | 4 votes |
public void registerZoomLevel(DoubleProperty zoom) { zoom.addListener(l -> zoomLevel = zoom.get()); }
Example #21
Source File: RadialMenuItem.java From RadialFx with GNU Lesser General Public License v3.0 | 4 votes |
public DoubleProperty offsetProperty() { return offset; }
Example #22
Source File: SidesPane.java From chart-fx with Apache License 2.0 | 4 votes |
public DoubleProperty prefWidthRightProperty() { return prefWidthRight; }
Example #23
Source File: Spheroid.java From FXyzLib with GNU General Public License v3.0 | 4 votes |
public DoubleProperty minorRadiusProperty() { return mesh.minorRadiusProperty(); }
Example #24
Source File: AbstractFormLayoutRegion.java From dolphin-platform with Apache License 2.0 | 4 votes |
protected DoubleProperty internMaxEditorWidthProperty() { return maxEditorWidth; }
Example #25
Source File: Arrow.java From fxgraph with Do What The F*ck You Want To Public License | 4 votes |
public final DoubleProperty startYProperty() { return line.startYProperty(); }
Example #26
Source File: GameModel.java From JavaFX with MIT License | 4 votes |
public DoubleProperty getBallX() { return ballX; }
Example #27
Source File: GridBase.java From latexdraw with GNU General Public License v3.0 | 4 votes |
@Override public @NotNull DoubleProperty gridEndXProperty() { return gridEndx; }
Example #28
Source File: LedBuilder.java From JFX8CustomControls with Apache License 2.0 | 4 votes |
public final jfx8controls.ledcss.Led build() { final jfx8controls.ledcss.Led CONTROL = new jfx8controls.ledcss.Led(); for (String key : properties.keySet()) { if ("prefSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if("prefWidth".equals(key)) { CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get()); } else if("prefHeight".equals(key)) { CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get()); } else if("minWidth".equals(key)) { CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get()); } else if("minHeight".equals(key)) { CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get()); } else if("maxWidth".equals(key)) { CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get()); } else if("maxHeight".equals(key)) { CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get()); } else if("scaleX".equals(key)) { CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get()); } else if("scaleY".equals(key)) { CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get()); } else if ("layoutX".equals(key)) { CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get()); } else if ("layoutY".equals(key)) { CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get()); } else if ("translateX".equals(key)) { CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get()); } else if ("translateY".equals(key)) { CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get()); } else if("styleClass".equals(key)) { CONTROL.getStyleClass().setAll("led", ((StringProperty) properties.get(key)).get()); } else if ("ledColor".equals(key)) { CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get()); } else if ("on".equals(key)) { CONTROL.setOn(((BooleanProperty) properties.get(key)).get()); } else if ("blink".equals(key)) { CONTROL.setBlinking(((BooleanProperty) properties.get(key)).get()); } else if ("interval".equals(key)) { CONTROL.setInterval(((LongProperty) properties.get(key)).get()); } else if ("frameVisible".equals(key)) { CONTROL.setFrameVisible(((BooleanProperty) properties.get(key)).get()); } } return CONTROL; }
Example #29
Source File: Patient.java From WorkbenchFX with Apache License 2.0 | 4 votes |
public DoubleProperty weightProperty() { return weight; }
Example #30
Source File: KnotMesh.java From FXyzLib with GNU General Public License v3.0 | 4 votes |
public DoubleProperty wireRadiusProperty() { return wireRadius; }