Package freemarker.cache

Examples of freemarker.cache.TemplateLoader


  private StackLayout stackLayout = new StackLayout();
  private BrowserFunction linkClick;
  private IWorkspace currentWorkspace;
 
  public ScanInfoView() {
    final TemplateLoader loader = createTemplateLoader();
    if(loader == null)
      renderer = null;
    else
      renderer = new AlertRenderer(loader);
  }
View Full Code Here


    // Register template loaders that are supposed to kick in late.
    if (this.postTemplateLoaders != null) {
      this.templateLoaders.addAll(this.postTemplateLoaders);
    }

    TemplateLoader loader = getAggregateTemplateLoader(this.templateLoaders);
    if (loader != null) {
      config.setTemplateLoader(loader);
    }

    postProcessConfiguration(config);
View Full Code Here

   
    /**
     * Set the explicit directory from which to load templates.
     */
    public void setDirectoryForTemplateLoading(File dir) throws IOException {
        TemplateLoader tl = getTemplateLoader();
        if (tl instanceof FileTemplateLoader) {
            String path = ((FileTemplateLoader) tl).baseDir.getCanonicalPath();
            if (path.equals(dir.getCanonicalPath()))
                return;
        }
View Full Code Here

        try {
            if (servletContext != null) {

                WebappTemplateLoader webappTemplateLoader = new WebappTemplateLoader(servletContext);

                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl, webappTemplateLoader };

            } else {
                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl };
            }
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
View Full Code Here

    // Register template loaders that are supposed to kick in late.
    if (this.postTemplateLoaders != null) {
      templateLoaders.addAll(this.postTemplateLoaders);
    }

    TemplateLoader loader = getAggregateTemplateLoader(templateLoaders);
    if (loader != null) {
      config.setTemplateLoader(loader);
    }

    postProcessConfiguration(config);
View Full Code Here

        try {
            if (servletContext != null) {

                WebappTemplateLoader webappTemplateLoader = new WebappTemplateLoader(servletContext);

                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl, webappTemplateLoader };

            } else {
                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl };
            }
        } catch (IOException e) {
            logger.error(e.getMessage());
        }
View Full Code Here

     * @param templatePath the template path to create a loader for
     * @return a newly created template loader
     * @throws IOException
     */
    protected TemplateLoader createTemplateLoader(ServletContext servletContext, String templatePath) {
        TemplateLoader templatePathLoader = null;

         try {
             if(templatePath!=null){
                 if (templatePath.startsWith("class://")) {
                     // substring(7) is intentional as we "reuse" the last slash
View Full Code Here

        loader.setUIThemeExpansionToken("~~~");

        TemplateEngine engine = mock(TemplateEngine.class);
        loader.setTemplateEngine(engine);

        TemplateLoader parent = mock(TemplateLoader.class);
        when(parent.findTemplateSource("template/foo/bar/text.ftl")).thenReturn(new Object());

        loader.init(parent);

        // when
        Object actual = loader.findTemplateSource("template/~~~foo/bar/text.ftl");
View Full Code Here

        Map<String, String> props = new HashMap<String, String>();
        props.put("parent", "foo/foo");
        when(engine.getThemeProps(Matchers.argThat(new IsEqual<Template>(new Template("template", "foo/bar", "text.ftl"))))).thenReturn(props);
        loader.setTemplateEngine(engine);

        TemplateLoader parent = mock(TemplateLoader.class);
        when(parent.findTemplateSource("template/foo/bar/text.ftl")).thenReturn(null);
        when(parent.findTemplateSource("template/foo/foo/text.ftl")).thenReturn(new Object());

        loader.init(parent);

        // when
        Object actual = loader.findTemplateSource("template/~~~foo/bar/text.ftl");
View Full Code Here

     * @param templatePath the template path to create a loader for
     * @return a newly created template loader
     * @throws IOException
     */
    protected TemplateLoader createTemplateLoader(ServletContext servletContext, String templatePath) {
        TemplateLoader templatePathLoader = null;

         try {
             if(templatePath!=null){
                 if (templatePath.startsWith("class://")) {
                     // substring(7) is intentional as we "reuse" the last slash
View Full Code Here

TOP

Related Classes of freemarker.cache.TemplateLoader

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.