/** * The default implementation will display, but not consume, received errors * whose {@link EditorError#getEditor() getEditor()} method returns the Editor * passed into {@link #setEditor}. * * @param errors a List of {@link EditorError} instances */ public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor().equals(editor)) { sb.append("\n").append(error.getMessage()); } } if (sb.length() == 0) { errorLabel.setInnerText(""); errorLabel.getStyle().setDisplay(Display.NONE); return; } errorLabel.setInnerText(sb.substring(1)); errorLabel.getStyle().setDisplay(Display.INLINE_BLOCK); } }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> this.editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); this.showErrors(messages); }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> this.editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); this.showErrors(messages); }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).showErrors(messages); }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); ((ValueBoxBaseWithEditorErrors<String>) getValueBox()).showErrors(messages); }
/** {@inheritDoc} */ @Override public void showErrors(List<EditorError> errors) { init(); // clearErrors(); String errorMsg = ""; if (validationStateParent != null) { validationStateParent.setValidationState(errors.size() <= 0 ? ValidationState.NONE : ValidationState.ERROR); for (int index = 0; index < errors.size(); index++) { errorMsg = errors.get(0).getMessage(); if (index + 1 < errors.size()) { errorMsg += "; "; } } } if (validationStateHelpBlock != null) { validationStateHelpBlock.setError(errorMsg); } }
/** {@inheritDoc} */ @Override public void showErrors(List<EditorError> errors) { init(); // clearErrors(); String errorMsg = ""; if (validationStateParent != null) { validationStateParent.setValidationState(errors.size() <= 0 ? ValidationState.NONE : ValidationState.ERROR); for (int index = 0; index < errors.size(); index++) { errorMsg = errors.get(0).getMessage(); if (index + 1 < errors.size()) { errorMsg += "; "; } } } if (validationStateHelpBlock != null) { validationStateHelpBlock.setError(errorMsg); } }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
/************************************************************* ** GWT EDITOR CONTRACT METHODS ** *************************************************************/ @Override public void showErrors(final List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor().equals(this)) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (final EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (final EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
@Override public void showErrors(List<EditorError> errors) { StringBuilder sb = new StringBuilder(); for (EditorError error : errors) { if (error.getEditor() == this) { sb.append("\n").append(error.getMessage()); } } boolean hasErrors = sb.length() > 0; if (!hasErrors) { view.clearError(); return; } // Show the errors. view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml()); }
protected EditorError mockEditorError(final Editor<?> editor, final String message) { EditorError error = mock(EditorError.class); doReturn(editor).when(error).getEditor(); doReturn(message).when(error).getMessage(); return error; }
protected EditorError mockEditorError(final Editor<?> editor, final String message) { EditorError error = mock(EditorError.class); doReturn(editor).when(error).getEditor(); doReturn(message).when(error).getMessage(); return error; }
@Override public void showErrors(List<EditorError> errors) { init(); String errorMsg = ""; for (int index = 0; index < errors.size(); index++) { errorMsg = errors.get(0).getMessage(); if (index + 1 < errors.size()) { errorMsg += "; "; } } if (inputWidget instanceof HasErrorText) { ((HasErrorText) inputWidget).setErrorText(errorMsg); } if (helpBlock != null) { helpBlock.addStyleName("field-error-label"); helpBlock.removeStyleName("field-success-label"); helpBlock.setText(errorMsg); } } }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> this.editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); if (messages.isEmpty()) { if (this.validationMessageElement != null) { this.validationMessageElement.getElement().setInnerText(StringUtils.EMPTY); } } else { if (this.validationMessageElement == null) { GWT.log(ErrorMessageFormater.messagesToString(messages)); } else { this.validationMessageElement.getElement() .setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages)); } } }
@Override public void showErrors(List<EditorError> errors) { init(); String errorMsg = ""; for (int index = 0; index < errors.size(); index++) { errorMsg = errors.get(0).getMessage(); if (index + 1 < errors.size()) { errorMsg += "; "; } } if (inputWidget instanceof HasErrorText) { ((HasErrorText) inputWidget).setErrorText(errorMsg); } if (helpBlock != null) { helpBlock.addStyleName("field-error-label"); helpBlock.removeStyleName("field-success-label"); helpBlock.setText(errorMsg); } } }
@Override public void showErrors(final List<EditorError> perrors) { final Set<String> messages = perrors.stream().filter(error -> this.editorErrorMatches(error)) .map(error -> error.getMessage()).collect(Collectors.toSet()); if (messages.isEmpty()) { if (this.validationMessageElement != null) { this.validationMessageElement.getElement().setInnerText(StringUtils.EMPTY); } } else { if (this.validationMessageElement == null) { GWT.log(ErrorMessageFormater.messagesToString(messages)); } else { this.validationMessageElement.getElement() .setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages)); } } }