Package org.apache.wicket.markup.html.form.validation

Examples of org.apache.wicket.markup.html.form.validation.IFormValidator


    if (validator == null)
    {
      throw new IllegalArgumentException("Argument `validator` cannot be null");
    }

    IFormValidator removed = formValidators_remove(validator);
    if (removed == null)
    {
      throw new IllegalStateException(
        "Tried to remove form validator that was not previously added. "
          + "Make sure your validator's equals() implementation is sufficient");
View Full Code Here


  {
    if (formValidators != null)
    {
      if (formValidators instanceof IFormValidator)
      {
        final IFormValidator v = (IFormValidator)formValidators;
        if (v == validator || v.equals(validator))
        {
          return 0;
        }
      }
      else
      {
        final IFormValidator[] validators = (IFormValidator[])formValidators;
        for (int i = 0; i < validators.length; i++)
        {
          final IFormValidator v = validators[i];
          if (v == validator || v.equals(validator))
          {
            return i;
          }
        }
      }
View Full Code Here

  {
    if (formValidators instanceof IFormValidator)
    {
      if (index == 0)
      {
        final IFormValidator removed = (IFormValidator)formValidators;
        formValidators = null;
        return removed;
      }
      else
      {
        throw new IndexOutOfBoundsException();
      }
    }
    else
    {
      final IFormValidator[] validators = (IFormValidator[])formValidators;
      final IFormValidator removed = validators[index];
      // check if we can collapse array of 1 element into a single object
      if (validators.length == 2)
      {
        formValidators = validators[1 - index];
      }
View Full Code Here

  @SuppressWarnings("serial")
  @Override
  protected void init()
  {
    super.init();
    add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        return dependentFormComponents;
      }
View Full Code Here

  @SuppressWarnings("serial")
  @Override
  protected void init()
  {
    super.init();
    add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        return dependentFormComponents;
      }

      @Override
      public void validate(final Form< ? > form)
      {
        if (hrPlanningDao.doesEntryAlreadyExist(data.getId(), data.getUserId(), data.getWeek()) == true) {
          error(getString("hr.planning.entry.error.entryDoesAlreadyExistForUserAndWeekOfYear"));
        }
      }
    });
    add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        if (dependentEntryFormComponentsArray == null) {
          dependentEntryFormComponentsArray = new FormComponent[dependentEntryFormComponents.size()];
View Full Code Here

  @SuppressWarnings("serial")
  @Override
  protected void init()
  {
    super.init();
    add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        return dependentFormComponents;
      }
View Full Code Here

          WicketUtils.addTooltip(createButton, gridBuilder.getString("ldap.gidNumber.createDefault.tooltip"));
        }
      }
    }
    if (posixConfigured == true) {
      add(new IFormValidator() {
        @Override
        public FormComponent< ? >[] getDependentFormComponents()
        {
          return dependentLdapPosixFormComponentsList.toArray(new FormComponent[0]);
        }
View Full Code Here

      personalContact = personalContactDao.getByContactId(contact.getId());
    }
    if (personalContact == null) {
      personalContact = new PersonalContactDO();
    }
    form.add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        return dependentFormComponents;
      }
View Full Code Here

  @SuppressWarnings("serial")
  @Override
  protected void init()
  {
    super.init();
    add(new IFormValidator() {
      @Override
      public FormComponent< ? >[] getDependentFormComponents()
      {
        return dependentFormComponents;
      }
View Full Code Here

          component.setEnabled(false);
        }
      }
    }
    if (posixConfigured == true) {
      add(new IFormValidator() {
        @Override
        public FormComponent< ? >[] getDependentFormComponents()
        {
          return dependentLdapPosixFormComponentsList.toArray(new FormComponent[0]);
        }

        @Override
        public void validate(final Form< ? > form)
        {
          final LdapUserValues values = new LdapUserValues();
          values.setUidNumber(uidNumberField.getConvertedInput());
          values.setGidNumber(gidNumberField.getConvertedInput());
          values.setHomeDirectory(homeDirectoryField.getConvertedInput());
          values.setLoginShell(loginShellField.getConvertedInput());
          if (StringUtils.isBlank(data.getLdapValues()) == true && values.isPosixValuesEmpty() == true) {
            // Nothing to validate: all fields are zero and posix account wasn't set for this user before.
            return;
          }
          if (values.getUidNumber() == null) {
            uidNumberField.error(getLocalizedMessage(WebConstants.I18N_KEY_FIELD_REQUIRED, getString("ldap.uidNumber")));
          } else {
            if (LdapPosixAccountsUtils.isGivenNumberFree(data, values.getUidNumber()) == false) {
              uidNumberField.error(getLocalizedMessage("ldap.uidNumber.alreadyInUse", LdapPosixAccountsUtils.getNextFreeUidNumber()));
            }
          }
          if (values.getGidNumber() == null) {
            gidNumberField.error(getLocalizedMessage(WebConstants.I18N_KEY_FIELD_REQUIRED, getString("ldap.gidNumber")));
          }
          if (StringUtils.isBlank(values.getHomeDirectory()) == true) {
            homeDirectoryField.error(getLocalizedMessage(WebConstants.I18N_KEY_FIELD_REQUIRED, getString("ldap.homeDirectory")));
          }
          if (StringUtils.isBlank(values.getLoginShell()) == true) {
            loginShellField.error(getLocalizedMessage(WebConstants.I18N_KEY_FIELD_REQUIRED, getString("ldap.loginShell")));
          }
        }
      });
    }
    if (sambaConfigured == true) {
      add(new IFormValidator() {
        @Override
        public FormComponent< ? >[] getDependentFormComponents()
        {
          return dependentLdapSambaFormComponentsList.toArray(new FormComponent[0]);
        }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.form.validation.IFormValidator

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.