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

Validation Message Properties #359

Closed
gtnarg opened this issue Feb 12, 2016 · 6 comments
Closed

Validation Message Properties #359

gtnarg opened this issue Feb 12, 2016 · 6 comments
Milestone

Comments

@gtnarg
Copy link

gtnarg commented Feb 12, 2016

Currently ValidationMessage only contains the message and it's severity.

I would like you using the validators in a TableView. When an error is returned for a particular cell, I would like to add some additional information (eg. row and column). This will allow a user to select an error message and I could then highlight (or navigate to) the cell containing the error.

All that would be required would be a map of (optional) additional properties to be added to the messages.

for example you could overload the following:

ValidationMessage.error( String message, Map<String,Object> messageProperties );

Any thoughts or alternative approaches?

@manuel-mauky
Copy link
Collaborator

I understand your request but I don't know if a properties map at the ValidationMessage would be the best solution for this. My problem is that this is very implicit. The type of the key of the propertiesmap is Object which is not type safe.

Maybe you could add one or more properties to the ViewModel and use them to get your additional information from the ViewModel to the View?

@gtnarg
Copy link
Author

gtnarg commented Feb 12, 2016

Regarding the properties map - it is loosely typed so that the it can be used by anyone using the validation framework for their own purposes. Is there a downside to this approach?

JavaFx nodes can contain properties in much the same fashion and the api states:

Returns an observable map of properties on this node for use primarily by application developers.

(Note: I'm not suggesting an observable list since it would be immutable)

If you aren't interested in adding in the feature, would you consider making ValidationMessage extendable (the constructor is not visible outside the package), so that I could create my own validation messages that still fit into the framework or probably better - make it an interface?

@manuel-mauky
Copy link
Collaborator

I don't like the idea of a untyped map but I don't have a good alternative at hand.

Making the ValidationMessage extendable sounds good.

@manuel-mauky
Copy link
Collaborator

Can you take a look at this commit: ba853e2

In this commit I made the constructor of the ValidationMessage class public and added a test case that shows how you could create and use your own ValidationMessage subclasses.

@manuel-mauky manuel-mauky added this to the 1.5.0 milestone Feb 16, 2016
@gtnarg
Copy link
Author

gtnarg commented Feb 16, 2016

That's exactly what I had done locally. That will work well - thanks :)

@manuel-mauky
Copy link
Collaborator

ok. It will be part of version 1.5.0

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

2 participants