Clearspace API (1.10.16) Core Javadocs

com.jivesoftware.community
Interface DocumentPresenter

All Superinterfaces:
JiveObject

public interface DocumentPresenter
extends JiveObject

Similar to the DocumentBuilder interface, document presenters allow for organizing the fields of a document type into an optimal layout for display. A document presenter is generated at runtime if a new document presenter has not been created for a given document type, thus administrators do not have to create a document presenter for each document type they define.

As part of the default skin implementation there are 2 'magic' presenter names that if specified will override the autogenerated output, those being 'default' and 'print'.

A document presenter template can be set for this template via the setTemplate(String) method. The document presenter template must be written in the free marker template language (http://freemarker.sourceforge.net).

Document Presenter freemarker templates are given access to the following variables:

If a template is not specified for a document presenter, the system default template will be used. The system default template can be overridden by adding a template to the classpath and specifying the path to that template in the jive property "presenter.default.template".


Method Summary
 java.lang.String getName()
          Returns the identifying name of the document presenter.
 java.lang.String getTemplate()
          Returns the template used to display a document for a particular presenter.
 java.lang.String getTransformedTemplate(Document document, AuthToken auth, java.util.Locale locale)
          Applies the template to a Document and returns the results as a string
 boolean isDefaultTemplate()
          Returns true if this presenter is the default presenter, false otherwise.
 void save()
          Saves the state of this DocuementPresenter to the database
 void setName(java.lang.String name)
          Sets the identifying name of the document presenter.
 void setTemplate(java.lang.String template)
          Sets the template for this presenter.
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getID, getObjectType
 

Method Detail

getName

java.lang.String getName()
Returns the identifying name of the document presenter.

Returns:
the name of the document presenter.

setName

void setName(java.lang.String name)
             throws UnauthorizedException
Sets the identifying name of the document presenter.

Parameters:
name - the name of the document presenter.
Throws:
UnauthorizedException - if not an administrator.

getTemplate

java.lang.String getTemplate()
                             throws PresenterTemplateException
Returns the template used to display a document for a particular presenter. The template returned is likely to include tags and scripting as appropriate to the display mechanism. For example, in the case where the display system is using freemarker the returned template may include freemarker tags

Returns:
the template used to display a document for a particular presenter.
Throws:
PresenterTemplateException - if an error occurs retrieving the template

setTemplate

void setTemplate(java.lang.String template)
                 throws UnauthorizedException
Sets the template for this presenter.

Parameters:
template - the template.
Throws:
UnauthorizedException - if not an administrator.
See Also:
getTemplate()

getTransformedTemplate

java.lang.String getTransformedTemplate(Document document,
                                        AuthToken auth,
                                        java.util.Locale locale)
                                        throws PresenterTemplateException
Applies the template to a Document and returns the results as a string

Parameters:
document - document to apply the template too.
auth - the AuthToken of the page user.
locale - the Locale to use when locating a template.
Returns:
the result from applying a template to a document
Throws:
PresenterTemplateException - If there is a problem processing the template (such as the template is malformed)

save

void save()
          throws UnauthorizedException
Saves the state of this DocuementPresenter to the database

Throws:
UnauthorizedException - If the user is not allowed to modify this document presenter

isDefaultTemplate

boolean isDefaultTemplate()
Returns true if this presenter is the default presenter, false otherwise.

Returns:
true if this presenter is the default presenter, false otherwise.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.