com.atlassian.confluence.plugins.gadgets
Class GadgetMacro

java.lang.Object
  extended by com.atlassian.renderer.v2.macro.BaseMacro
      extended by com.atlassian.confluence.plugins.gadgets.GadgetMacro
All Implemented Interfaces:
EditorImagePlaceholder, ResourceAware, com.atlassian.renderer.v2.macro.Macro

public class GadgetMacro
extends com.atlassian.renderer.v2.macro.BaseMacro
implements Macro, EditorImagePlaceholder, ResourceAware


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.confluence.macro.Macro
Macro.BodyType, Macro.OutputType
 
Field Summary
static String AUTHOR_PARAMETER
           
static String BORDER_PARAMETER
           
static String DEFAULT_WIDTH
           
static String PREFERENCES_PARAMETER
           
static String URL_PARAMETER
           
static String WIDTH_PARAMETER
           
 
Fields inherited from interface com.atlassian.renderer.v2.macro.Macro
RAW_PARAMS_KEY
 
Constructor Summary
GadgetMacro(com.atlassian.gadgets.view.GadgetViewFactory gadgetViewFactory, com.atlassian.plugin.webresource.WebResourceManager webResourceManager, GadgetWhiteListManager whiteListManager, com.atlassian.sal.api.message.I18nResolver resolver, RequestContextBuilder requestContextBuilder, com.atlassian.gadgets.spec.GadgetSpecFactory gadgetSpecFactory, GadgetCounter gadgetCounter)
           
 
Method Summary
 String execute(Map<String,String> params, String body, ConversionContext conversionContext)
           
 String execute(Map paramsRaw, String body, com.atlassian.renderer.RenderContext renderContext)
           
 com.atlassian.renderer.v2.RenderMode getBodyRenderMode()
           
 Macro.BodyType getBodyType()
          XHTML Gadget Code
 ImagePlaceholder getImagePlaceholder(Map<String,String> parameters, ConversionContext context)
          Returns an ImagePlaceholder instance to be displayed in the editor.
 Macro.OutputType getOutputType()
           
protected  String getPredefinedGadgetUrl()
           
 String getResourcePath()
           
 boolean hasBody()
          Wiki Markup Gadget Code
protected  boolean isGadgetUrlPredefined()
           
 void setResourcePath(String resourcePath)
           
 
Methods inherited from class com.atlassian.renderer.v2.macro.BaseMacro
getTokenType, getWysiwygBodyType, isInline, suppressMacroRenderingDuringWysiwyg, suppressSurroundingTagDuringWysiwygRendering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_WIDTH

public static final String DEFAULT_WIDTH
See Also:
Constant Field Values

URL_PARAMETER

public static final String URL_PARAMETER
See Also:
Constant Field Values

WIDTH_PARAMETER

public static final String WIDTH_PARAMETER
See Also:
Constant Field Values

BORDER_PARAMETER

public static final String BORDER_PARAMETER
See Also:
Constant Field Values

AUTHOR_PARAMETER

public static final String AUTHOR_PARAMETER
See Also:
Constant Field Values

PREFERENCES_PARAMETER

public static final String PREFERENCES_PARAMETER
See Also:
Constant Field Values
Constructor Detail

GadgetMacro

public GadgetMacro(com.atlassian.gadgets.view.GadgetViewFactory gadgetViewFactory,
                   com.atlassian.plugin.webresource.WebResourceManager webResourceManager,
                   GadgetWhiteListManager whiteListManager,
                   com.atlassian.sal.api.message.I18nResolver resolver,
                   RequestContextBuilder requestContextBuilder,
                   com.atlassian.gadgets.spec.GadgetSpecFactory gadgetSpecFactory,
                   GadgetCounter gadgetCounter)
Method Detail

getBodyType

public Macro.BodyType getBodyType()
XHTML Gadget Code

Returns:
The type of body this macro has.

getOutputType

public Macro.OutputType getOutputType()

execute

public String execute(Map<String,String> params,
                      String body,
                      ConversionContext conversionContext)
               throws MacroExecutionException
Throws:
MacroExecutionException

hasBody

public boolean hasBody()
Wiki Markup Gadget Code

Specified by:
hasBody in interface com.atlassian.renderer.v2.macro.Macro

getBodyRenderMode

public com.atlassian.renderer.v2.RenderMode getBodyRenderMode()
Specified by:
getBodyRenderMode in interface com.atlassian.renderer.v2.macro.Macro

execute

public String execute(Map paramsRaw,
                      String body,
                      com.atlassian.renderer.RenderContext renderContext)
               throws com.atlassian.renderer.v2.macro.MacroException
Specified by:
execute in interface com.atlassian.renderer.v2.macro.Macro
Throws:
com.atlassian.renderer.v2.macro.MacroException

isGadgetUrlPredefined

protected boolean isGadgetUrlPredefined()

getPredefinedGadgetUrl

protected String getPredefinedGadgetUrl()

getImagePlaceholder

public ImagePlaceholder getImagePlaceholder(Map<String,String> parameters,
                                            ConversionContext context)
Description copied from interface: EditorImagePlaceholder
Returns an ImagePlaceholder instance to be displayed in the editor.

Specified by:
getImagePlaceholder in interface EditorImagePlaceholder
Parameters:
parameters - the parameters for the macro, with the default parameter being represent by the key "0".
context - the ConversionContext for this usage.
Returns:
The image details to render in the editor.

getResourcePath

public String getResourcePath()
Specified by:
getResourcePath in interface ResourceAware

setResourcePath

public void setResourcePath(String resourcePath)
Specified by:
setResourcePath in interface ResourceAware


Copyright © 2003-2012 Atlassian. All Rights Reserved.