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(Content node)
           
 java.lang.String createLink(NodeData nd)
           
 java.lang.String createLink(java.lang.String repositoryId, java.lang.String uuid)
           
static Content decode(Content content)
           
static Content encode(Content content)
           
 Content getContent(java.lang.String path)
           
 Content getContent(java.lang.String repository, java.lang.String path)
           
 Content getContentByUUID(java.lang.String uuid)
           
 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.
 Content i18n(Content node)
           
 Content inherit(Content node)
           
 boolean isAuthorInstance()
           
 boolean isEditMode()
           
 boolean isPreviewMode()
           
 boolean isPublicInstance()
           
 void renderParagraph(Content paragraphNode)
           
 void renderParagraph(Content paragraphNode, java.io.Writer out)
           
 void renderParagraph(Content paragraphNode, java.io.Writer out, java.lang.String paragraphName)
           
 void renderTemplate(Content content)
           
 void renderTemplate(Content content, java.io.Writer out)
           
 void renderTemplate(Content content, java.io.Writer out, java.lang.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

public MagnoliaTemplatingUtilities()
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,
                           java.io.IOException
Throws:
RenderException
java.io.IOException

renderTemplate

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

renderTemplate

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

renderParagraph

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

renderParagraph

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

renderParagraph

public void renderParagraph(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 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 java.lang.String createLink(Content node)

createLink

public java.lang.String createLink(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 Content getContent(java.lang.String path)

getContent

public Content getContent(java.lang.String repository,
                          java.lang.String path)

getContentByUUID

public Content getContentByUUID(java.lang.String uuid)

getContentByUUID

public Content getContentByUUID(java.lang.String repository,
                                java.lang.String uuid)

encode

public static Content encode(Content content)

decode

public static Content decode(Content content)


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