Package org.zkoss.bind

Examples of org.zkoss.bind.Validator


    return service;
  }
 
  //validators for prompt
  public Validator getPriceValidator(){
    return new Validator(){
      public void validate(ValidationContext ctx) {
        Double price = (Double)ctx.getProperty().getValue();
        if(price==null || price<=0){
          ctx.setInvalid(); // mark invalid
          validationMessages.put("price", "must large than 0");
View Full Code Here


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

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

        ctx.getBindContext().getBinder().notifyChange(validationMessages, "creationDate");
      }
    };
  }
  public Validator getShippingDateValidator(){
    return new Validator(){
      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

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.