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

DataField assumes edited value can be transformed to a suitable String representation #30

Closed
aalmiray opened this issue Jul 13, 2018 · 1 comment

Comments

@aalmiray
Copy link
Contributor

DataField<V> assumes that V can be safely transformed to a String literal that makes sense for that particular type, but that's not often the case, specially when dealing with types (domain classes) for which an overridden version of toString() is not available or returns a rather cryptic value.

This design decision imposes a constraint on edited values as it's expected of them to provide a suitable toString() implementation, while at the same time requiring an external transformer (from String to V) by means of FormsFX's ValueTransformer.

It would be much better if JavaFX's StringConverter would be used instead, as it provides both sides of the equation. Retrofitting DataField with StrinfConverter can be done in a compatible way, by deprecating ValueTransformer and redirecting is String -> T transformation to an ad-hoc StringConverter.fromString. Also, a pre-instantiated StringConverter can take care of the default String conversion.

@aalmiray
Copy link
Contributor Author

Fixed.

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

No branches or pull requests

1 participant