Bidirectional binding with conversion
Knut Arne Vedaa
knut.arne.vedaa at broadpark.no
Fri Dec 9 08:33:10 PST 2011
On 09.12.2011 17:16, Richard Bair wrote:
>>> One other question not directly related -- why do our bindBidirectional methods take a Property instead of a WritableValue?
>> Because a WritableValue is not observable. I think at some point we had something like
>> public static<E, T extends WritableValue<E> & ObservableValue<E>> void bindBidirectional(T obj1, T obj2)
>> but then we dropped it and used properties instead to make the signature more readable. So far properties are the only implementation of both interfaces.
> Ah, that is what Dan was saying in another thread (WritableValue is not an ObservableValue), but I have forgotten that.
My suggestion from the Controls thread could be useful then, at least
interface Bindable<T> extends ObservableValue<T>, WritableValue<T>
interface Property<T> extends ReadOnlyProperty<T>, Bindable<T>
(Where the bind methods are moved from Property to Bindable.)
This would avoid what I would see as a small semantic problem with
Property, that the name indicates it is a property _of_ something. Which
is doesn't have to be just for binding to it.
More information about the openjfx-dev