Package org.ajax4jsf.builder.config

Examples of org.ajax4jsf.builder.config.ValidatorBean


      }
    }
   
    List<ValidatorBean> validators = new ArrayList<ValidatorBean>();
    for (Iterator iter = config.getValidators().iterator(); iter.hasNext();) {
      ValidatorBean validator = (ValidatorBean) iter.next();
      boolean includeValidator = true;
      // Check include patterns
      if (validator.getTag() != null || validator.getTaghandler() != null) {
        includeValidator = isIncludeComponent(validator);
        if (includeValidator) {
          info("Validator "+validator.getName() +" included to taglib "+getShortname());
          validators.add(validator);
        } else {
          info("Validator "+validator.getName() +" excluded from taglib "+getShortname());           
        }
      }
    }
   
    List<ConverterBean> converters = new ArrayList<ConverterBean>();
View Full Code Here


    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
    context.put("generator",this);
    // Put common properties
    for (Iterator iter = config.getValidators().iterator(); iter.hasNext();) {
      ValidatorBean validator = (ValidatorBean) iter.next();
      info("Create class file "+validator.getClassname());
      if (validator.isGenerate()) {
        context.put("validator", validator);
        context.put("package", validator.getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = validator.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isExist()) {
            importClasses.add(property.getClassname());
          }
        }
        importClasses.add(validator.getSuperclass());
        context.put("imports", importClasses);
        String resultPath = validator.getClassname().replace('.', '/')
            + ".java";
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();
        }
        try {
          if (javaFile.exists()) {
            javaFile.delete();
          }
          Writer out = new BufferedWriter(new FileWriter(javaFile));
          template.merge(context, out);
          out.flush();
          out.close();
        } catch (Exception e) {
          throw new GeneratorException(
              "Error generating validator: " + validator.getClassname(), e);
        }
      }
    }
   
  }
View Full Code Here

          }
        }
      }
         List<ValidatorBean> validators = new ArrayList<ValidatorBean>();
         for (Iterator<ValidatorBean> iter = config.getValidators().iterator(); iter.hasNext();) {
            ValidatorBean validator = iter.next();
            boolean includeComponent = true;
            // Check include patterns
            if (validator.getTag() != null && (validator.getTag().getTaglib() == null || validator.getTag().getTaglib().equals(getShortname()))) {
               includeComponent = isIncludeComponent(validator);
               if (includeComponent) {
                  info("Validator "+validator.getName() +" included in taglib "+getShortname());
                  validators.add(validator);
               } else {
                  info("Validator "+validator.getName() +" excluded from taglib "+getShortname());               
               }
            }
         }
         List<ConverterBean> converters = new ArrayList<ConverterBean>();
         for (Iterator<ConverterBean> iter = config.getConverters().iterator(); iter.hasNext();) {
View Full Code Here

    VelocityContext context = new VelocityContext();
    context.put("generator",this);
    Template template = getTemplate();
    // Put common properties
    for (Iterator iter = config.getValidators().iterator(); iter.hasNext();) {
      ValidatorBean validator = (ValidatorBean) iter.next();
      TagBean tag = validator.getTag();
      if ( null !=  tag && null !=tag.getClassname() && tag.isGenerate()) {
        info("Create tag class file "+validator.getClassname());
        context.put("validator", validator);
       
        context.put("tag", validator.getTag());
        context.put("package", validator.getTag().getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = validator.getProperties().iterator(); it
            .hasNext();) {
          PropertyBean property = (PropertyBean) it.next();
          // For non-primitive types, add import declaration.
          if (!property.isSimpleType() && !property.isHidden()) {
            importClasses.add(property.getClassname());
          }
        }
        importClasses.add(validator.getTag().getSuperclass());
        context.put("imports", importClasses);
        String resultPath = validator.getTag().getClassname().replace('.', '/')
            + ".java";
        File javaFile = new File(getDestDir(), resultPath);
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();
        }
        try {
          if (javaFile.exists()) {
            javaFile.delete();
          }
          Writer out = new BufferedWriter(new FileWriter(javaFile));
          template.merge(context, out);
          out.flush();
          out.close();
        } catch (Exception e) {
          throw new GeneratorException(
              "Error generating JSP Tag Java file for validator " + validator.getName(), e);
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.ajax4jsf.builder.config.ValidatorBean

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.