public class RenderContext extends Object implements RenderContextOutputType
Components may manipulate the RenderContext - for example to change the render mode before passing the context to some sub-component, but all components must ensure that they return the context to its original state before passing control back to the Renderer.
The RenderContext also holds a reference to the RenderedContentStore that is to be used throughout
the rendering process.
RenderedContentStoreDISPLAY, EMAIL, FEED, HTML_EXPORT, PDF, PREVIEW, WORD| Modifier | Constructor and Description |
|---|---|
|
RenderContext()
Construct a new render context in a default state.
|
protected |
RenderContext(RenderedContentStore store)
The Confluence PageContext needs this so that sub-rendered pages can inherit the RenderedContentStore
of their parents.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addExternalReference(Link link) |
void |
addParam(Object key,
Object value) |
String |
addRenderedContent(Object content)
Convenience method so people don't have to keep retrieving the renderedcontentstore.
|
String |
addRenderedContent(Object content,
TokenType type)
Convenience method so people don't have to keep retrieving the renderedcontentstore, but can still report
whether their content is a block or inline fragment.
|
boolean |
equals(Object o) |
String |
getAttachmentsPath() |
String |
getBaseUrl()
Retrieve the confluence instances base url, useful when generating absolute references.
|
String |
getCharacterEncoding() |
EmbeddedResourceRenderer |
getEmbeddedResourceRenderer()
Retrieve the embedded resource renderer for this rendering run.
|
List<Link> |
getExternalReferences() |
String |
getImagePath()
Get the URL path to the image directory for this rendering.
|
LinkRenderer |
getLinkRenderer()
Retrieve the link renderer for this rendering run
|
String |
getOutputType()
Returns the output type that is configured for the PageContext
|
Object |
getParam(Object key) |
Map<Object,Object> |
getParams() |
RenderedContentStore |
getRenderedContentStore()
Get this rendering's RenderedContentStore
|
RenderMode |
getRenderMode()
Get the current render mode.
|
String |
getSiteRoot()
Get the root URL of the site on which the rendering is occurring
|
int |
hashCode() |
boolean |
isRenderingForWysiwyg() |
RenderMode |
popRenderMode()
Return to the render mode that was current before
pushRenderMode(com.atlassian.renderer.v2.RenderMode) was last called |
void |
pushRenderMode(RenderMode renderMode)
Push a new RenderMode onto the stack.
|
void |
setAttachmentsPath(String attachmentsPath) |
void |
setBaseUrl(String baseUrl) |
void |
setCharacterEncoding(String characterEncoding) |
void |
setEmbeddedResourceRenderer(EmbeddedResourceRenderer renderer)
Set the embedded resource renderer for this rendering run.
|
void |
setImagePath(String imagePath)
Set the URL path to the image directory for this rendering.
|
void |
setLinkRenderer(LinkRenderer linkRenderer)
Set the link renderer for this rendering run (exports might need different link
rendering behaviour, for example);
|
void |
setOutputType(String outputType) |
void |
setRenderingForWysiwyg(boolean renderingForWysiwyg) |
void |
setSiteRoot(String siteRoot)
Set the root URL of the site on which the rendering is occurring.
|
public RenderContext()
protected RenderContext(RenderedContentStore store)
public RenderMode getRenderMode()
public void pushRenderMode(RenderMode renderMode)
getRenderMode(). If you call this method, you must also call
popRenderMode() once you have completed the operation that requires the new mode.renderMode - the new current render modepublic RenderMode popRenderMode()
pushRenderMode(com.atlassian.renderer.v2.RenderMode) was last calledpublic RenderedContentStore getRenderedContentStore()
public String addRenderedContent(Object content)
content - the content to storepublic String addRenderedContent(Object content, TokenType type)
content - the content to storetype - should be TokenType.INLINE if the content is an inline fragment of markup,
or TokenType.BLOCK if it is a block level fragment such as a paragraph.
element such as a paragraph.public String getImagePath()
public void setImagePath(String imagePath)
imagePath - the URL path to the root of the image directory. No trailing "/".public void setSiteRoot(String siteRoot)
siteRoot - the root URL of the site on which the rendering is occurringpublic String getSiteRoot()
public void setLinkRenderer(LinkRenderer linkRenderer)
linkRenderer - the link renderer to use for this runpublic LinkRenderer getLinkRenderer()
public void setEmbeddedResourceRenderer(EmbeddedResourceRenderer renderer)
public EmbeddedResourceRenderer getEmbeddedResourceRenderer()
public String getAttachmentsPath()
public void setAttachmentsPath(String attachmentsPath)
public boolean equals(Object o)
equals in class ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public void setBaseUrl(String baseUrl)
public String getBaseUrl()
public boolean isRenderingForWysiwyg()
public void setRenderingForWysiwyg(boolean renderingForWysiwyg)
public void addExternalReference(Link link)
public String getCharacterEncoding()
public void setCharacterEncoding(String characterEncoding)
public String getOutputType()
RenderContextOutputTypepublic void setOutputType(String outputType)
Copyright © 2019 Atlassian. All rights reserved.