当前位置: 首页>>代码示例>>Java>>正文


Java ErrorMessage类代码示例

本文整理汇总了Java中com.vaadin.server.ErrorMessage的典型用法代码示例。如果您正苦于以下问题:Java ErrorMessage类的具体用法?Java ErrorMessage怎么用?Java ErrorMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorMessage类属于com.vaadin.server包,在下文中一共展示了ErrorMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: error

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public final void error(final ErrorEvent event)
{
	//
	// Extract the relevant exception
	Throwable t = event.getThrowable();
	if (t instanceof SocketException)
	{
		// Most likely client browser closed socket
		logger.info("SocketException in CommunicationManager. Most likely client (browser) closed socket.");
		return;
	}
	t = DefaultErrorHandler.findRelevantThrowable(t);

	//
	// Create error message
	final ErrorMessage errorMessage = createErrorMessage(t);

	//
	// Display it
	displayError(errorMessage, event);

	// also print the error on console
	logger.error("", t);
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:26,代码来源:AbstractErrorHandler.java

示例2: createComponent

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
protected void createComponent() {
    this.component = new CubaComboBox() {
        @Override
        public void setPropertyDataSource(Property newDataSource) {
            if (newDataSource == null)
                super.setPropertyDataSource(null);
            else
                super.setPropertyDataSource(new LookupPropertyAdapter(newDataSource));
        }

        @Override
        public void setComponentError(ErrorMessage componentError) {
            boolean handled = false;
            if (componentErrorHandler != null)
                handled = componentErrorHandler.handleError(componentError);

            if (!handled)
                super.setComponentError(componentError);
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:WebLookupField.java

示例3: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {

    Validator.InvalidValueException validationError = getValidationError();

    final ErrorMessage superError = getComponentError();

    if (superError == null && validationError == null
            && getCurrentBufferedSourceException() == null) {
        return null;
    }
    // Throw combination of the error types
    return new CompositeErrorMessage(
            new ErrorMessage[]{
                superError,
                AbstractErrorMessage
                .getErrorMessageForException(validationError),
                AbstractErrorMessage
                .getErrorMessageForException(
                        getCurrentBufferedSourceException())});
}
 
开发者ID:viritin,项目名称:viritin,代码行数:22,代码来源:MTextField.java

示例4: setComponentError

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public void setComponentError(ErrorMessage componentError) {
	super.setComponentError(componentError);
	if (componentError != null) {
		addStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS);
	} else {
		removeStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:10,代码来源:AbstractCustomField.java

示例5: getTestComponent

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public Component getTestComponent() {

    TextFieldGroup field = new TextFieldGroup();

    field.setCaption("Caption");
    field.setDescription("Description");
    field.setMode(BootstrapMode.SUCCESS);

    Button action1 = new Button("Add ErrorMessage");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.getField().setComponentError(new ErrorMessage() {
            @Override
            public ErrorLevel getErrorLevel() {
                return ErrorLevel.ERROR;
            }

            @Override
            public String getFormattedHtmlMessage() {
                return "<strong>ERROR HERE</strong>";
            }
        });
    });

    Button action2 = new Button("Remove ErrorMessage");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.setOverwriteModeIfComponentError(false);
        field.getField().setComponentError(null);
    });

    MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
    layout.addComponent(field, "field");

    return layout;
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:38,代码来源:FormGroupTextFieldOverwriteModeUI.java

示例6: getTestComponent

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public Component getTestComponent() {

    TextFieldGroup field = new TextFieldGroup();

    field.setCaption("Caption");
    field.setDescription("Description");

    Button action1 = new Button("Add ErrorMessage");
    action1.setId("action1");
    action1.addClickListener(event -> {
        field.getField().setComponentError(new ErrorMessage() {
            @Override
            public ErrorLevel getErrorLevel() {
                return ErrorLevel.ERROR;
            }

            @Override
            public String getFormattedHtmlMessage() {
                return "<strong>ERROR HERE</strong>";
            }
        });
    });

    Button action2 = new Button("Remove ErrorMessage");
    action2.setId("action2");
    action2.addClickListener(event -> {
        field.getField().setComponentError(null);
    });

    MyCustomLayout layout = new MyCustomLayout(FormGroupHtml.BASIC, action1, action2);
    layout.addComponent(field, "field");

    return layout;
}
 
开发者ID:knoobie,项目名称:bootstrap-formgroup,代码行数:36,代码来源:FormGroupTextFieldErrorMessageUI.java

示例7: displayError

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
protected void displayError(final ErrorMessage errorMessage, final ErrorEvent event)
{
	if (component != null)
	{
		component.setComponentError(errorMessage);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:9,代码来源:ForwardingErrorHandler.java

示例8: createErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
private ErrorMessage createErrorMessage(final Throwable t)
{
	final ErrorMessage errorMessage = AbstractErrorMessage.getErrorMessageForException(t);

	// In case we deal with an System Error, don't show it to user because it's confusing.
	// Instead show a generic friendly error message.
	if (errorMessage instanceof SystemError)
	{
		return new UserError(i18n.get("error.default"));
	}

	return errorMessage;
}
 
开发者ID:metasfresh,项目名称:metasfresh-procurement-webui,代码行数:14,代码来源:AbstractErrorHandler.java

示例9: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
    ErrorMessage superError = super.getErrorMessage();
    if (!isReadOnly() && isRequired() && isEmpty()) {

        ErrorMessage error = AbstractErrorMessage.getErrorMessageForException(
                new com.vaadin.data.Validator.EmptyValueException(getRequiredError()));
        if (error != null) {
            return new CompositeErrorMessage(superError, error);
        }
    }

    return superError;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:CubaPasswordField.java

示例10: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
    ErrorMessage superError = super.getErrorMessage();
    if (!isReadOnly() && isRequired() && isEmpty()) {
        ErrorMessage error = AbstractErrorMessage.getErrorMessageForException(
                new com.vaadin.data.Validator.EmptyValueException(getRequiredError()));
        if (error != null) {
            return new CompositeErrorMessage(superError, error);
        }
    }
    return superError;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:CubaListSelect.java

示例11: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
    ErrorMessage superError = super.getErrorMessage();
    if (!isReadOnly() && isRequired() && isEmpty()) {
        ErrorMessage error = AbstractErrorMessage.getErrorMessageForException(
                new com.vaadin.data.Validator.EmptyValueException(getRequiredError()));
        if (error != null) {
            return new CompositeErrorMessage(superError, error);
        }
    }

    return superError;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:CubaSourceCodeEditor.java

示例12: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
    ErrorMessage superError = super.getErrorMessage();
    if (!textArea.isReadOnly() && isRequired() && textArea.isEmpty()) {
        ErrorMessage error = AbstractErrorMessage.getErrorMessageForException(
                new com.vaadin.data.Validator.EmptyValueException(getRequiredError()));
        if (error != null) {
            return new CompositeErrorMessage(superError, error);
        }
    }

    return superError;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:CubaResizableTextAreaWrapper.java

示例13: createTextFieldImpl

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
protected CubaTextArea createTextFieldImpl() {
    return new CubaTextArea() {
        @Override
        public void setComponentError(ErrorMessage componentError) {
            if (componentError instanceof UserError) {
                super.setComponentError(componentError);
            } else {
                wrapper.setComponentError(componentError);
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:WebResizableTextArea.java

示例14: createComponent

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
protected void createComponent() {
    this.component = new CubaSearchSelect() {
        @Override
        public void setPropertyDataSource(Property newDataSource) {
            if (newDataSource == null) {
                super.setPropertyDataSource(null);
            } else {
                super.setPropertyDataSource(new LookupPropertyAdapter(newDataSource));
            }
        }

        @Override
        public void setComponentError(ErrorMessage componentError) {
            boolean handled = false;
            if (componentErrorHandler != null) {
                handled = componentErrorHandler.handleError(componentError);
            }

            if (!handled) {
                super.setComponentError(componentError);
            }
        }
    };

    getSearchComponent().setFilterHandler(this::executeSearch);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:28,代码来源:WebSearchField.java

示例15: getErrorMessage

import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
    try {
        validate();
    } catch (Validator.InvalidValueException ignore) {
    }
    return getContent().getErrorMessage();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:9,代码来源:WebDataGrid.java


注:本文中的com.vaadin.server.ErrorMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。