Examples of TemplateEngine


Examples of evolaris.framework.async.business.TemplateEngine

  public void checkAll() {
    checkProvided("sortLabel", "smssvc.labelMustBeProvided");
    check(blogId != null, "blogId", "smssvc.blogMustBeProvided");
   
    // Validate template-placeholders
    TemplateEngine templateEngine = new TemplateEngine();
    check(templateEngine.validateBlogTemplate(getTitle()), "title", "smssvc.illegalPlaceholdersFound");
    check(templateEngine.validateBlogTemplate(getContent()), "content", "smssvc.illegalPlaceholdersFound");
   
    Long minImageWidth = checkLong("maxImageWidth", "smssvc.invalidIntegerValue");
    if(minImageWidth != null){
      check(minImageWidth > 0, "maxImageWidth", "smssvc.invalidValue");
    }
View Full Code Here

Examples of groovy.text.TemplateEngine

  @Test
  public void defaultTemplateEngine() throws Exception {
    this.configurer.setApplicationContext(this.applicationContext);
    this.configurer.afterPropertiesSet();

    TemplateEngine engine = this.configurer.getTemplateEngine();
    assertNotNull(engine);
    assertEquals(MarkupTemplateEngine.class, engine.getClass());

    MarkupTemplateEngine markupEngine = (MarkupTemplateEngine) engine;
    TemplateConfiguration configuration = markupEngine.getTemplateConfiguration();
    assertNotNull(configuration);
    assertEquals(GroovyMarkupConfigurer.class, configuration.getClass());
View Full Code Here

Examples of net.asfun.jangod.template.TemplateEngine

  @Override
  public void afterPropertiesSet() throws Exception {
    if ( configurationFile != null ) {
      Application application = new Application(configurationFile);
      engine = new TemplateEngine(application);
    } else {
      engine = new TemplateEngine();
    }
    if ( root != null ) {
      engine.getConfiguration().setWorkspace(root);
    }
  }
View Full Code Here

Examples of ninja.template.TemplateEngine

            }
        }
           
           
        // try to get a suitable rendering engine...
        TemplateEngine templateEngine = templateEngineManager
                .getTemplateEngineForContentType(result.getContentType());

        if (templateEngine != null) {

            templateEngine.invoke(context, result);

        } else {
            throw new NinjaException(
                    404,
                    "No template engine found for result content type "
View Full Code Here

Examples of org.andromda.core.templateengine.TemplateEngine

            }
            this.getLibrary().populateTemplateContext(templateContext);

            try
            {
                final TemplateEngine engine = this.getLibrary().getTemplateEngine();

                final StringWriter output = new StringWriter();
                engine.processTemplate(
                    this.getTemplate(),
                    templateContext,
                    output);
                final String outputString = output.toString();
                final BufferedReader input = new BufferedReader(new StringReader(outputString));
View Full Code Here

Examples of org.apache.struts2.components.template.TemplateEngine

        return new Template(templateDir, theme, template);

    }

    protected void mergeTemplate(Writer writer, Template template) throws Exception {
        final TemplateEngine engine = templateEngineManager.getTemplateEngine(template, templateSuffix);
        if (engine == null) {
            throw new ConfigurationException("Unable to find a TemplateEngine for template " + template);
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("Rendering template " + template);
        }

        final TemplateRenderingContext context = new TemplateRenderingContext(template, writer, getStack(), getParameters(), this);
        engine.renderTemplate(context);
    }
View Full Code Here

Examples of org.apache.struts2.components.template.TemplateEngine

        if (theme == null) {
            // Theme not supported, so do what struts would have done if we were not here.
            if (LOG.isDebugEnabled()) {
                LOG.debug("Theme not found [#0] trying default template engine using template type [#1]", t.getTheme(), defaultTemplateType);
            }
            final TemplateEngine engine = templateEngineManager.getTemplateEngine(templateContext.getTemplate(), defaultTemplateType);

            if (engine == null) {
                // May be the default template has changed?
                throw new ConfigurationException("Unable to find a TemplateEngine for template type '" + defaultTemplateType
                        + "' whilst trying to render template " + templateContext.getTemplate());
            } else {
                try {
                    // Retry render
                    engine.renderTemplate(templateContext);
                } catch (Exception e) {
                    // Give up and throw a new StrutsException(e);
                    throw new StrutsException("Cannot render tag [" + t.getName() + "] because theme ["
                            + t.getTheme() + "] was not found.", e);
                }
View Full Code Here

Examples of org.apache.struts2.components.template.TemplateEngine

        mgr.setDefaultTemplateType("jsp");
    }
   
    public void testTemplateTypeFromTemplateNameAndDefaults() {
       
        TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
        assertTrue(engine instanceof JspTemplateEngine);
        engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), null);
        assertTrue(engine instanceof VelocityTemplateEngine);
    }
View Full Code Here

Examples of org.apache.struts2.components.template.TemplateEngine

        engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), null);
        assertTrue(engine instanceof VelocityTemplateEngine);
    }

    public void testTemplateTypeOverrides() {
        TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), "ftl");
        assertTrue(engine instanceof FreemarkerTemplateEngine);
        engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), "ftl");
        assertTrue(engine instanceof VelocityTemplateEngine);
        engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.ftl"), "");
        assertTrue(engine instanceof FreemarkerTemplateEngine);
View Full Code Here

Examples of org.apache.struts2.components.template.TemplateEngine

        assertTrue(engine instanceof FreemarkerTemplateEngine);
    }

    public void testTemplateTypeUsesDefaultWhenNotSetInConfiguration() {
        mgr.setDefaultTemplateType(null);
        TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
        Template template = new Template("/template", "simple", "foo." + TemplateEngineManager.DEFAULT_TEMPLATE_TYPE);
        TemplateEngine defaultTemplateEngine = mgr.getTemplateEngine(template, null);
        assertTrue(engine.getClass().equals(defaultTemplateEngine.getClass()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.