Jive Forums API (5.5.20.2-oracle) Core Javadocs

com.jivesoftware.forum.renderer
Class RenderedTextStore

java.lang.Object
  extended by com.jivesoftware.forum.renderer.RenderedTextStore

public class RenderedTextStore
extends java.lang.Object

A store for text snippets. This is mainly to be used by filters and macros as a way to hide content from the renderer so that it will not be further processed.

A filter or macro uses this class by calling the addText method which will return a token that will be used to retrieve the text snippet from the store once all rendering is complete. The token should be inserted into the text stream in place of the added snippet by the filter/macro 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.


Constructor Summary
RenderedTextStore()
           
 
Method Summary
 java.lang.String addText(java.lang.String text)
          Add a text snippet to the store receiving a token in return.
 int getSize()
          Returns the number of items in the store.
 java.lang.String getText(java.lang.String token)
          Retrieve a text snippet from the store.
 java.util.Set getTokens()
          Returns a list of all the tokens in the store.
 java.lang.String replaceTokens(java.lang.String text)
          This method will replace all tokens in the provided string with their original text snippets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderedTextStore

public RenderedTextStore()
Method Detail

addText

public java.lang.String addText(java.lang.String text)
Add a text snippet to the store receiving a token in return.

Parameters:
text - the text snippet to add to the store
Returns:
a token to be used to retrieve the text snippet

getText

public java.lang.String getText(java.lang.String token)
Retrieve a text snippet from the store.

Parameters:
token - the token received when adding the text to the store
Returns:
the text snippet associated with the token, or null if no association exists.

getSize

public int getSize()
Returns the number of items in the store.

Returns:
the number of items in the store.

getTokens

public java.util.Set getTokens()
Returns a list of all the tokens in the store.

Returns:
a list of all the tokens in the store.

replaceTokens

public java.lang.String replaceTokens(java.lang.String text)
This method will replace all tokens in the provided string with their original text snippets.

Parameters:
text - the string to replace all tokens within
Returns:
the text with all tokens replaced with their original text snippets

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.