info.magnolia.module.templating
Class MagnoliaTemplatingUtilities

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

public class MagnoliaTemplatingUtilities
extends 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(RenderingEngine renderingEngine)
           
 
Method Summary
 String createAttribute(String name, String value)
          Util method to create html attributes name="value".
 String createLink(Content node)
           
 String createLink(NodeData nd)
           
 String createLink(String repositoryId, String uuid)
           
static Content decode(Content content)
           
static Content encode(Content content)
           
 Content getContent(String path)
           
 Content getContent(String repository, String path)
           
 Content getContentByUUID(String uuid)
           
 Content getContentByUUID(String repository, String uuid)
           
static MagnoliaTemplatingUtilities getInstance()
           
protected  Writer getWriter()
          TODO each renderer should provide its own subclass.
 Content i18n(Content node)
           
 Content inherit(Content node)
           
 boolean isAuthorInstance()
           
 boolean isEditMode()
           
 boolean isPreviewMode()
           
 boolean isPublicInstance()
           
 void renderParagraph(Content paragraphNode)
           
 void renderParagraph(Content paragraphNode, Writer out)
           
 void renderParagraph(Content paragraphNode, Writer out, String paragraphName)
           
 void renderTemplate(Content content)
           
 void renderTemplate(Content content, Writer out)
           
 void renderTemplate(Content content, Writer out, String templateName)
           
 SiblingsHelper siblings(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

@Inject
public MagnoliaTemplatingUtilities(RenderingEngine renderingEngine)
Method Detail

getInstance

public static MagnoliaTemplatingUtilities getInstance()

siblings

public SiblingsHelper siblings(Content node)
                        throws javax.jcr.RepositoryException
Returns an instance of SiblingsHelper for the given node.

Throws:
javax.jcr.RepositoryException

renderTemplate

public void renderTemplate(Content content)
                    throws RenderException,
                           IOException
Throws:
RenderException
IOException

renderTemplate

public void renderTemplate(Content content,
                           Writer out)
                    throws RenderException,
                           IOException
Throws:
RenderException
IOException

renderTemplate

public void renderTemplate(Content content,
                           Writer out,
                           String templateName)
                    throws RenderException,
                           IOException
Throws:
RenderException
IOException

renderParagraph

public void renderParagraph(Content paragraphNode)
                     throws RenderException,
                            IOException
Throws:
RenderException
IOException

renderParagraph

public void renderParagraph(Content paragraphNode,
                            Writer out)
                     throws RenderException,
                            IOException
Throws:
RenderException
IOException

renderParagraph

public void renderParagraph(Content paragraphNode,
                            Writer out,
                            String paragraphName)
                     throws RenderException,
                            IOException
Throws:
RenderException
IOException

getWriter

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


inherit

public Content inherit(Content node)

i18n

public Content i18n(Content node)

isEditMode

public boolean isEditMode()

isPreviewMode

public boolean isPreviewMode()

isAuthorInstance

public boolean isAuthorInstance()

isPublicInstance

public boolean isPublicInstance()

createLink

public String createLink(Content node)

createLink

public String createLink(NodeData nd)

createLink

public String createLink(String repositoryId,
                         String uuid)

createAttribute

public String createAttribute(String name,
                              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 Content getContent(String path)

getContent

public Content getContent(String repository,
                          String path)

getContentByUUID

public Content getContentByUUID(String uuid)

getContentByUUID

public Content getContentByUUID(String repository,
                                String uuid)

encode

public static Content encode(Content content)

decode

public static Content decode(Content content)


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