Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Easy Creation Of Bindings #2

Open
nipafx opened this issue Aug 9, 2014 · 0 comments
Open

Allow Easy Creation Of Bindings #2

nipafx opened this issue Aug 9, 2014 · 0 comments

Comments

@nipafx
Copy link
Owner

nipafx commented Aug 9, 2014

Description

In order to bind to/from a nesting's inner property it is currently necessary to first create a nested property and then bind to/from that one:

NestedStringProperty currentEmployeesAddress = Nestings.on(currentEmployee)
    .nestProperty(employee -> employee.addressProperty())
    .nestStringProperty(address -> address.streetNameProperty())
    .buildProperty();
streetNameField.textProperty().bindBidirectional(currentEmployeesAddress);

The following would be more succinct:

Nestings.on(currentEmployee)
    .nestProperty(employee -> employee.addressProperty())
    .nestStringProperty(address -> address.streetNameProperty())
    .boundBidirectionallyFrom(streetNameField.textProperty());

Implementation

Depending on the kind of binding such methods would most likely be added to either AbstractNestingBuilderOnObservableValue (unidirectional) or AbstractNestingBuilderOnProperty (bidirectional).

But an implementation should consider the possibility that the user or other libraries (or this one) might provide additional kinds of bindings. This means that it would not suffice to "simply" hardcode all currently existing bindings from JavaFX 8 into the above mentioned classes (besides being a ****load of work).

Perhaps it is possible to conceive a more general approach to creating bindings which allows to easily access new kinds of bindings (e.g. via a binding factory).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant