當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractComponent.setComponentError方法代碼示例

本文整理匯總了Java中com.vaadin.ui.AbstractComponent.setComponentError方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractComponent.setComponentError方法的具體用法?Java AbstractComponent.setComponentError怎麽用?Java AbstractComponent.setComponentError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.AbstractComponent的用法示例。


在下文中一共展示了AbstractComponent.setComponentError方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setValidationError

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
protected void setValidationError(String errorMessage) {
    if (getComposition() instanceof AbstractComponent) {
        AbstractComponent composition = (AbstractComponent) getComposition();
        if (errorMessage == null) {
            composition.setComponentError(null);
        } else {
            composition.setComponentError(new UserError(errorMessage));
        }
    }
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:11,代碼來源:WebAbstractComponent.java

示例2: setValidationMessages

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
public static void setValidationMessages(List<String> validationMessages, AbstractComponent component) {
	if (validationMessages.isEmpty()) {
		component.setComponentError(null);
	} else if (validationMessages.size() == 1) {
		component.setComponentError(new UserError(validationMessages.get(0)));
	} else {
		ErrorMessage[] errorMessages = new ErrorMessage[validationMessages.size()];
		for (int i = 0; i<validationMessages.size(); i++) {
			errorMessages[i] = new UserError(validationMessages.get(i));
		}
		CompositeErrorMessage compositeErrorMessage = new CompositeErrorMessage(errorMessages);
		component.setComponentError(compositeErrorMessage);
	}
}
 
開發者ID:BrunoEberhard,項目名稱:minimal-j,代碼行數:15,代碼來源:VaadinIndication.java

示例3: clearMValidationErrors

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
private void clearMValidationErrors() {
    for (AbstractComponent value : mValidationErrors.values()) {
        if (value != null) {
            value.setComponentError(null);
        }
    }
    mValidationErrors.clear();
    for (AbstractComponent ac : validatorToErrorTarget.values()) {
        ac.setComponentError(null);
    }
}
 
開發者ID:viritin,項目名稱:viritin,代碼行數:12,代碼來源:MBeanFieldGroup.java

示例4: doDefault

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
public static void doDefault(ErrorEvent event) {
    Throwable t = event.getThrowable();
    if (t instanceof SocketException) {
        // Most likely client browser closed socket
        getLogger().info(
                "SocketException in CommunicationManager."
                        + " Most likely client (browser) closed socket.");
        return;
    }

    t = findRelevantThrowable(t);
    
    /*
     * Handle SpringSecurity 
     */
    if (t instanceof AccessDeniedException) {
    	
    	EventBus eventBus = SpringApplicationContext.getEventBus();
    	eventBus.publish(EventScope.UI, eventBus, new AccessDeniedEvent(t));
    	
    	getLogger().log(Level.FINE, "Access is denied", t);
    	return;
    }

    // Finds the original source of the error/exception
    AbstractComponent component = findAbstractComponent(event);
    if (component != null) {
        // Shows the error in AbstractComponent
        ErrorMessage errorMessage = AbstractErrorMessage
                .getErrorMessageForException(t);
        component.setComponentError(errorMessage);
    }

    // also print the error on console
    getLogger().log(Level.SEVERE, "", t);
}
 
開發者ID:markoradinovic,項目名稱:Vaadin4Spring-MVP-Sample-SpringSecurity,代碼行數:37,代碼來源:SpringSecurityErrorHandler.java

示例5: jsr303ValidateBean

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
protected boolean jsr303ValidateBean(T bean) {
    try {
        if (javaxBeanValidator == null) {
            javaxBeanValidator = getJavaxBeanValidatorFactory().getValidator();
        }
    } catch (Throwable t) {
        // This may happen without JSR303 validation framework
        Logger.getLogger(getClass().getName()).fine(
            "JSR303 validation failed");
        return true;
    }

    boolean containsAtLeastOneBoundComponentWithError = false;
    Set<ConstraintViolation<T>> constraintViolations = new HashSet<>(
        javaxBeanValidator.validate(bean, getValidationGroups()));
    if (constraintViolations.isEmpty()) {
        return true;
    }
    Iterator<ConstraintViolation<T>> iterator = constraintViolations.
        iterator();
    while (iterator.hasNext()) {
        ConstraintViolation<T> constraintViolation = iterator.next();
        Class<? extends Annotation> annotationType = constraintViolation.
            getConstraintDescriptor().getAnnotation().
            annotationType();
        AbstractComponent errortarget = validatorToErrorTarget.get(
            annotationType);
        if (errortarget != null) {
            // user has declared a target component for this constraint
            errortarget.setComponentError(new UserError(
                constraintViolation.getMessage()));
            iterator.remove();
            containsAtLeastOneBoundComponentWithError = true;
        }
        // else leave as "bean level error"
    }
    this.jsr303beanLevelViolations = constraintViolations;
    if (!containsAtLeastOneBoundComponentWithError && isValidateOnlyBoundFields()) {
        return true;
    }
    return false;
}
 
開發者ID:viritin,項目名稱:viritin,代碼行數:43,代碼來源:MBeanFieldGroup.java

示例6: setComponentErrorMessage

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
public void setComponentErrorMessage(AbstractComponent c, String message) {
	c.setComponentError(new UserError(message));
}
 
開發者ID:lizardtechblog,項目名稱:ExpressZip,代碼行數:4,代碼來源:ExportOptionsViewComponent.java

示例7: clearComponentErrorMessage

import com.vaadin.ui.AbstractComponent; //導入方法依賴的package包/類
public void clearComponentErrorMessage(AbstractComponent c) {
	c.setComponentError(null);
}
 
開發者ID:lizardtechblog,項目名稱:ExpressZip,代碼行數:4,代碼來源:ExportOptionsViewComponent.java


注:本文中的com.vaadin.ui.AbstractComponent.setComponentError方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。