use of javafx.beans.value.WritableBooleanValue in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXBooleanUnidirectionalWithConverter.
@Test
public void testJavaFXBooleanUnidirectionalWithConverter() {
Property<String> stringDolphinProperty = new MockedProperty<>();
BooleanProperty booleanJavaFXProperty = new SimpleBooleanProperty();
WritableBooleanValue writableBooleanValue = new SimpleBooleanProperty();
Converter<String, Boolean> stringBooleanConverter = s -> s == null ? null : Boolean.parseBoolean(s);
stringDolphinProperty.set("Hello");
assertEquals(booleanJavaFXProperty.get(), false);
Binding binding = FXBinder.bind(booleanJavaFXProperty).to(stringDolphinProperty, stringBooleanConverter);
assertEquals(booleanJavaFXProperty.get(), false);
stringDolphinProperty.set("true");
assertEquals(booleanJavaFXProperty.get(), true);
stringDolphinProperty.set(null);
assertEquals(booleanJavaFXProperty.get(), false);
binding.unbind();
stringDolphinProperty.set("true");
assertEquals(booleanJavaFXProperty.get(), false);
stringDolphinProperty.set("false");
binding = FXBinder.bind(writableBooleanValue).to(stringDolphinProperty, stringBooleanConverter);
assertEquals(writableBooleanValue.get(), false);
stringDolphinProperty.set("true");
assertEquals(writableBooleanValue.get(), true);
stringDolphinProperty.set(null);
assertEquals(writableBooleanValue.get(), false);
binding.unbind();
stringDolphinProperty.set("true");
assertEquals(writableBooleanValue.get(), false);
}
use of javafx.beans.value.WritableBooleanValue in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXBooleanUnidirectional.
@Test
public void testJavaFXBooleanUnidirectional() {
Property<Boolean> booleanDolphinProperty = new MockedProperty<>();
BooleanProperty booleanJavaFXProperty = new SimpleBooleanProperty();
WritableBooleanValue writableBooleanValue = new SimpleBooleanProperty();
booleanDolphinProperty.set(true);
assertNotEquals(booleanJavaFXProperty.get(), true);
Binding binding = FXBinder.bind(booleanJavaFXProperty).to(booleanDolphinProperty);
assertEquals(booleanJavaFXProperty.get(), true);
booleanDolphinProperty.set(false);
assertEquals(booleanJavaFXProperty.get(), false);
booleanDolphinProperty.set(null);
assertEquals(booleanJavaFXProperty.get(), false);
binding.unbind();
booleanDolphinProperty.set(true);
assertEquals(booleanJavaFXProperty.get(), false);
binding = FXBinder.bind(writableBooleanValue).to(booleanDolphinProperty);
assertEquals(writableBooleanValue.get(), true);
booleanDolphinProperty.set(false);
assertEquals(writableBooleanValue.get(), false);
booleanDolphinProperty.set(null);
assertEquals(writableBooleanValue.get(), false);
binding.unbind();
booleanDolphinProperty.set(true);
assertEquals(writableBooleanValue.get(), false);
}
Aggregations