Package net.sourceforge.rtf

Examples of net.sourceforge.rtf.ITemplateEngine


            RTFTemplateBuilder builder = RTFTemplateBuilder.newRTFTemplateBuilder();
           
            /**
             * 2. Get velocity engine
             */
            ITemplateEngine velocityEngine =
                builder.newTemplateEngine(RTFTemplateBuilder.VELOCITY_ENGINE);
           
            /**
             * 3. Set the template
             */
            StringReader template = new StringReader("Today : ${date}");
            velocityEngine.setTemplate(template);           
           
            /**
             * 4. Put context
             */
            velocityEngine.put("date", new Date());
           
            /**
             * 5. Merge context with template
             */
            StringWriter writer = new StringWriter();
            velocityEngine.merge(writer);
           
            // => Result of merge
            System.out.println(writer.getBuffer());
        }
        catch(Exception e) {
View Full Code Here


            RTFTemplateBuilder builder = RTFTemplateBuilder.newRTFTemplateBuilder();
           
            /**
             * 2. Get freemarker engine
             */
            ITemplateEngine freemarkerEngine =
                builder.newTemplateEngine(RTFTemplateBuilder.FREEMARKER_ENGINE);
           
            /**
             * 3. Set the template
             */
            StringReader template = new StringReader("Today : ${date}");
            freemarkerEngine.setTemplate(template);           
           
            /**
             * 4. Put context
             */
            freemarkerEngine.put("date", "12/02/2007");
           
            /**
             * 5. Merge context with template
             */
            StringWriter writer = new StringWriter();
            freemarkerEngine.merge(writer);
           
            // => Result of merge
            System.out.println(writer.getBuffer());
        }
        catch(Exception e) {
View Full Code Here

     * @return
     * @throws UnsupportedTemplateEngine
     */
    public ITemplateEngine newTemplateEngine(String templateEngineType)
        throws UnsupportedTemplateEngine {
        ITemplateEngine templateEngine = (ITemplateEngine)
                applicationContext.getBean(templateEngineType);
        if (templateEngine == null)
            throw new UnsupportedTemplateEngine(templateEngineType);
        return templateEngine;
    }
View Full Code Here

            builder = RTFTemplateBuilder.newRTFTemplateBuilder(rtfTemplateConfig);
       
        /**
         * 2. Get template engine
         */
        ITemplateEngine templateEngine =
            builder.newTemplateEngine(getTemplateEngineType());
       
        /**
         * 3. Set the template
         */
        templateEngine.setTemplate(new FileReader(modelSourceFile));
       
        /**
         * 4. Put Context
         */       
        IContext context = templateEngine.initializeContext();       
        putContext(context);  
               
        /**
         * 5. Merge model and context
         */
        templateEngine.merge(modelOutput);  
               
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.rtf.ITemplateEngine

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.