Content binding API
Michael Strauß
michaelstrau2 at gmail.com
Sat Jul 24 14:02:40 UTC 2021
There has been some discussion in this PR
https://github.com/openjdk/jfx/pull/533 on the semantics of
unidirectional and bidirectional bindings.
I think we've come to the understanding that unidirectional and
bidirectional bindings cannot be meaningfully used at the same time,
and such usage should be specified to be illegal and fail fast.
I think the same argument is true for content bindings, which should
mirror the semantics of regular bindings.
1. Let's look at the API of regular bindings:
void bind(ObservableValue)
void unbind()
void bindBidirectional(Property)
void unbindBidirectional(Property)
It makes intuitive sense that unbind() does not take an argument,
because there can only be a single unidirectional binding at a time,
while unbindBidirectional(Property) needs to know which bidirectional
binding should be unbound.
2. Now let's look at the API of content bindings:
void bindContent(ObservableList)
void unbindContent(Object)
void bindContentBidirectional(ObservableList)
void unbindContentBidirectional(Object)
It's a bit unclear why unbindContent(Object) requires an argument, let
alone of type Object. Mirroring regular bindings, we could potentially
introduce a new method unbindContent() without an argument, and
deprecate the other method not for removal.
In the case of unbindContentBidirectional(Object), I'm not sure why
the method doesn't accept an argument of type ObservableList. Can
someone educate me if there is a reason for this seeming inconsistency
with bindContentBidirectional(ObservableList)?`
If there is no reason for the Object argument, "fixing" this would
obviously be more problematic because it would be a
binary-incompatible change.
More information about the openjfx-dev
mailing list