Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.renderer.macro
Class CodeMacro

java.lang.Object
  extended by com.jivesoftware.forum.renderer.macro.Preserved
      extended by com.jivesoftware.forum.renderer.macro.CodeMacro
All Implemented Interfaces:
com.jivesoftware.forum.renderer.impl.JiveSystemRenderFilter, RenderFilter, RenderMacro

public class CodeMacro
extends Preserved
implements RenderMacro, com.jivesoftware.forum.renderer.impl.JiveSystemRenderFilter

Macro that pretty prints java, sql and xml code fragments.


Constructor Summary
CodeMacro()
           
 
Method Summary
 java.lang.String execute(java.lang.String body, RenderContext renderContext)
          Applies the filter to the passed in string and returns the filtered string.
 java.lang.String getMacroTagName()
          Returns the tag name of the macro.
 java.lang.String getName()
          Returns the unique name of the filter.
 java.util.Map getParameters()
          Returns a Map of user provided parameters to the macro.
 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.
 boolean isSingleTagMacro()
          Returns true is the macro has only a single tag such as {testMacro}, false if the macro should have both an opening and closing tag ({testMacro}text here{testMacro})
 void setEnabled(boolean enabled)
          Sets whether the filter is enabled or disabled.
 void setParameters(java.util.Map parameters)
          Sets a map of user provided parameters for the macro to use.
 
Methods inherited from class com.jivesoftware.forum.renderer.macro.Preserved
addSpecial, addSpecial, replace, toChar, toEntity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CodeMacro

public CodeMacro()
Method Detail

getName

public 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.

getMacroTagName

public java.lang.String getMacroTagName()
Description copied from interface: RenderMacro
Returns the tag name of the macro. The tag name will be used to map between macro tag names and the macro to execute. For example, if the macro tag name is testMacro the processing engine will know to associate any {testMacro} tag with the macro.

Specified by:
getMacroTagName in interface RenderMacro
Returns:
the macro tag name.

isSingleTagMacro

public boolean isSingleTagMacro()
Description copied from interface: RenderMacro
Returns true is the macro has only a single tag such as {testMacro}, false if the macro should have both an opening and closing tag ({testMacro}text here{testMacro})

Specified by:
isSingleTagMacro in interface RenderMacro
Returns:
true is the macro has only a single tag, false if the macro should have both an opening and closing tag

execute

public java.lang.String execute(java.lang.String body,
                                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
      Specified by:
      execute in interface RenderMacro
      Parameters:
      body - the String to filter
      renderContext - the context the filter is being executed within
      Returns:
      a filtered string
      See Also:
      RenderFilter.execute(String, RenderContext)

getParameters

public java.util.Map getParameters()
Description copied from interface: RenderMacro
Returns a Map of user provided parameters to the macro.

Specified by:
getParameters in interface RenderMacro
Returns:
a Map of user provided parameters to the macro

setParameters

public void setParameters(java.util.Map parameters)
Description copied from interface: RenderMacro
Sets a map of user provided parameters for the macro to use.

Specified by:
setParameters in interface RenderMacro
Parameters:
parameters - a map of user provided parameters

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.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.