Examples of Validatable


Examples of com.googlecode.richrest.server.action.Validatable

  public Serializable intercept(Action<Serializable, Serializable> action,
      Serializable model) throws Exception {
    Action<Serializable, Serializable> srcAction = ActionContext.getContext().getAction();
    if (srcAction instanceof Validatable) {
      Validatable validationAction = (Validatable)srcAction;
      Validator validator = validationAction.getValidator();
      if (validator != null)
        validator.validate(model);
    }
    return action.execute(model);
  }
View Full Code Here

Examples of com.vaadin.data.Validatable

        final List<String> errors = new ArrayList<String>();
        new ComponentEvaluator<Property>(boundProperties) {
            @Override
            public void evaluate(Property component, WidgetElement element) throws Exception {
                if (component instanceof Validatable) {
                    Validatable validatable = (Validatable) component;
                    try {
                        validatable.validate();
                    } catch (InvalidValueException e) {
                        errors.add(e.getMessage());
                    }
                }
                if (!component.isReadOnly()) {
View Full Code Here

Examples of com.volantis.mcs.model.validation.Validatable

        // Prepare each proxy for validation.
        PREPARE_4_VALIDATION.prepare(proxy);

        // Validate the model.
        Validator validator = MODEL_FACTORY.createValidator();
        Validatable validatable = (Validatable) proxy.getModelObject();
        validator.validate(validatable);

        // Get the diagnostics and iterate over them associating them with
        // the relevant proxy.
        List diagnostics = validator.getDiagnostics();
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

        "firstname.middlename@lastname.dk", "buy@something.nu", "user@post.inet.tele.dk",
        "read@my.info", "my @email.com", "my@ email.com", "\"John Doe\"@email.com",
        "no@domain", "german@m�dchen.de", "another.german@�m��l.com" };
    for (String emailAddress : validEmails)
    {
      Validatable validatable = new Validatable(emailAddress);
      validator.validate(validatable);
      assertTrue(emailAddress + " wasn't valid but should be", validatable.isValid());
    }
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

        ".dot.in.the.beginning.is.not.good@wicketframework.org", " space@front.com",
        "space@back.com ", "\ttab@front.com", "tab@back.com\t" };

    for (String emailAddress : inValidEmails)
    {
      Validatable validatable = new Validatable(emailAddress);
      validator.validate(validatable);
      assertFalse(emailAddress + " was valid but shouldn't be", validatable.isValid());
    }
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

  /**
   * @throws Exception
   */
  public void testNegative() throws Exception
  {
    Validatable validatable = new Validatable(new Integer(-1));
    NumberValidator.NEGATIVE.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Integer(0));
    NumberValidator.NEGATIVE.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Integer(1));
    NumberValidator.NEGATIVE.validate(validatable);
    assertEquals(1, validatable.getErrors().size());
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

  /**
   * @throws Exception
   */
  public void testPositive() throws Exception
  {
    Validatable validatable = new Validatable(new Integer(-1));
    NumberValidator.POSITIVE.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Integer(0));
    NumberValidator.POSITIVE.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Integer(1));
    NumberValidator.POSITIVE.validate(validatable);
    assertEquals(0, validatable.getErrors().size());
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

   */
  public void testDoubleRange() throws Exception
  {
    NumberValidator range = NumberValidator.range(1.1, 1.8);

    Validatable validatable = new Validatable(new Double(1));
    range.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Double(1.1));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(1.5));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(1.8));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(2));
    range.validate(validatable);
    assertEquals(1, validatable.getErrors().size());
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

   */
  public void testDoubleMaximum() throws Exception
  {
    NumberValidator range = NumberValidator.maximum(1.8);

    Validatable validatable = new Validatable(new Double(-100.8));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(1));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(1.8));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(2));
    range.validate(validatable);
    assertEquals(1, validatable.getErrors().size());
  }
View Full Code Here

Examples of org.apache.wicket.validation.Validatable

   */
  public void testDoubleMinimum() throws Exception
  {
    NumberValidator range = NumberValidator.minimum(1.8);

    Validatable validatable = new Validatable(new Double(-100.8));
    range.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Double(1));
    range.validate(validatable);
    assertEquals(1, validatable.getErrors().size());

    validatable = new Validatable(new Double(1.8));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());

    validatable = new Validatable(new Double(2));
    range.validate(validatable);
    assertEquals(0, validatable.getErrors().size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.