Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.renderer
Class AbstractRenderFilter

java.lang.Object
  extended by com.jivesoftware.forum.renderer.AbstractRenderFilter
All Implemented Interfaces:
RenderFilter
Direct Known Subclasses:
AbstractJiveClassicRenderFilter, AbstractRegexTokenRenderFilter, EmailFilter, EmoticonFilter, ForumMacro, HostNameFilter, HTMLFilter, JIRAFilter, MessageMacro, MSWordToTextFilter, NoFormatFilter, ProfanityFilter, QuoteCleanupFilter, QuoteFilter, QuoteMacro, RegexReplaceFilter, TextColorMacro, TextFontMacro, TextSizeMacro, ThreadMacro, URLFilter, UserMacro, WikiEscapeFilter, WikiFilter, WikiTableCleanupFilter, WordBreakFilter

public abstract class AbstractRenderFilter
extends java.lang.Object
implements RenderFilter

An abstract implementation of the RenderFilter interface this class provides subclasses with built in support for documentation and splits apart the execute method into seperate methods depending on the render target specified in the render context.


Constructor Summary
AbstractRenderFilter()
           
 
Method Summary
 java.lang.String execute(java.lang.String string, RenderContext renderContext)
          Applies the filter to the passed in string and returns the filtered string.
protected abstract  java.lang.String executeHtmlTarget(java.lang.String string, RenderContext renderContext)
          This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_HTML.
protected abstract  java.lang.String executeNoMarkupTarget(java.lang.String string, RenderContext renderContext)
          This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_NO_MARKUP.
protected abstract  java.lang.String executePlainEmailTarget(java.lang.String string, RenderContext renderContext)
          This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_PLAIN_EMAIL.
protected abstract  java.lang.String executePlainTextTarget(java.lang.String string, RenderContext renderContext)
          This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_PLAIN_TEXT.
protected abstract  java.lang.String executeWysiwygEditorTarget(java.lang.String string, RenderContext renderContext)
          This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_WYSIWYG_EDITOR.
protected abstract  java.lang.String[] getDefaultHelp()
          Returns a String[section,title,body] for the default help for the filter.
protected abstract  java.util.Map getDocumentationMap()
          Returns a documentation Map keyed by languageCode -> String[section,title,body].
abstract  java.lang.String getName()
          Returns the unique name of the filter.
 java.lang.String[] getUserDocumentation(java.lang.String language)
          Returns a string array of [section,title, body] of xml formatted documentation that is targetted for end user usage.
 boolean isEnabled()
          Returns true if the filter is enabled, false otherwise.
protected abstract  boolean isEnabledByDefault()
          Returns true if the filter should be enabled by default, false otherwise.
 void setEnabled(boolean enabled)
          Sets whether the filter is enabled or disabled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRenderFilter

public AbstractRenderFilter()
Method Detail

getName

public abstract java.lang.String getName()
Description copied from interface: RenderFilter
Returns the unique name of the filter.

Specified by:
getName in interface RenderFilter
Returns:
the unique name of the filter.

isEnabled

public boolean isEnabled()
Description copied from interface: RenderFilter
Returns true if the filter is enabled, false otherwise.

Specified by:
isEnabled in interface RenderFilter
Returns:
true if the filter is enabled, false otherwise.

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: RenderFilter
Sets whether the filter is enabled or disabled.

Specified by:
setEnabled in interface RenderFilter
Parameters:
enabled - true if the filter should be enabled, false otherwise.

isEnabledByDefault

protected abstract boolean isEnabledByDefault()
Returns true if the filter should be enabled by default, false otherwise.

Returns:
true if the filter should be enabled by default, false otherwise.

execute

public java.lang.String execute(java.lang.String string,
                                RenderContext renderContext)
Description copied from interface: RenderFilter
Applies the filter to the passed in string and returns the filtered string.

A typical implementation of this method would use the following pattern:

  1. Inspect the render context to see if the filter should execute. For example, If the RenderStrategy denotes that links should not be filtered and the current filter does nothing but change text to links, then the filter should just return the input string.
  2. Inspect the render context to determine the RenderTarget that the filter should target the output towards.
  3. Examine the string and filter all or portions of it as required.
  4. Reassemble the complete string and returns it.
    1. Filters should expect that further processing of the returned text will be done. Use the RenderedTextStore to store text snippets if no further rendering of the all or portions of the returned content should not be performed.

      Specified by:
      execute in interface RenderFilter
      Parameters:
      string - the String to filter
      renderContext - the context the filter is being executed within
      Returns:
      a filtered string

getUserDocumentation

public java.lang.String[] getUserDocumentation(java.lang.String language)
Description copied from interface: RenderFilter
Returns a string array of [section,title, body] of xml formatted documentation that is targetted for end user usage. Documentation on how this output should be formatted can be found in the documentation that is shipped with this product.

Specified by:
getUserDocumentation in interface RenderFilter
Parameters:
language - the language as an ISO-639 language code to return the documentation in.
Returns:
a string array of [section, title, body] or null if end user documentation is not relevant to the filter.

executePlainTextTarget

protected abstract java.lang.String executePlainTextTarget(java.lang.String string,
                                                           RenderContext renderContext)
This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_PLAIN_TEXT.

Parameters:
string - the String to filter
renderContext - the context the filter is being executed within
Returns:
a filtered string

executePlainEmailTarget

protected abstract java.lang.String executePlainEmailTarget(java.lang.String string,
                                                            RenderContext renderContext)
This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_PLAIN_EMAIL.

Parameters:
string - the String to filter
renderContext - the context the filter is being executed within
Returns:
a filtered string

executeHtmlTarget

protected abstract java.lang.String executeHtmlTarget(java.lang.String string,
                                                      RenderContext renderContext)
This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_HTML.

Parameters:
string - the String to filter
renderContext - the context the filter is being executed within
Returns:
a filtered string

executeWysiwygEditorTarget

protected abstract java.lang.String executeWysiwygEditorTarget(java.lang.String string,
                                                               RenderContext renderContext)
This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_WYSIWYG_EDITOR.

Parameters:
string - the String to filter
renderContext - the context the filter is being executed within
Returns:
a filtered string

executeNoMarkupTarget

protected abstract java.lang.String executeNoMarkupTarget(java.lang.String string,
                                                          RenderContext renderContext)
This method is called to execute the filter when the render target specified in the context is RenderTarget.TARGET_NO_MARKUP.

Parameters:
string - the String to filter
renderContext - the context the filter is being executed within
Returns:
a filtered string

getDocumentationMap

protected abstract java.util.Map getDocumentationMap()
Returns a documentation Map keyed by languageCode -> String[section,title,body].

Returns:
a documentation Map keyed by languageCode -> String[section,title,body]

getDefaultHelp

protected abstract java.lang.String[] getDefaultHelp()
Returns a String[section,title,body] for the default help for the filter.

Returns:
a String[section,title,body] for the default help for the filter

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.