tobiasdiez / EasyBind

Custom JavaFX bindings made easy with lambdas.
BSD 2-Clause "Simplified" License
30 stars 6 forks source link

Chaining selectProperty methods #57

Closed matintokyo closed 2 years ago

matintokyo commented 2 years ago

Hi, thank you for your great work on EasyBind.

I come from using Tomas Mikula's EasyBind and would like to know how to achieve selectProperty chaining using your latest release (2.20 as of time of writing).

Using Tomas Mikula's version I would write for example the following code:

textField.textProperty().bind(
                    org.fxmisc.easybind.EasyBind.monadic(itemProperty())
                            .selectProperty(Item::thingProperty)
                            .selectProperty(Thing::stringProperty));

Using your implementation, I cannot chain selectionProperty methods. Would the following be the correct equivalent?

textField.textProperty().bind(
                   EasyBind.wrapNullable(
                           EasyBind.select(itemProperty())
                                   .selectObject(Item::thingProperty)
                   ).selectProperty(Thing::stringProperty));

Thank you for you help!

Matthis

tobiasdiez commented 2 years ago

This is currently not easily possible. If I understand you correctly, then this is a duplicate of https://github.com/tobiasdiez/EasyBind/issues/10, right?

matintokyo commented 2 years ago

You are right… sorry I had not read #10 before posting…!

tobiasdiez commented 2 years ago

No problems! Closing as duplicate of #10.