use of javafx.beans.value.WritableStringValue in project dolphin-platform by canoo.
the class FXBinderTest method testJavaFXStringUnidirectional.
@Test
public void testJavaFXStringUnidirectional() {
Property<String> stringDolphinProperty = new MockedProperty<>();
StringProperty stringJavaFXProperty = new SimpleStringProperty();
WritableStringValue writableStringValue = new SimpleStringProperty();
stringDolphinProperty.set("Hello");
assertNotEquals(stringJavaFXProperty.get(), "Hello");
Binding binding = FXBinder.bind(stringJavaFXProperty).to(stringDolphinProperty);
assertEquals(stringJavaFXProperty.get(), "Hello");
stringDolphinProperty.set("Hello JavaFX");
assertEquals(stringJavaFXProperty.get(), "Hello JavaFX");
stringDolphinProperty.set(null);
assertEquals(stringJavaFXProperty.get(), null);
binding.unbind();
stringDolphinProperty.set("Hello JavaFX");
assertEquals(stringJavaFXProperty.get(), null);
binding = FXBinder.bind(writableStringValue).to(stringDolphinProperty);
assertEquals(writableStringValue.get(), "Hello JavaFX");
stringDolphinProperty.set("Dolphin Platform");
assertEquals(writableStringValue.get(), "Dolphin Platform");
stringDolphinProperty.set(null);
assertEquals(writableStringValue.get(), null);
binding.unbind();
stringDolphinProperty.set("Dolphin Platform");
assertEquals(writableStringValue.get(), null);
}
Aggregations