Class 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.BaseMacro
    To be used by macros which generate large amounts of HTML which they don't want any further processing done on.
    • Field Summary

      • Fields inherited from class org.radeox.macro.BaseMacro

        initialContext, paramDescription
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      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
      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
    • Constructor Detail

      • AbstractHtmlGeneratingMacro

        public AbstractHtmlGeneratingMacro()
    • 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:
        execute in interface org.radeox.macro.Macro
        Specified by:
        execute in class org.radeox.macro.BaseMacro
        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 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 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.