I am trying to get the Editor Framework to work with BeanValidation (JSR303) (GWT 2.4) for client side validation and run into an issue.
Validation works fine. I want to use the Editor's built in capability to display errors (i.e ValueBoxEditorDecorator). However the EditorDriver interface only specifies setConstraintViolations(Iterable> violations); But the validate function from the BeanValidation returns a Set> and I can't cast from this to the type that is expected in the setConstraintViolations function.
The only workaround I found is creating a new Set and adding the ConstraintViolations to it.
Set<ConstraintViolation<MyProxy>> violations = validator.validate(myProxy,Default.class);
Set<ConstraintViolation<?>> violations2 = new HashSet<ConstraintViolation<?>>();
for (ConstraintViolation<StudyProxy>constraint:violations) {
violations2.add(constraint);
}
if (!violations.isEmpty()) {
driver.setConstraintViolations(violations2);
}
else {
//proceed
}
I can this is related to this issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=6270
Is there any better way to do that?