Java Code Examples for javafx.beans.property.DoubleProperty

The following examples show how to use javafx.beans.property.DoubleProperty. These examples are extracted from open source projects. 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 Project: mzmine3   Source File: TestDatatypes.java    License: GNU General Public License v2.0 6 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 2
Source Project: FxDock   Source File: Converters.java    License: Apache License 2.0 6 votes vote down vote up
@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 3
Source Project: WorkbenchFX   Source File: ToolbarItemTest.java    License: Apache License 2.0 6 votes vote down vote up
@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 4
Source Project: oim-fx   Source File: Magnifier.java    License: MIT License 6 votes vote down vote up
/**
 * 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 5
Source Project: oim-fx   Source File: Magnifier.java    License: MIT License 6 votes vote down vote up
/**
 * 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 6
Source Project: paintera   Source File: SpatialInformation.java    License: GNU General Public License v2.0 5 votes vote down vote up
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 7
Source Project: marathonv5   Source File: SimplePropertySheet.java    License: Apache License 2.0 5 votes vote down vote up
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 8
Source Project: tilesfx   Source File: SectionBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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 9
Source Project: tilesfx   Source File: ChartDataBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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 10
Source Project: FXyzLib   Source File: Text3DHelper.java    License: GNU General Public License v3.0 5 votes vote down vote up
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 11
Source Project: Enzo   Source File: MenuItemBuilder.java    License: Apache License 2.0 5 votes vote down vote up
@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 12
Source Project: worldfx   Source File: LocationBuilder.java    License: Apache License 2.0 5 votes vote down vote up
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 13
Source Project: TweetwallFX   Source File: SizeTransition.java    License: MIT License 5 votes vote down vote up
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 14
Source Project: latexdraw   Source File: GridBase.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull DoubleProperty gridEndXProperty() {
	return gridEndx;
}
 
Example 15
Source Project: FXyzLib   Source File: Capsule.java    License: GNU General Public License v3.0 4 votes vote down vote up
public DoubleProperty heightProperty() {
    return mesh.heightProperty();
}
 
Example 16
Source Project: Motion_Profile_Generator   Source File: SharedGeneratorVars.java    License: MIT License 4 votes vote down vote up
public DoubleProperty wheelBaseDProperty()
{
    return wheelBaseD;
}
 
Example 17
Source Project: Enzo   Source File: SimpleGauge.java    License: Apache License 2.0 4 votes vote down vote up
public final DoubleProperty valueProperty() {                        
    return value;
}
 
Example 18
Source Project: kafka-message-tool   Source File: GuiSettings.java    License: MIT License 4 votes vote down vote up
public DoubleProperty upperSplitPaneDividerPositionProperty() {
    return upperSplitPaneDividerPosition;
}
 
Example 19
Source Project: regions   Source File: FrameCounter.java    License: Apache License 2.0 4 votes vote down vote up
public DoubleProperty framePointerProperty() {
    return framePointer;
}
 
Example 20
public DoubleProperty markerSizeProperty() {
    return markerSize;
}
 
Example 21
Source Project: chart-fx   Source File: DefaultRenderColorScheme.java    License: Apache License 2.0 4 votes vote down vote up
public static DoubleProperty defaultStrokeLineWidthProperty() {
    return lineWidth;
}
 
Example 22
Source Project: FXyzLib   Source File: SurfacePlotMesh.java    License: GNU General Public License v3.0 4 votes vote down vote up
public DoubleProperty rangeYProperty() {
    return rangeY;
}
 
Example 23
Source Project: Motion_Profile_Generator   Source File: Waypoint.java    License: MIT License 4 votes vote down vote up
public DoubleProperty angleProperty()
{
    return angle;
}
 
Example 24
public DoubleProperty mzShiftProperty() {
  return mzShift;
}
 
Example 25
Source Project: FXyzLib   Source File: PyramidMesh.java    License: GNU General Public License v3.0 4 votes vote down vote up
public DoubleProperty hypotenuseProperty() {
	return hypotenuse;
}
 
Example 26
Source Project: FXyzLib   Source File: PrismMesh.java    License: GNU General Public License v3.0 4 votes vote down vote up
public DoubleProperty heightProperty() {
    return height;
}
 
Example 27
Source Project: latexdraw   Source File: ShapeBase.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull DoubleProperty dbleBordSepProperty() {
	return dbleBordSep;
}
 
Example 28
public final DoubleProperty measuredChanceProperty() {
    return measuredChanceProperty;
}
 
Example 29
Source Project: kafka-message-tool   Source File: GuiSettings.java    License: MIT License 4 votes vote down vote up
public DoubleProperty mainWindowHeightProperty() {
    return mainWindowHeightProperty;
}
 
Example 30
Source Project: metastone   Source File: BattleDeckResult.java    License: GNU General Public License v2.0 4 votes vote down vote up
public final DoubleProperty winRateProperty() {
	return this.winRate;
}