use of com.canoo.platform.remoting.client.javafx.BidirectionalConverter in project dolphin-platform by canoo.
the class AbstractNumericJavaFXBidirectionalBinder method bidirectionalTo.
@Override
public <T> Binding bidirectionalTo(final Property<T> property, BidirectionalConverter<T, Number> converter) {
final Binding unidirectionalBinding = to(property, converter);
final ChangeListener<Number> listener = (obs, oldVal, newVal) -> property.set(converter.convertBack(newVal));
javaFxProperty.addListener(listener);
return () -> {
javaFxProperty.removeListener(listener);
unidirectionalBinding.unbind();
};
}
Aggregations