GWT Editor Client Side Validation?

98 views Asked by At

Using the Editor framework I found that you have to do client side validation yourself. Here is a question that deals with this topic.

Do I really have to write all this code when I want to integrate the client side validation with the editor framework?

Person newPerson = editorDriver.flush();

Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<Person>> violations = validator.validate(newPerson, Default.class);

@SuppressWarnings({ "rawtypes", "unchecked" })
Iterable<ConstraintViolation<?>> tmpViolations = (Iterable<ConstraintViolation<?>>) (Set) violations;

if (!violations.isEmpty()) {
    editorDriver.setConstraintViolations(tmpViolations);
}
1

There are 1 answers

0
Thomas Broyer On BEST ANSWER

Yes.

That's one of the differences between libraries/toolkits and frameworks: the formers are lighter and less intrusive but require more glue code.