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 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 String TEMPLATE_PATH
           
protected static List<String> validEmbedTags
           
protected static List<String> validObjectTags
           
protected static List<String> validParamTags
           
static String WRAPPER_TEMPLATE_PATH
           
 
Constructor Summary
AbstractEmbeddedResourceRenderer()
           
 
Method Summary
protected  String getDefaultHeight()
          Returns the default height of the embedded object for when no height is specified.
protected  String getDefaultWidth()
          Returns the default width of the embedded object for when no width is specified.
protected abstract  Map<String,Object> refineParams(Attachment attachment, Map<String,Object> properties)
          Provides the opportunity for a specialisation to customise any parameters / properties.
 String renderResource(EmbeddedObject resource, com.atlassian.renderer.RenderContext context)
          Render the embedded resource to a string.
protected  Map<String,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.
 
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 String TEMPLATE_PATH
See Also:
Constant Field Values

WRAPPER_TEMPLATE_PATH

public static final String WRAPPER_TEMPLATE_PATH
See Also:
Constant Field Values

validObjectTags

protected static final List<String> validObjectTags

validEmbedTags

protected static final List<String> validEmbedTags

validParamTags

protected static final List<String> validParamTags
Constructor Detail

AbstractEmbeddedResourceRenderer

public AbstractEmbeddedResourceRenderer()
Method Detail

setupObjectProperties

protected Map<String,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 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 Map<String,Object> refineParams(Attachment attachment,
                                                   Map<String,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 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 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.


Copyright © 2003-2012 Atlassian. All Rights Reserved.