Example usage for com.google.gwt.editor.client EditorError setConsumed

List of usage examples for com.google.gwt.editor.client EditorError setConsumed

Introduction

In this page you can find the example usage for com.google.gwt.editor.client EditorError setConsumed.

Prototype

void setConsumed(boolean consumed);

Source Link

Document

Indicates whether or not the EditorError will be propagated to the enclosing Editor.

Usage

From source file:com.github.gwtbootstrap.client.ui.base.ValueBoxBase.java

License:Apache License

/**
 * //w  ww.j  a v  a 2 s . c  om
 * @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("");
    }
}

From source file:com.sencha.gxt.widget.core.client.form.AdapterField.java

License:sencha.com license

@Override
public void showErrors(List<EditorError> errors) {
    for (EditorError error : errors) {
        assert error.getEditor() == this;
        // skip the error if sent by a field (this field)
        if (error.getUserData() == this) {
            continue;
        }/*from w w w. j  av  a  2s .  c  om*/
        error.setConsumed(true);
    }

    if (errors.size() > 0) {
        errorSupport.markInvalid(errors);
    } else {
        clearInvalid();
    }
}

From source file:com.sencha.gxt.widget.core.client.form.Field.java

License:sencha.com license

@Override
public void showErrors(List<EditorError> errors) {
    // all errors should apply to this element only

    for (EditorError error : errors) {
        assert error.getEditor() == this;
        // skip the error if sent by a field (this field)
        if (error.getUserData() == this) {
            continue;
        }//  w w  w .j av a  2  s  .  co m
        error.setConsumed(true);
    }

    if (errors.size() > 0) {
        markInvalid(errors);
    } else {
        clearInvalid();
    }
}

From source file:org.dashbuilder.client.widgets.dataset.editor.widgets.editors.csv.CSVDataSetDefAttributesEditor.java

License:Apache License

public CSVDataSetDefAttributesEditor() {

    filePath = new FileUpload() {
        @Override//from ww w . j  a v  a2s.c o m
        public void showErrors(List<EditorError> errors) {
            super.showErrors(errors);
            if (errors != null && !errors.isEmpty()) {
                for (EditorError error : errors) {
                    if (error.getEditor() == this) {
                        error.setConsumed(false);
                    }
                }
            }
        }

        @Override
        protected void setErrorLabelText(String errorMessage) {
            filePathErrorTooltip.setText(errorMessage);
            filePathErrorTooltip.reconfigure();
        }
    };

    initWidget(uiBinder.createAndBindUi(this));

    // Configure file upload error displaying.
    filePath.setControlGroup(filePathErrorPanel);
    filePath.setErrorLabel(filePathErrorTooltip.asWidget());

    // Switch file or URL.
    final ClickHandler useFilePathButtonHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showFilePath();
        }
    };
    final ClickHandler useFileURLButtonHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            showFileURL();
        }
    };
    useFilePathButton.addClickHandler(useFilePathButtonHandler);
    useFileURLButton.addClickHandler(useFileURLButtonHandler);

    // By default use file URL
    showFileURL();
}

From source file:org.dashbuilder.client.widgets.dataset.editor.widgets.editors.datacolumn.DataColumnBasicEditor.java

License:Apache License

protected void consumeErrors(List<EditorError> errors) {
    for (EditorError error : errors) {
        if (error.getEditor().equals(this)) {
            error.setConsumed(true);
        }//w  ww  .j a  va 2s  . c o m
    }
}