com.atlassian.confluence.renderer.radeox.macros
Class AbstractHtmlGeneratingMacro
java.lang.Object
org.radeox.macro.BaseMacro
com.atlassian.renderer.macro.BaseMacro
com.atlassian.confluence.renderer.radeox.macros.AbstractHtmlGeneratingMacro
- All Implemented Interfaces:
- 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
|
Fields inherited from class org.radeox.macro.BaseMacro |
initialContext, paramDescription |
Method Summary |
protected String |
buildBaseUrl(HttpServletRequest request,
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 String |
errorContent(String message)
|
void |
execute(Writer writer,
org.radeox.macro.parameter.MacroParameter macroParameter)
Subclasses should not override this execute method, but should instead override getHtml() |
protected abstract 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,
String loneParameter)
Lone parameters are not assigned a value. |
protected String |
parseParameterForKey(org.radeox.macro.parameter.MacroParameter parameter,
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 interface org.radeox.macro.Macro |
getName, getParamDescription, setInitialContext |
log
public static final org.apache.log4j.Category log
AbstractHtmlGeneratingMacro
public AbstractHtmlGeneratingMacro()
execute
public final void execute(Writer writer,
org.radeox.macro.parameter.MacroParameter macroParameter)
throws IllegalArgumentException,
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:
IllegalArgumentException
IOException
getHtml
protected abstract String getHtml(org.radeox.macro.parameter.MacroParameter macroParameter)
throws IllegalArgumentException,
IOException
- Throws:
IllegalArgumentException
IOException
errorContent
protected String errorContent(String message)
parseParameterForKey
protected String parseParameterForKey(org.radeox.macro.parameter.MacroParameter parameter,
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 keykey
- - 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 String buildBaseUrl(HttpServletRequest request,
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,
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.