Hi,
Please find the attached image.
By default the error Alert is at bottom-right. How to change this position to center.
Hi,
Please find the attached image.
By default the error Alert is at bottom-right. How to change this position to center.
Hi,
Unfortunately, is not possible. At the moment you can only override validateAll method completely for concrete window. This approach has one major drawback - cross-field bean validation will not be performed. See the following code example:
public class ClientEdit extends AbstractEditor<Client> {
@Inject
private Logger log;
@Override
public boolean validateAll() {
ValidationErrors errors = new ValidationErrors();
Collection<Component> components = ComponentsHelper.getComponents(this);
for (Component component : components) {
if (component instanceof Validatable) {
try {
((Validatable) component).validate();
} catch (ValidationException e) {
if (log.isTraceEnabled())
log.trace("Validation failed", e);
else if (log.isDebugEnabled())
log.debug("Validation failed: " + e);
ComponentsHelper.fillErrorMessages((Validatable) component, e, errors);
}
}
}
postValidate(errors);
// WARNING: cross field Bean validation will not work!
if (errors.isEmpty())
return true;
showValidationErrors(errors);
WebComponentsHelper.focusProblemComponent(errors);
return false;
}
protected void showValidationErrors(ValidationErrors errors) {
StringBuilder buffer = new StringBuilder();
for (ValidationErrors.Item error : errors.getAll()) {
buffer.append(error.description).append("\n");
}
// for instance, show as WARNING
showNotification(messages.getMessage(WebWindow.class, "validationFail.caption"),
buffer.toString(), NotificationType.WARNING);
}
}
We are planning to implement a configuration property or a method in the future. See: https://youtrack.cuba-platform.com/issue/PL-9608