Package com.vaadin.data.Validator

Examples of com.vaadin.data.Validator.InvalidValueException


        if (getConverter() != null) {
            try {
                valueToValidate = getConverter().convertToModel(fieldValue,
                        getModelType(), getLocale());
            } catch (ConversionException e) {
                throw new InvalidValueException(getConversionError(
                        getConverter().getModelType(), e));
            }
        }

        List<InvalidValueException> validationExceptions = new ArrayList<InvalidValueException>();
View Full Code Here


   
    // Set id field to be unique
    form.getField("id").addValidator(new Validator() {
      public void validate(Object value) throws InvalidValueException {
        if (!isValid(value)) {
          throw new InvalidValueException(i18nManager.getMessage(Messages.GROUP_ID_UNIQUE));
        }
      }
      public boolean isValid(Object value) {
        if (value != null) {
          return identityService.createGroupQuery().groupId(value.toString()).singleResult() == null;
View Full Code Here

   
    // Set id field to be unique
    form.getField("id").addValidator(new Validator() {
      public void validate(Object value) throws InvalidValueException {
        if (!isValid(value)) {
          throw new InvalidValueException(i18nManager.getMessage(Messages.USER_ID_UNIQUE));
        }
      }
      public boolean isValid(Object value) {
        if (value != null) {
          return identityService.createUserQuery().userId(value.toString()).singleResult() == null;
View Full Code Here

    // Force validation of the fields
    form.commit();
   
    // Check if file is uploaded
    if(!fileUploaded) {
      InvalidValueException ive = new InvalidValueException(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_REQUIRED));
      form.setComponentError(ive);
      throw ive;
    }
   
    if(attachment != null) {
View Full Code Here

                form.commit();
            }
            for (DictionaryItemExtensionWrapper ext : modifiedValue) {
                for (DictionaryItemExtensionWrapper otherExt : modifiedValue) {
                    if (ext != otherExt && ext.getName().equals(otherExt.getName())) {
                        throw new InvalidValueException(getMessage("validate.item.ext.name.duplicate").replaceFirst("%s", ext.getName()));
                    }
                }
            }
        }
    }
View Full Code Here

            }
            for (DictionaryItemValueWrapper val : modifiedValue) {
                Date startDate = val.getValidStartDate();
                Date endDate = val.getValidEndDate();
                if (endDate != null && startDate != null && endDate.before(startDate)) {
                    throw new InvalidValueException(getMessage("validate.item.val.dates"));
                }
            }
            boolean startDateFullRange = false, endDateFullRange = false;
            for (DictionaryItemValueWrapper val : modifiedValue) {
                startDateFullRange = validateSingleDate(startDateFullRange, val, val.getValidStartDate());
View Full Code Here

    }

    private boolean validateSingleDate(boolean fullRangeFound, DictionaryItemValueWrapper val, Date date) {
        if (date == null) {
            if (fullRangeFound) {
                throw new InvalidValueException(getMessage("validate.item.val.dates"));
            }
            else {
                fullRangeFound = true;
            }
        }
        else {
            for (DictionaryItemValueWrapper otherVal : modifiedValue) {
                if (val != otherVal && otherVal.isValidForDate(date)) {
                    throw new InvalidValueException(getMessage("validate.item.val.dates"));
                }
            }
        }
        return fullRangeFound;
    }
View Full Code Here

        if (getConverter() != null) {
            try {
                valueToValidate = getConverter().convertToModel(fieldValue,
                        getModelType(), getLocale());
            } catch (ConversionException e) {
                throw new InvalidValueException(getConversionError(
                        getConverter().getModelType(), e));
            }
        }

        List<InvalidValueException> validationExceptions = new ArrayList<InvalidValueException>();
View Full Code Here

   
    // Set id field to be unique
    form.getField("id").addValidator(new Validator() {
      public void validate(Object value) throws InvalidValueException {
        if (!isValid(value)) {
          throw new InvalidValueException(i18nManager.getMessage(Messages.USER_ID_UNIQUE));
        }
      }
      public boolean isValid(Object value) {
        if (value != null) {
          return identityService.createUserQuery().userId(value.toString()).singleResult() == null;
View Full Code Here

    // Force validation of the fields
    form.commit();
   
    // Check if file is uploaded
    if(!fileUploaded) {
      InvalidValueException ive = new InvalidValueException(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_REQUIRED));
      form.setComponentError(ive);
      throw ive;
    }
   
    if(attachment != null) {
View Full Code Here

TOP

Related Classes of com.vaadin.data.Validator.InvalidValueException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.