Package org.ajax4jsf.templatecompiler.builder

Examples of org.ajax4jsf.templatecompiler.builder.TemplateCompiler


//         
//          baseclass = baseclass.getSuperclass();
//            } while (baseclass != null);
//        }
       
        TemplateCompiler templateCompiler = new TemplateCompiler();
        InputStream templateStream = new FileInputStream(template);
        templateCompiler.processing(templateStream, rendererBean);
        renderer.setClassname(rendererBean.getFullClassName());
        String resultPath = rendererBean.getComponentFileName();
        if (null == getPackage()) {
          resultPath = resultPath.replace('.', '/');
        } else {
          resultPath = getPackage().replace('.', '/') + "/"
              + resultPath;
        }

        File javaFile = new File(getDestDir(), resultPath + ".java");
        File javaDir = javaFile.getParentFile();
        if (!javaDir.exists()) {
          javaDir.mkdirs();
        }
        if (javaFile.exists()) {
          if (renderer.isOverride()) {
            javaFile.delete();
          } else {
            return;
          }
        }
        Writer out = new BufferedWriter(new FileWriter(javaFile));
        templateCompiler.generateCode(rendererBean, out);
        out.flush();
        out.close();
      } catch (Exception e) {
        throw new GeneratorException(
            "Error create Renderer Java file ", e);
View Full Code Here


            template = new File(getTemplates(), templateString);
          } else {
            template = new File(templateString);
          }

          TemplateCompiler templateCompiler = new TemplateCompiler();
          InputStream templateStream = new FileInputStream(template);
          templateCompiler.processing(templateStream,
              compilationContext);

          TemplateElement root = compilationContext.getTree();

          String classname = renderer.getClassname();
View Full Code Here

    ClassLoader loader = getClassLoader();

    try {

      CompilationContext componentBean = new AntCompilationContext(this,loader);
      TemplateCompiler templateCompiler = new TemplateCompiler();

      // componentBean.setDefaultVariables();

      InputStream inputStream = null;
      File inputFile = new File(sFileTemplate);
      String sF = inputFile.getName().toString();

      componentBean.setFullClassName(generateJavaClassName(sF));

      inputStream = new FileInputStream(inputFile);

      templateCompiler.processing(inputStream, componentBean);

      String resultPath = componentBean.getComponentFileName() + ".java";
      File javaFile = new File(getDestdir(), resultPath);
      File javaDir = javaFile.getParentFile();
      if (!javaDir.exists()) {
        javaDir.mkdirs();
      } // try

      if (javaFile.exists()) {
        javaFile.delete();
      } // if

      Writer out = new BufferedWriter(new FileWriter(javaFile));
     
      templateCompiler.generateCode(componentBean, out);

      out.flush();
      out.close();
    } catch (FileNotFoundException e) {
      throw new BuildException(e);
View Full Code Here

TOP

Related Classes of org.ajax4jsf.templatecompiler.builder.TemplateCompiler

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.