Class AbstractHtmlGeneratingMacro
- java.lang.Object
-
- org.radeox.macro.BaseMacro
-
- com.atlassian.renderer.macro.BaseMacro
-
- com.atlassian.confluence.renderer.radeox.macros.AbstractHtmlGeneratingMacro
-
- All Implemented Interfaces:
com.atlassian.renderer.macro.Macro,Comparable,org.radeox.macro.Macro
- Direct Known Subclasses:
ContentByUserMacro
public abstract class AbstractHtmlGeneratingMacro extends com.atlassian.renderer.macro.BaseMacroTo be used by macros which generate large amounts of HTML which they don't want any further processing done on.
-
-
Constructor Summary
Constructors Constructor Description AbstractHtmlGeneratingMacro()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected StringbuildBaseUrl(javax.servlet.http.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 placeprotected StringerrorContent(String message)voidexecute(Writer writer, org.radeox.macro.parameter.MacroParameter macroParameter)Subclasses should not override this execute method, but should instead override getHtml()protected abstract StringgetHtml(org.radeox.macro.parameter.MacroParameter macroParameter)protected PageContextgetPageContext(org.radeox.macro.parameter.MacroParameter macroParameter)protected com.atlassian.user.UsergetRemoteUser()protected booleanhasLoneParameter(org.radeox.macro.parameter.MacroParameter macroParameter, String loneParameter)Lone parameters are not assigned a value.protected StringparseParameterForKey(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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Method Detail
-
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:
executein interfaceorg.radeox.macro.Macro- Specified by:
executein classorg.radeox.macro.BaseMacro- Throws:
IllegalArgumentExceptionIOException
-
getHtml
protected abstract String getHtml(org.radeox.macro.parameter.MacroParameter macroParameter) throws IllegalArgumentException, IOException
- Throws:
IllegalArgumentExceptionIOException
-
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(javax.servlet.http.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.
-
-