Search in sources :

Example 6 with ErrorMessage

use of com.vaadin.server.ErrorMessage in project VaadinUtils by rlsutton1.

the class ReportParameter method validateField.

protected boolean validateField(AbstractField<T> field) {
    boolean valid = false;
    try {
        field.setComponentError(null);
        if (validateListener != null) {
            validateListener.setComponentError(null);
        }
        field.validate();
        valid = true;
    } catch (final InvalidValueException e) {
        ErrorMessage componentError = new ErrorMessage() {

            private static final long serialVersionUID = -2976235476811651668L;

            @Override
            public String getFormattedHtmlMessage() {
                return e.getHtmlMessage();
            }

            @Override
            public ErrorLevel getErrorLevel() {
                return ErrorLevel.ERROR;
            }
        };
        field.setComponentError(componentError);
        if (validateListener != null) {
            validateListener.setComponentError(componentError);
        }
    }
    return valid;
}
Also used : InvalidValueException(com.vaadin.data.Validator.InvalidValueException) ErrorMessage(com.vaadin.server.ErrorMessage)

Aggregations

ErrorMessage (com.vaadin.server.ErrorMessage)6 Property (com.vaadin.data.Property)3 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)2 CubaComboBox (com.haulmont.cuba.web.toolkit.ui.CubaComboBox)1 CubaSearchSelect (com.haulmont.cuba.web.toolkit.ui.CubaSearchSelect)1 Accordion (com.vaadin.ui.Accordion)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 CssLayout (com.vaadin.ui.CssLayout)1 NativeButton (com.vaadin.ui.NativeButton)1 Tab (com.vaadin.ui.TabSheet.Tab)1 TextField (com.vaadin.ui.TextField)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1