com.atlassian.confluence.plugins.macros.core.renderer
Class AbstractEmbeddedResourceRenderer

java.lang.Object
  extended by com.atlassian.confluence.plugins.macros.core.renderer.AbstractEmbeddedResourceRenderer
All Implemented Interfaces:
EmbeddedResourceRenderer
Direct Known Subclasses:
EmbeddedAudioRenderer, EmbeddedFlashRenderer, EmbeddedMp4Renderer, EmbeddedQuickTimeRenderer, EmbeddedRealMediaRenderer, EmbeddedVideoRenderer, EmbeddedWindowsMediaRenderer

public abstract class AbstractEmbeddedResourceRenderer
extends java.lang.Object
implements EmbeddedResourceRenderer

The basic implementation for an embedded resource renderer. Renderers can extend this class to build a standard object element.


Field Summary
static java.lang.String TEMPLATE_PATH
           
protected static java.util.List<java.lang.String> validEmbedTags
           
protected static java.util.List<java.lang.String> validObjectTags
           
protected static java.util.List<java.lang.String> validParamTags
           
static java.lang.String WRAPPER_TEMPLATE_PATH
           
 
Constructor Summary
AbstractEmbeddedResourceRenderer()
           
 
Method Summary
protected  java.lang.String getDefaultHeight()
          Returns the default height of the embedded object for when no height is specified.
protected  java.lang.String getDefaultWidth()
          Returns the default width of the embedded object for when no width is specified.
protected  com.atlassian.xwork.XsrfTokenGenerator getXsrfTokenGenerator()
           
protected abstract  java.util.Map<java.lang.String,java.lang.Object> refineParams(Attachment attachment, java.util.Map<java.lang.String,java.lang.Object> properties)
          Provides the opportunity for a specialisation to customise any parameters / properties.
 java.lang.String renderResource(EmbeddedObject resource, com.atlassian.renderer.RenderContext context)
          Render the embedded resource to a string.
protected  java.util.Map<java.lang.String,java.lang.Object> setupObjectProperties(EmbeddedObject emObject, com.atlassian.renderer.RenderContext context)
          Retrieves the attachment from an EmbeddedResource, resolving the absolute URL to the attachment and placing it into a ContextMap for use with Velocity.
 void setXsrfTokenGenerator(com.atlassian.xwork.XsrfTokenGenerator xsrfTokenGenerator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.renderer.embedded.EmbeddedResourceRenderer
matchesType
 

Field Detail

TEMPLATE_PATH

public static final java.lang.String TEMPLATE_PATH
See Also:
Constant Field Values

WRAPPER_TEMPLATE_PATH

public static final java.lang.String WRAPPER_TEMPLATE_PATH
See Also:
Constant Field Values

validObjectTags

protected static final java.util.List<java.lang.String> validObjectTags

validEmbedTags

protected static final java.util.List<java.lang.String> validEmbedTags

validParamTags

protected static final java.util.List<java.lang.String> validParamTags
Constructor Detail

AbstractEmbeddedResourceRenderer

public AbstractEmbeddedResourceRenderer()
Method Detail

setupObjectProperties

protected java.util.Map<java.lang.String,java.lang.Object> setupObjectProperties(EmbeddedObject emObject,
                                                                                 com.atlassian.renderer.RenderContext context)
Retrieves the attachment from an EmbeddedResource, resolving the absolute URL to the attachment and placing it into a ContextMap for use with Velocity.

Parameters:
emObject - the EmbeddedObject object
context - the RenderContext
Returns:
ContextMap containing the embedded resource properties and URL

renderResource

public java.lang.String renderResource(EmbeddedObject resource,
                                       com.atlassian.renderer.RenderContext context)
Description copied from interface: EmbeddedResourceRenderer
Render the embedded resource to a string.

Specified by:
renderResource in interface EmbeddedResourceRenderer
Parameters:
resource - to be rendered
context - of render
Returns:
html source for the object element

refineParams

protected abstract java.util.Map<java.lang.String,java.lang.Object> refineParams(Attachment attachment,
                                                                                 java.util.Map<java.lang.String,java.lang.Object> properties)
Provides the opportunity for a specialisation to customise any parameters / properties. e.g. Setting the width and height based on the actual content.

Parameters:
attachment - the attachment to process
properties - the parameters to be added to or altered
Returns:
a new/updated map of parameters

getDefaultWidth

protected java.lang.String getDefaultWidth()
Returns the default width of the embedded object for when no width is specified.

Value will be directly rendered into the HTML.

Returns:
the default width. May be null, in which case no width is rendered unless supplied. The default value returned is null if not overriden.

getDefaultHeight

protected java.lang.String getDefaultHeight()
Returns the default height of the embedded object for when no height is specified.

Value will be directly rendered into the HTML.

Returns:
the default height. May be null, in which case no height is rendered unless supplied. The default value returned is null if not overriden.

setXsrfTokenGenerator

public void setXsrfTokenGenerator(com.atlassian.xwork.XsrfTokenGenerator xsrfTokenGenerator)

getXsrfTokenGenerator

protected com.atlassian.xwork.XsrfTokenGenerator getXsrfTokenGenerator()


Copyright © 2003-2014 Atlassian. All Rights Reserved.