Package org.zkoss.bind.validator

Examples of org.zkoss.bind.validator.AbstractValidator


*/
public class OrderFormVM extends OrderVM3{

  @Override
  public Validator getShippingDateValidator() {
    return new AbstractValidator(){
      public void validate(ValidationContext ctx) {
        Date shipping = (Date)ctx.getProperties("shippingDate")[0].getValue();
        Date creation = (Date)ctx.getProperties("creationDate")[0].getValue();
        //do dependent validation, shipping date have to large than creation more than 3 days.
        if(!CaldnearUtil.isDayAfter(creation,shipping,3)){
View Full Code Here


    return FakeOrderService.getInstance();
  }
 
  //validators for prompt
  public Validator getPriceValidator(){
    return new AbstractValidator(){
      public void validate(ValidationContext ctx) {
        Double price = (Double)ctx.getProperty().getValue();
        if(price==null || price<=0){
          addInvalidMessage(ctx, "must large than 0");
        }
View Full Code Here

      }
    };
  }
 
  public Validator getQuantityValidator(){
    return new AbstractValidator(){
      public void validate(ValidationContext ctx) {
        Integer quantity = (Integer)ctx.getProperty().getValue();
        if(quantity==null || quantity<=0){
          addInvalidMessage(ctx, "must large than 0");
        }
View Full Code Here

*/
public class OrderVM2 extends OrderVM{

  //validators for command
  public Validator getCreationDateValidator(){
    return new AbstractValidator(){
      public void validate(ValidationContext ctx) {
        Date creation = (Date)ctx.getProperty().getValue();
        if(creation==null){
          addInvalidMessage(ctx,"must not null");
        }
View Full Code Here

        }
      }
    };
  }
  public Validator getShippingDateValidator(){
    return new AbstractValidator(){
      public void validate(ValidationContext ctx) {
        Date shipping = (Date)ctx.getProperty().getValue();//the main property
        Date creation = (Date)ctx.getProperties("creationDate")[0].getValue();//the collected
        //do mixed validation, shipping date have to large than creation more than 3 days.
        if(!CaldnearUtil.isDayAfter(creation,shipping,3)){
View Full Code Here

TOP

Related Classes of org.zkoss.bind.validator.AbstractValidator

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.