本文整理汇总了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);
}
示例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);
}
};
}
示例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())});
}
示例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);
}
}
示例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;
}
示例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;
}
示例7: displayError
import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
protected void displayError(final ErrorMessage errorMessage, final ErrorEvent event)
{
if (component != null)
{
component.setComponentError(errorMessage);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
};
}
示例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);
}
示例15: getErrorMessage
import com.vaadin.server.ErrorMessage; //导入依赖的package包/类
@Override
public ErrorMessage getErrorMessage() {
try {
validate();
} catch (Validator.InvalidValueException ignore) {
}
return getContent().getErrorMessage();
}