info.magnolia.module.templating
Class MagnoliaTemplatingUtilities

java.lang.Object
  extended by info.magnolia.module.templating.MagnoliaTemplatingUtilities

public class MagnoliaTemplatingUtilities
extends java.lang.Object

This is an object exposing a couple of methods useful for templates; it's exposed in templates as "mgnl".

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Field Summary
protected  RenderingEngine renderingEngine
           
 
Constructor Summary
MagnoliaTemplatingUtilities()
           
 
Method Summary
 java.lang.String createAttribute(java.lang.String name, java.lang.String value)
          Util method to create html attributes name="value".
 java.lang.String createLink(info.magnolia.cms.core.Content node)
           
 java.lang.String createLink(info.magnolia.cms.core.NodeData nd)
           
 java.lang.String createLink(java.lang.String repositoryId, java.lang.String uuid)
           
static info.magnolia.cms.core.Content decode(info.magnolia.cms.core.Content content)
           
static info.magnolia.cms.core.Content encode(info.magnolia.cms.core.Content content)
           
 info.magnolia.cms.core.Content getContent(java.lang.String path)
           
 info.magnolia.cms.core.Content getContent(java.lang.String repository, java.lang.String path)
           
 info.magnolia.cms.core.Content getContentByUUID(java.lang.String uuid)
           
 info.magnolia.cms.core.Content getContentByUUID(java.lang.String repository, java.lang.String uuid)
           
static MagnoliaTemplatingUtilities getInstance()
           
protected  java.io.Writer getWriter()
          TODO each renderer should provide its own subclass.
 info.magnolia.cms.core.Content i18n(info.magnolia.cms.core.Content node)
           
 info.magnolia.cms.core.Content inherit(info.magnolia.cms.core.Content node)
           
 boolean isAuthorInstance()
           
 boolean isEditMode()
           
 boolean isPreviewMode()
           
 boolean isPublicInstance()
           
 void renderParagraph(info.magnolia.cms.core.Content paragraphNode)
           
 void renderParagraph(info.magnolia.cms.core.Content paragraphNode, java.io.Writer out)
           
 void renderParagraph(info.magnolia.cms.core.Content paragraphNode, java.io.Writer out, java.lang.String paragraphName)
           
 void renderTemplate(info.magnolia.cms.core.Content content)
           
 void renderTemplate(info.magnolia.cms.core.Content content, java.io.Writer out)
           
 void renderTemplate(info.magnolia.cms.core.Content content, java.io.Writer out, java.lang.String templateName)
           
 info.magnolia.cms.util.SiblingsHelper siblings(info.magnolia.cms.core.Content node)
          Returns an instance of SiblingsHelper for the given node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

renderingEngine

protected RenderingEngine renderingEngine
Constructor Detail

MagnoliaTemplatingUtilities

public MagnoliaTemplatingUtilities()
Method Detail

getInstance

public static MagnoliaTemplatingUtilities getInstance()

siblings

public info.magnolia.cms.util.SiblingsHelper siblings(info.magnolia.cms.core.Content node)
                                               throws javax.jcr.RepositoryException
Returns an instance of SiblingsHelper for the given node.

Throws:
javax.jcr.RepositoryException

renderTemplate

public void renderTemplate(info.magnolia.cms.core.Content content)
                    throws RenderException,
                           java.io.IOException
Throws:
RenderException
java.io.IOException

renderTemplate

public void renderTemplate(info.magnolia.cms.core.Content content,
                           java.io.Writer out)
                    throws RenderException,
                           java.io.IOException
Throws:
RenderException
java.io.IOException

renderTemplate

public void renderTemplate(info.magnolia.cms.core.Content content,
                           java.io.Writer out,
                           java.lang.String templateName)
                    throws RenderException,
                           java.io.IOException
Throws:
RenderException
java.io.IOException

renderParagraph

public void renderParagraph(info.magnolia.cms.core.Content paragraphNode)
                     throws RenderException,
                            java.io.IOException
Throws:
RenderException
java.io.IOException

renderParagraph

public void renderParagraph(info.magnolia.cms.core.Content paragraphNode,
                            java.io.Writer out)
                     throws RenderException,
                            java.io.IOException
Throws:
RenderException
java.io.IOException

renderParagraph

public void renderParagraph(info.magnolia.cms.core.Content paragraphNode,
                            java.io.Writer out,
                            java.lang.String paragraphName)
                     throws RenderException,
                            java.io.IOException
Throws:
RenderException
java.io.IOException

getWriter

protected java.io.Writer getWriter()
TODO each renderer should provide its own subclass.


inherit

public info.magnolia.cms.core.Content inherit(info.magnolia.cms.core.Content node)

i18n

public info.magnolia.cms.core.Content i18n(info.magnolia.cms.core.Content node)

isEditMode

public boolean isEditMode()

isPreviewMode

public boolean isPreviewMode()

isAuthorInstance

public boolean isAuthorInstance()

isPublicInstance

public boolean isPublicInstance()

createLink

public java.lang.String createLink(info.magnolia.cms.core.Content node)

createLink

public java.lang.String createLink(info.magnolia.cms.core.NodeData nd)

createLink

public java.lang.String createLink(java.lang.String repositoryId,
                                   java.lang.String uuid)

createAttribute

public java.lang.String createAttribute(java.lang.String name,
                                        java.lang.String value)
Util method to create html attributes name="value". If the value is empty an empty string will be returned. This is mainlly helpful to avoid empty attributes.


getContent

public info.magnolia.cms.core.Content getContent(java.lang.String path)

getContent

public info.magnolia.cms.core.Content getContent(java.lang.String repository,
                                                 java.lang.String path)

getContentByUUID

public info.magnolia.cms.core.Content getContentByUUID(java.lang.String uuid)

getContentByUUID

public info.magnolia.cms.core.Content getContentByUUID(java.lang.String repository,
                                                       java.lang.String uuid)

encode

public static info.magnolia.cms.core.Content encode(info.magnolia.cms.core.Content content)

decode

public static info.magnolia.cms.core.Content decode(info.magnolia.cms.core.Content content)


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.