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()
           
 
Method Summary
 String createAttribute(String name, String value)
          Util method to create html attributes name="value".
 String createLink(info.magnolia.cms.core.Content node)
           
 String createLink(info.magnolia.cms.core.NodeData nd)
           
 String createLink(String repositoryId, 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(String path)
           
 info.magnolia.cms.core.Content getContent(String repository, String path)
           
 info.magnolia.cms.core.Content getContentByUUID(String uuid)
           
 info.magnolia.cms.core.Content getContentByUUID(String repository, String uuid)
           
static MagnoliaTemplatingUtilities getInstance()
           
protected  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, Writer out)
           
 void renderParagraph(info.magnolia.cms.core.Content paragraphNode, Writer out, String paragraphName)
           
 void renderTemplate(info.magnolia.cms.core.Content content)
           
 void renderTemplate(info.magnolia.cms.core.Content content, Writer out)
           
 void renderTemplate(info.magnolia.cms.core.Content content, Writer out, 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,
                           IOException
Throws:
RenderException
IOException

renderTemplate

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

renderTemplate

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

renderParagraph

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

renderParagraph

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

renderParagraph

public void renderParagraph(info.magnolia.cms.core.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 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 String createLink(info.magnolia.cms.core.Content node)

createLink

public String createLink(info.magnolia.cms.core.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 info.magnolia.cms.core.Content getContent(String path)

getContent

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

getContentByUUID

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

getContentByUUID

public info.magnolia.cms.core.Content getContentByUUID(String repository,
                                                       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.