com.atlassian.renderer
Class RenderedContentStore

java.lang.Object
  extended by com.atlassian.renderer.RenderedContentStore

public class RenderedContentStore
extends java.lang.Object

Hides content from the renderer so that it will not be processed any further.

The RenderedContentStore associates blocks of rendered content (or Renderable objects that can later be transformed into rendered content) with tokens. These tokens can then be substituted for the content blocks during the rendering process. At the end of the chain of renderers, all tokens are replaced once more with their associated content blocks.

Using this technique, it is possible to 'hide' content from the renderer, making it unnecessary to perform nasty hacks to prevent the output of macros or renderer components from being broken by subsequent rendering steps.


Field Summary
static java.lang.String BLOCK_TOKEN
          An unlikely-to-appear-in-real-text token, for use in block-replacement
static java.lang.String INLINE_TOKEN
          An unlikely-to-appear-in-real-text token, for use in inline content replacement
static java.lang.String MAP_KEY
          The key under which the store is placed in the render context
 
Constructor Summary
RenderedContentStore()
           
 
Method Summary
 java.lang.String addBlock(java.lang.Object content)
          Put some content block into the store.
 java.lang.String addInline(java.lang.Object content)
          Put some inline content into the store.
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(java.lang.String token)
          Get some content back, given the entire token that was returned from a previous 'add'
static RenderedContentStore getFromRenderContext(RenderContext renderContext)
          Retrieve the store from the render context.
 int hashCode()
           
static java.lang.String stripTokens(java.lang.String text)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_TOKEN

public static final java.lang.String BLOCK_TOKEN
An unlikely-to-appear-in-real-text token, for use in block-replacement

See Also:
Constant Field Values

INLINE_TOKEN

public static final java.lang.String INLINE_TOKEN
An unlikely-to-appear-in-real-text token, for use in inline content replacement

See Also:
Constant Field Values

MAP_KEY

public static final java.lang.String MAP_KEY
The key under which the store is placed in the render context

See Also:
Constant Field Values
Constructor Detail

RenderedContentStore

public RenderedContentStore()
Method Detail

getFromRenderContext

public static RenderedContentStore getFromRenderContext(RenderContext renderContext)
Retrieve the store from the render context. If the store is not in the context, it is created.

Parameters:
renderContext - the render context to retrieve the store from
Returns:
the active store for this context

addBlock

public java.lang.String addBlock(java.lang.Object content)
Put some content block into the store. Returns a token that can be placed in the page to be looked up later. The renderer knows not to draw things like paragraphs around another block.

Parameters:
content - the content to add to the store
Returns:
a token that the ContentReplaceFilter will be able to use to locate the content at a later date.

addInline

public java.lang.String addInline(java.lang.Object content)
Put some inline content into the store. Returns a token that can be placed in the page to be looked up later. Inline elements will be surrounded by paragraphs and have newlines inserted between them as necessary.

Parameters:
content - the content to add to the store
Returns:
a token that the ContentReplaceFilter will be able to use to locate the content at a later date.

get

public java.lang.Object get(java.lang.String token)
Get some content back, given the entire token that was returned from a previous 'add'

Parameters:
token - a token that was returned from a previous add
Returns:
the appropriate content, or null if the content could not be found for that token.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

stripTokens

public static java.lang.String stripTokens(java.lang.String text)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.