• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scott: JGoodies Validation  RSS feed

 
craig wickesser
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scott,
I have never worked with JGoodies Validation, however, I have worked with a home-grown Validation framework in the past. My previous experience was that it was bit cumbersome (of course that was our design issue ...

Anyway, I typically work on stand-alone applications and basically if I want to create a panel which takes in user input sometimes I will have like 3 panels all contained in one "main" panel, which is later added to the main application somewhere. My question is how flexible is the validation framework/ease of use? Is it easy to extend to add more complex validation rules or ways of displaying erroroneous input?

Thanks,
Craig
craig.at.codecraig.com
 
Scott Delap
author
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my research writing the chapter, JGoodies Validation is a very well thought out and designed library. It is written in such a way to avoid coupling which makes it easy to use in cases like the one you describe. The basic objects it uses are ValidationMessage and ValidationResult (which contains a list of validation messages). You could easily have validation code for each of your panels that generates ValidationMessages. Then at a higher level you could add them in a ValidationResult. You can then add an external component to view the combined errors from the different panel or add visual indicators to the components themselves. These visual indicators (special borders, background colors, tooltip icons) are all applied using a utilities class and a visitor pattern. They can operate on your existing components and layouts. This makes it very easy to add validation without rewriting everything.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!