/** * 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); } }
int prefixLength = ctx.getAbsolutePath().length(); for (EditorError error : tryConsume) { if ((prefixLength > 0) && (prefixLength < error.getAbsolutePath().length())) { assert prefixLength == 0 || error.getAbsolutePath().equals(ctx.getAbsolutePath()); ((SimpleError) error).setPathPrefixLength(prefixLength); for (EditorError e : tryConsume) { if (!e.isConsumed()) { accumulator.add(e);
@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); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(editor)); }
/** * * @see com.google.gwt.editor.client.HasEditorErrors#showErrors(java.util.List) */ @Override public void showErrors(List<EditorError> errors) { Widget decoratedWidget = controlGroup != null? controlGroup : this; if(errors != null && !errors.isEmpty()) { StyleHelper.addStyle(decoratedWidget, ControlGroupType.ERROR); SafeHtmlBuilder sb = new SafeHtmlBuilder(); for (EditorError error : errors) { if(error.getEditor() == this) { error.setConsumed(true); sb.appendEscaped(error.getMessage()); sb.appendHtmlConstant("<br />"); } } setErrorLabelText(sb.toSafeHtml().asString()); } else { StyleHelper.removeStyle(decoratedWidget, ControlGroupType.ERROR); setErrorLabelText(""); } }
@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); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(asEditor())); }
/** * * @see com.google.gwt.editor.client.HasEditorErrors#showErrors(java.util.List) */ @Override public void showErrors(List<EditorError> errors) { Widget decoratedWidget = controlGroup != null? controlGroup : this; if(errors != null && !errors.isEmpty()) { StyleHelper.addStyle(decoratedWidget, ControlGroupType.ERROR); SafeHtmlBuilder sb = new SafeHtmlBuilder(); for (EditorError error : errors) { if(error.getEditor() == this) { error.setConsumed(true); sb.appendEscaped(error.getMessage()); sb.appendHtmlConstant("<br />"); } } setErrorLabelText(sb.toSafeHtml().asString()); } else { StyleHelper.removeStyle(decoratedWidget, ControlGroupType.ERROR); setErrorLabelText(""); } }
@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(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); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(this.asEditor())); }
/** * * @see com.google.gwt.editor.client.HasEditorErrors#showErrors(java.util.List) */ @Override public void showErrors(List<EditorError> errors) { Widget decoratedWidget = controlGroup != null? controlGroup : this; if(errors != null && !errors.isEmpty()) { StyleHelper.addStyle(decoratedWidget, ControlGroupType.ERROR); SafeHtmlBuilder sb = new SafeHtmlBuilder(); for (EditorError error : errors) { if(error.getEditor() == this) { error.setConsumed(true); sb.appendEscaped(error.getMessage()); sb.appendHtmlConstant("<br />"); } } setErrorLabelText(sb.toSafeHtml().asString()); } else { StyleHelper.removeStyle(decoratedWidget, ControlGroupType.ERROR); setErrorLabelText(""); } }
int prefixLength = ctx.getAbsolutePath().length(); for (EditorError error : tryConsume) { if ((prefixLength > 0) && (prefixLength < error.getAbsolutePath().length())) { assert prefixLength == 0 || error.getAbsolutePath().equals(ctx.getAbsolutePath()); ((SimpleError) error).setPathPrefixLength(prefixLength); for (EditorError e : tryConsume) { if (!e.isConsumed()) { accumulator.add(e);
@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(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); }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(asEditor())); }
int prefixLength = ctx.getAbsolutePath().length(); for (EditorError error : tryConsume) { if ((prefixLength > 0) && (prefixLength < error.getAbsolutePath().length())) { assert prefixLength == 0 || error.getAbsolutePath().equals(ctx.getAbsolutePath()); ((SimpleError) error).setPathPrefixLength(prefixLength); for (EditorError e : tryConsume) { if (!e.isConsumed()) { accumulator.add(e);
@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()); }
/** {@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); } }
/** * Checks if a error belongs to this widget. * * @param perror editor error to check * @return true if the error belongs to this widget */ protected boolean editorErrorMatches(final EditorError perror) { return perror != null && perror.getEditor() != null && (equals(perror.getEditor()) || perror.getEditor().equals(this.asEditor())); }