com.atlassian.confluence.renderer.radeox.macros
Class AbstractHtmlGeneratingMacro

java.lang.Object
  extended by org.radeox.macro.BaseMacro
      extended by com.atlassian.renderer.macro.BaseMacro
          extended by com.atlassian.confluence.renderer.radeox.macros.AbstractHtmlGeneratingMacro
All Implemented Interfaces:
java.lang.Comparable, org.radeox.macro.Macro
Direct Known Subclasses:
ContentByUserMacro

public abstract class AbstractHtmlGeneratingMacro
extends com.atlassian.renderer.macro.BaseMacro

To be used by macros which generate large amounts of HTML which they don't want any further processing done on.


Field Summary
static org.apache.log4j.Category log
          Deprecated. since 5.5, use private logger
 
Fields inherited from class org.radeox.macro.BaseMacro
initialContext, paramDescription
 
Constructor Summary
AbstractHtmlGeneratingMacro()
           
 
Method Summary
protected  java.lang.String buildBaseUrl(javax.servlet.http.HttpServletRequest request, java.util.List ignoredKeys)
          create baseurl so that the urls that appear in the template/view for a macro are not dependent on certain actions this will allow the macro to be used in more than one place
protected  java.lang.String errorContent(java.lang.String message)
           
 void execute(java.io.Writer writer, org.radeox.macro.parameter.MacroParameter macroParameter)
          Subclasses should not override this execute method, but should instead override getHtml()
protected abstract  java.lang.String getHtml(org.radeox.macro.parameter.MacroParameter macroParameter)
           
protected  PageContext getPageContext(org.radeox.macro.parameter.MacroParameter macroParameter)
           
protected  com.atlassian.user.User getRemoteUser()
           
protected  boolean hasLoneParameter(org.radeox.macro.parameter.MacroParameter macroParameter, java.lang.String loneParameter)
          Lone parameters are not assigned a value.
protected  java.lang.String parseParameterForKey(org.radeox.macro.parameter.MacroParameter parameter, java.lang.String key)
          This method is a helper wrapper to macroParameter.getParameter(key); if a null is returned it will try with key + " " then " " + key, etc..
 
Methods inherited from class com.atlassian.renderer.macro.BaseMacro
getDescription, getResourcePath, setDescription, setResourcePath
 
Methods inherited from class org.radeox.macro.BaseMacro
compareTo, getName, getParamDescription, setInitialContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.radeox.macro.Macro
getName, getParamDescription, setInitialContext
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

log

@Deprecated
public static final org.apache.log4j.Category log
Deprecated. since 5.5, use private logger
Constructor Detail

AbstractHtmlGeneratingMacro

public AbstractHtmlGeneratingMacro()
Method Detail

execute

public final void execute(java.io.Writer writer,
                          org.radeox.macro.parameter.MacroParameter macroParameter)
                   throws java.lang.IllegalArgumentException,
                          java.io.IOException
Subclasses should not override this execute method, but should instead override getHtml()

Specified by:
execute in interface org.radeox.macro.Macro
Specified by:
execute in class org.radeox.macro.BaseMacro
Throws:
java.lang.IllegalArgumentException
java.io.IOException

getHtml

protected abstract java.lang.String getHtml(org.radeox.macro.parameter.MacroParameter macroParameter)
                                     throws java.lang.IllegalArgumentException,
                                            java.io.IOException
Throws:
java.lang.IllegalArgumentException
java.io.IOException

errorContent

protected java.lang.String errorContent(java.lang.String message)

parseParameterForKey

protected java.lang.String parseParameterForKey(org.radeox.macro.parameter.MacroParameter parameter,
                                                java.lang.String key)
This method is a helper wrapper to macroParameter.getParameter(key); if a null is returned it will try with key + " " then " " + key, etc..

Often a parameter is not found simply because the user has surrounded it with whitespace.

Parameters:
parameter - - The MacroParameter to search through for the key
key - - the key
Returns:
String holding the result of

getPageContext

protected PageContext getPageContext(org.radeox.macro.parameter.MacroParameter macroParameter)
Parameters:
macroParameter -
Returns:
returns the current page context, if the WikiRendererContextKeys class can identify it

getRemoteUser

protected com.atlassian.user.User getRemoteUser()

buildBaseUrl

protected java.lang.String buildBaseUrl(javax.servlet.http.HttpServletRequest request,
                                        java.util.List ignoredKeys)
create baseurl so that the urls that appear in the template/view for a macro are not dependent on certain actions this will allow the macro to be used in more than one place

Parameters:
ignoredKeys - - parameter keys that should not be reappended back onto the url

hasLoneParameter

protected boolean hasLoneParameter(org.radeox.macro.parameter.MacroParameter macroParameter,
                                   java.lang.String loneParameter)
Lone parameters are not assigned a value. For example: {mymacro:hello|world} This is useful because having hello=true is redundant in some cases and too wordy.



Copyright © 2003-2014 Atlassian. All Rights Reserved.