startDateComponent.setValid(false); throw new ValidatorException(new FacesMessage( FacesMessage.SEVERITY_ERROR, "Start date may not be after end date.", null));
/** * @throws NullPointerException {@inheritDoc} */ public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
/** * @throws NullPointerException {@inheritDoc} */ @Override public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
@Override public void decode(FacesContext context) { // We (re)set to valid, so that component automatically gets (re)validated setValid(true); super.decode(context); }
/** * @throws NullPointerException {@inheritDoc} */ public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
/** * @throws NullPointerException {@inheritDoc} */ @Override public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
public void decode(FacesContext context) { //We (re)set to valid, so that component automatically gets (re)validated setValid(true); super.decode(context); }
/** * @throws NullPointerException {@inheritDoc} */ public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
/** * @throws NullPointerException {@inheritDoc} */ @Override public void decode(FacesContext context) { if (context == null) { throw new NullPointerException(); } // Force validity back to "true" setValid(true); super.decode(context); }
public boolean guestbookResponseValidator( UIInput toValidate, String value) { if (value != null && value.length() > 255) { (toValidate).setValid(false); FacesContext.getCurrentInstance().addMessage((toValidate).getClientId(), new FacesMessage( FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("dataset.guestbookResponse.guestbook.responseTooLong"), null)); return false; } return true; }
private static void invalidateInputsByPropertyPathAndShowMessages(FacesContext context, UIForm form, Object bean, Map<String, String> violations) { for (Entry<String, String> violation : violations.entrySet()) { forEachInputWithMatchingBase(context, form, bean, violation.getKey(), input -> { context.validationFailed(); input.setValid(false); String clientId = input.getClientId(context); addError(clientId, violation.getValue(), getLabel(input)); }); } }
/** * @since 1.2 */ public void resetValue() { super.resetValue(); setSubmittedValue(null); setLocalValueSet(false); setValid(true); }
/** * @since 1.2 */ public void resetValue() { setSubmittedValue(null); setValue(null); setLocalValueSet(false); setValid(true); }
public void setValid(boolean valid) { setupPerspective(); innerGetDelegateInput().setValid(valid); teardownPerspective(); }
@Override public void validate(FacesContext fc, UIComponent uic, Object o) throws ValidatorException { String email = (String) o; if (!UIInput.class.isInstance(uic)) { throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Component type not compatible", "")); } if (!email.matches(".+@.+\\.[a-z]+")) { ((UIInput)uic).setValid(false); throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Email", "")); } }
public void validateUserName(FacesContext context, UIComponent toValidate, Object value) { String userName = (String) value; logger.log(Level.FINE, "Validating username: {0}", userName); boolean userNameFound = authenticationSvc.identifierExists(userName); if (userNameFound) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, BundleUtil.getStringFromBundle("user.username.taken"), null); context.addMessage(toValidate.getClientId(context), message); } }
private static void invalidateInputsByShowMessageForAndShowMessages(FacesContext context, UIForm form, Map<String, String> violations, String showMessageFor) { for (String forId : showMessageFor.split("\\s+")) { UIComponent component = form.findComponent(forId); context.validationFailed(); if (component instanceof UIInput) { ((UIInput) component).setValid(false); } String clientId = component.getClientId(context); addErrors(clientId, violations, getLabel(component)); } }
private static void invalidateInputsByShowMessageForAndShowMessages(FacesContext context, UIForm form, Map<String, String> violations, String showMessageFor) { for (String forId : showMessageFor.split("\\s+")) { UIComponent component = form.findComponent(forId); context.validationFailed(); if (component instanceof UIInput) { ((UIInput) component).setValid(false); } String clientId = component.getClientId(context); addErrors(clientId, violations, getLabel(component)); } }
protected void handleValidationException(FacesContext context, ValidatorException e) { setValid(false); FacesMessage message = e.getFacesMessage(); if (message != null) { message.setSeverity(FacesMessage.SEVERITY_ERROR); context.addMessage(getClientId(context), message); } } }