Java 类javafx.beans.value.WritableIntegerValue 实例源码

项目:dolphin-platform    文件:FXBinderTest.java   
@Test
public void testJavaFXIntegerUnidirectional() {
    Property<Integer> integerDolphinProperty = new MockedProperty<>();
    Property<Number> numberDolphinProperty = new MockedProperty<>();
    IntegerProperty integerJavaFXProperty = new SimpleIntegerProperty();
    WritableIntegerValue writableIntegerValue = new SimpleIntegerProperty();

    integerDolphinProperty.set(47);
    assertNotEquals(integerJavaFXProperty.doubleValue(), 47);

    Binding binding = FXBinder.bind(integerJavaFXProperty).to(integerDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 47);
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 100);
    integerDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    binding.unbind();
    integerDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);


    numberDolphinProperty.set(12);
    binding = FXBinder.bind(integerJavaFXProperty).to(numberDolphinProperty);
    assertEquals(integerJavaFXProperty.get(), 12);
    numberDolphinProperty.set(null);
    assertEquals(integerJavaFXProperty.get(), 0);
    binding.unbind();
    numberDolphinProperty.set(100);
    assertEquals(integerJavaFXProperty.get(), 0);

    integerDolphinProperty.set(47);
    binding = FXBinder.bind(writableIntegerValue).to(integerDolphinProperty);
    assertEquals(writableIntegerValue.get(), 47);
    integerDolphinProperty.set(100);
    assertEquals(writableIntegerValue.get(), 100);
    integerDolphinProperty.set(null);
    assertEquals(writableIntegerValue.get(), 0);
    binding.unbind();
    integerDolphinProperty.set(100);
    assertEquals(writableIntegerValue.get(), 0);
}
项目:javafx-widgets    文件:FillPane.java   
public WritableIntegerValue marginHeightProperty() {
  return marginHeight;
}
项目:javafx-widgets    文件:FillPane.java   
public WritableIntegerValue marginWidthProperty() {
  return marginWidth;
}
项目:dolphin-platform    文件:FXBinder.java   
/**
 * Start point of the fluent API to create a binding.
 * @param writableDoubleValue the javafx property
 * @return a binder that can be used by the fluent API to create binding.
 */
public static JavaFXBinder<Integer> bind(WritableIntegerValue writableDoubleValue) {
    requireNonNull(writableDoubleValue, "writableDoubleValue");
    return new DefaultJavaFXBinder(writableDoubleValue);
}