Examples of SimpleHash


Examples of freemarker.template.SimpleHash

            // get the configuration and template
            Configuration config = freemarkerManager.getConfiguration(servletContext);
            Template template = config.getTemplate(decorator.getPage(), getLocale(ctx.getActionInvocation(), config)); // WW-1181

            // get the main hash
            SimpleHash model = freemarkerManager.buildTemplateModel(ctx.getValueStack(), null, servletContext, req, res, config.getObjectWrapper());

            // populate the hash with the page
            model.put("page", page);
            if (page instanceof HTMLPage) {
                HTMLPage htmlPage = ((HTMLPage) page);
                model.put("head", htmlPage.getHead());
            }
            model.put("title",page.getTitle());
            model.put("body",page.getBody());
            model.put("page.properties", new SimpleHash(page.getProperties()));

            // finally, render it
            template.process(model, res.getWriter());
        } catch (Exception e) {
            String msg = "Error applying decorator: " + e.getMessage();
View Full Code Here

Examples of freemarker.template.SimpleHash

        }

        ActionInvocation ai = ActionContext.getContext().getActionInvocation();

        Object action = (ai == null) ? null : ai.getAction();
        SimpleHash model = freemarkerManager.buildTemplateModel(stack, action, servletContext, req, res, config.getObjectWrapper());

        model.put("tag", templateContext.getTag());
        model.put("themeProperties", getThemeProps(templateContext.getTemplate()));

        // the BodyContent JSP writer doesn't like it when FM flushes automatically --
        // so let's just not do it (it will be flushed eventually anyway)
        Writer writer = templateContext.getWriter();
        if (bodyContent != null && bodyContent.isAssignableFrom(writer.getClass())) {
View Full Code Here

Examples of freemarker.template.SimpleHash

    if (!props.isEmpty()) {
      config.setSettings(props);
    }

    if (!CollectionUtils.isEmpty(this.freemarkerVariables)) {
      config.setAllSharedVariables(new SimpleHash(this.freemarkerVariables, config.getObjectWrapper()));
    }

    if (this.defaultEncoding != null) {
      config.setDefaultEncoding(this.defaultEncoding);
    }
View Full Code Here

Examples of freemarker.template.SimpleHash

    if (!props.isEmpty()) {
      config.setSettings(props);
    }

    if (!CollectionUtils.isEmpty(this.freemarkerVariables)) {
      config.setAllSharedVariables(new SimpleHash(this.freemarkerVariables));
    }

    if (this.defaultEncoding != null) {
      config.setDefaultEncoding(this.defaultEncoding);
    }
View Full Code Here

Examples of freemarker.template.SimpleHash

    protected SimpleHash getContext(RunData data)
    {
        // Attempt to get it from the TemplateInfo first.  If it
        // doesn't exist, create it and then stuff it into the
        // TemplateInfo.
        SimpleHash context = (SimpleHash)data.getTemplateInfo()
            .getTemplateContext(FreeMarkerService.CONTEXT);
        if (context == null)
        {
            FreeMarkerService fm = (FreeMarkerService)TurbineServices
                .getInstance().getService(FreeMarkerService.SERVICE_NAME);
View Full Code Here

Examples of freemarker.template.SimpleHash

     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate(RunData data)
        throws Exception
    {
        SimpleHash context = getContext(data);
        String templateName = TurbineTemplate.getScreenTemplateName(
            data.getTemplateInfo().getScreenTemplate() );

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
View Full Code Here

Examples of freemarker.template.SimpleHash

     * @exception Exception, a generic exception.
     */
    public void doBuild( RunData data )
        throws Exception
    {
         SimpleHash context = getContext(data);

        // First, generate the screen and put it in the context so we
        // can grab it the layout template.
        ConcreteElement results = ScreenLoader.getInstance()
            .eval(data, data.getScreen());
        String screenValue = "";
        if (results != null)
        {
            screenValue = results.toString();
        }
        context.put("screen_placeholder", new SimpleScalar(screenValue));

        // Variable to reference the navigation templates in the
        // layout template.
        context.put("navigation", new NavigationModel(data));

        // Grab the layout template set in the WebMacroSitePage.  If
        // null, then use the default layout template ( done by the
        // TemplateInfo object ).
        String templateName = data.getTemplateInfo().getLayoutTemplate();
View Full Code Here

Examples of freemarker.template.SimpleHash

    protected SimpleHash getContext(RunData data)
    {
        // Attempt to get it from the TemplateInfo first.  If it
        // doesn't exist, create it and then stuff it into the
        // TemplateInfo.
        SimpleHash context = (SimpleHash)data.getTemplateInfo()
            .getTemplateContext(FreeMarkerService.CONTEXT);
        if (context == null)
        {
            FreeMarkerService fm = (FreeMarkerService)TurbineServices
                .getInstance().getService(FreeMarkerService.SERVICE_NAME);
View Full Code Here

Examples of freemarker.template.SimpleHash

     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate(RunData data)
        throws Exception
    {
        SimpleHash context = getContext(data);
        String templateName = data.getTemplateInfo().getNavigationTemplate();
        FreeMarkerService fm = (FreeMarkerService)
            TurbineServices.getInstance().getService(FreeMarkerService.SERVICE_NAME);

        StringElement output = new StringElement();
View Full Code Here

Examples of freemarker.template.SimpleHash

            // get the configuration and template
            Configuration config = freemarkerManager.getConfiguration(servletContext);
            Template template = config.getTemplate(decorator.getPage(), getLocale(ctx.getActionInvocation(), config)); // WW-1181

            // get the main hash
            SimpleHash model = freemarkerManager.buildTemplateModel(ctx.getValueStack(), null, servletContext, req, res, config.getObjectWrapper());

            // populate the hash with the page
            model.put("page", page);
            if (page instanceof HTMLPage) {
                HTMLPage htmlPage = ((HTMLPage) page);
                model.put("head", htmlPage.getHead());
            }
            model.put("title",page.getTitle());
            model.put("body",page.getBody());
            model.put("page.properties", new SimpleHash(page.getProperties()));

            // finally, render it
            template.process(model, res.getWriter());
        } catch (Exception e) {
            String msg = "Error applying decorator: " + e.getMessage();
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.