I finally found the solution myself : I believed that the FieldLabel handled the feedback itself but this is wrong.
My class must implement
HasEditorErrors<Set<T>>
so that methodvoid showErrors(List<EditorError> errors)
is called. I can do whatever I want in this case : display an icon, underline something etc.There is a predefined class in GXT which handles the icon + the validation message :
SideErrorHandler
.
Hence, I modified the class like this :
public class EnumSetEditor<T extends Enum<T>> extends Composite implements LeafValueEditor<Set<T>>, HasEditorErrors<Set<T>> {
//Added errorHandler attribute
private SideErrorHandler errorHandler;
public EnumSetEditor(Class<T> clazz) {
...
//Initialize the ErrorHandler
this.errorHandler = new SideErrorHandler(this);
}
/*
* Implemented showErrors(List<EditorError> errors)
* I only delegate the errors to the ErrorHandler.
*/
@Override
public void showErrors(List<EditorError> errors) {
if(errors.isEmpty()) {
errorHandler.clearInvalid();
} else {
errorHandler.markInvalid(errors);
}
}
}