Package freemarker.template

Examples of freemarker.template.Configuration


    super.setUp();
    ClassPath classPath =
        new ClassPathFactory().createFromPaths("src/test/java", "core/src/test/java");
    SourceLoader loader = new SourceLoader(classPath);
    report = new SourceReportGenerator(new GradeCategories(0, 0), loader, null, new CostModel(),
            new Date(), 10, new Configuration());
    computer = new MetricComputer(new JavaClassRepository(), null,
            new RegExpWhiteList(), 1);
  }
View Full Code Here


  @Override
  protected void setUp() throws Exception {
    super.setUp();
    out = new StringWriter();
    cfg = new Configuration();
    cfg.setTemplateLoader(new ClassPathTemplateLoader(ReportGeneratorProvider.PREFIX));
  }
View Full Code Here

            throw new IllegalArgumentException(e);
        }
    }

    private Configuration createFreemarkerConfiguration() {
        Configuration retVal = new Configuration();
        retVal.setClassForTemplateLoading(FreeMarkerTemplateEngine.class, "freemarker");
        return retVal;
    }
View Full Code Here

    public TemplateEngine(ClassLoader classLoader, Log log) {
        this.classLoader = classLoader;
        this.log = log;

        cfg = new Configuration();

        // File baseDir = new File(System.getProperty("user.dir"));
        // cfg.setTemplateLoader(new MyTemplateLoader(baseDir));

        cfg.setTemplateLoader(new ResourceTemplateLoader());
View Full Code Here

      freemarker.log.Logger.selectLoggerLibrary(freemarker.log.Logger.LIBRARY_SLF4J);
    } catch (ClassNotFoundException e) {
      throw new IllegalStateException("Error configuring freemarker to use SLF4J", e);
    }

    cfg = new Configuration();

    File baseDir = new File(System.getProperty("user.dir"));
    cfg.setTemplateLoader(new MyTemplateLoader(classLoader, baseDir));

    // Don't put commas into numbers!!
View Full Code Here

    }
  }

  private static class DiffReportFactory {
    public DiffReport buildReport(Diff diff) {
      return new DiffReport(diff, new Configuration());
    }
View Full Code Here

   */
  public ReportGenerator build(CostModel costModel, ReportModel reportModel,
      SourceLoader sourceLoader) {
    SourceLinker linker = new SourceLinker(
        options.getSrcFileLineUrl(), options.getSrcFileUrl());
    Configuration cfg = new Configuration();
    cfg.setTemplateLoader(new ClassPathTemplateLoader(PREFIX));
    BeansWrapper objectWrapper = new DefaultObjectWrapper();
    cfg.setObjectWrapper(objectWrapper);
    ResourceBundleModel bundleModel = new ResourceBundleModel(getBundle("messages"),
        objectWrapper);

    ReportGenerator report;
    switch (reportFormat) {
View Full Code Here

            throw new ViewGenerationFailedForTemplate(resource, e);
        }
    }

    private Configuration configure() {
        Configuration configuration = new Configuration();
        configuration.setClassForTemplateLoading(FreemarkerViewGenerator.class, "/");
        configuration.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
        return configuration;
    }
View Full Code Here

            ResourceLoader resourceLoader,
            Properties settings,
            Map sharedVariables) throws TemplateException {

        ResourceLoaderTemplateLoader templateLoader = new ResourceLoaderTemplateLoader(resourceLoader);
        Configuration configuration = new Configuration();
        configuration.setTemplateLoader(templateLoader);

        for (Iterator vars = sharedVariables.entrySet().iterator(); vars.hasNext();) {
            Map.Entry var = (Map.Entry)vars.next();
            configuration.setSharedVariable((String)var.getKey(), var.getValue());
        }

        if (settings != null) {
            configuration.setSettings(settings);
        }

        return configuration;
    }
View Full Code Here

            Properties settings,
            Map sharedVariables,
            ObjectWrapper objectWrapper) throws TemplateException {

        ResourceLoaderTemplateLoader templateLoader = new ResourceLoaderTemplateLoader(resourceLoader);
        Configuration configuration = new Configuration();
        configuration.setTemplateLoader(templateLoader);

        for (Iterator vars = sharedVariables.entrySet().iterator(); vars.hasNext();) {
            Map.Entry var = (Map.Entry)vars.next();
            configuration.setSharedVariable((String)var.getKey(), var.getValue());
        }

        if (settings != null) {
            configuration.setSettings(settings);
        }

        if (objectWrapper != null) {
            configuration.setObjectWrapper(objectWrapper);
        }

        return configuration;
    }
View Full Code Here

TOP

Related Classes of freemarker.template.Configuration

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.