Package org.ajax4jsf.builder.config

Examples of org.ajax4jsf.builder.config.ConverterBean


      }
    }
   
    List<ConverterBean> converters = new ArrayList<ConverterBean>();
    for (Iterator iter = config.getConverters().iterator(); iter.hasNext();) {
      ConverterBean converter = (ConverterBean) iter.next();
      boolean includeConverter = true;
      // Check include patterns
      if (converter.getTag() != null || converter.getTaghandler() != null) {
        includeConverter = isIncludeComponent(converter);
        if (includeConverter) {
          info("Converter "+converter.getName() +" included to taglib "+getShortname());
          converters.add(converter);
        } else {
          info("Converter "+converter.getName() +" excluded from taglib "+getShortname());           
        }
      }
    }

    List<ListenerBean> listeners = new ArrayList<ListenerBean>();
View Full Code Here


    VelocityContext context = new VelocityContext();
    Template template = getTemplate();
    context.put("generator",this);
    // Put common properties
    for (Iterator iter = config.getConverters().iterator(); iter.hasNext();) {
      ConverterBean converter = (ConverterBean) iter.next();
      info("Create class file "+converter.getClassname());
      if (converter.isGenerate()) {
        context.put("converter", converter);
        context.put("package", converter.getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = converter.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(converter.getSuperclass());
        context.put("imports", importClasses);
        String resultPath = converter.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 converter: " + converter.getClassname(), e);
        }
      }
    }
   
  }
View Full Code Here

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

    VelocityContext context = new VelocityContext();
    context.put("generator",this);
    Template template = getTemplate();
    // Put common properties
    for (Iterator iter = config.getConverters().iterator(); iter.hasNext();) {
      ConverterBean converter = (ConverterBean) iter.next();
      TagBean tag = converter.getTag();
      if ( null !=  tag && null !=tag.getClassname() && tag.isGenerate()) {
        info("Create tag class file "+converter.getClassname());
        context.put("converter", converter);
       
        context.put("tag", converter.getTag());
        context.put("package", converter.getTag().getPackageName());
        Set<String> importClasses = new HashSet<String>();
        for (Iterator it = converter.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(converter.getTag().getSuperclass());
        context.put("imports", importClasses);
        String resultPath = converter.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 " + converter.getName(), e);
        }
      }
    }
  }
View Full Code Here

TOP

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

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.