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 java.lang.String AUTHOR_PARAMETER
           
static java.lang.String BORDER_PARAMETER
           
static java.lang.String DEFAULT_WIDTH
           
static java.lang.String PREFERENCES_PARAMETER
           
static java.lang.String URL_PARAMETER
           
static java.lang.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.webresource.api.assembler.PageBuilderService pageBuilderService, GadgetWhiteListManager whiteListManager, com.atlassian.sal.api.message.I18nResolver resolver, RequestContextBuilder requestContextBuilder, GadgetCounter gadgetCounter, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 java.lang.String execute(java.util.Map<java.lang.String,java.lang.String> params, java.lang.String body, ConversionContext conversionContext)
           
 java.lang.String execute(java.util.Map paramsRaw, java.lang.String body, com.atlassian.renderer.RenderContext renderContext)
           
 com.atlassian.renderer.v2.RenderMode getBodyRenderMode()
           
 Macro.BodyType getBodyType()
          XHTML Gadget Code
 ImagePlaceholder getImagePlaceholder(java.util.Map<java.lang.String,java.lang.String> parameters, ConversionContext context)
          Returns an ImagePlaceholder instance to be displayed in the editor.
 Macro.OutputType getOutputType()
           
protected  java.lang.String getPredefinedGadgetUrl()
           
 java.lang.String getResourcePath()
           
 boolean hasBody()
          Wiki Markup Gadget Code
protected  boolean isGadgetUrlPredefined()
           
 void setResourcePath(java.lang.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 java.lang.String DEFAULT_WIDTH
See Also:
Constant Field Values

URL_PARAMETER

public static final java.lang.String URL_PARAMETER
See Also:
Constant Field Values

WIDTH_PARAMETER

public static final java.lang.String WIDTH_PARAMETER
See Also:
Constant Field Values

BORDER_PARAMETER

public static final java.lang.String BORDER_PARAMETER
See Also:
Constant Field Values

AUTHOR_PARAMETER

public static final java.lang.String AUTHOR_PARAMETER
See Also:
Constant Field Values

PREFERENCES_PARAMETER

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

GadgetMacro

public GadgetMacro(com.atlassian.gadgets.view.GadgetViewFactory gadgetViewFactory,
                   com.atlassian.webresource.api.assembler.PageBuilderService pageBuilderService,
                   GadgetWhiteListManager whiteListManager,
                   com.atlassian.sal.api.message.I18nResolver resolver,
                   RequestContextBuilder requestContextBuilder,
                   GadgetCounter gadgetCounter,
                   com.atlassian.event.api.EventPublisher eventPublisher)
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 java.lang.String execute(java.util.Map<java.lang.String,java.lang.String> params,
                                java.lang.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 java.lang.String execute(java.util.Map paramsRaw,
                                java.lang.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 java.lang.String getPredefinedGadgetUrl()

getImagePlaceholder

public ImagePlaceholder getImagePlaceholder(java.util.Map<java.lang.String,java.lang.String> parameters,
                                            ConversionContext context)
Description copied from interface: EditorImagePlaceholder
Returns an ImagePlaceholder instance to be displayed in the editor. Return null if the default placeholder should be used.

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 java.lang.String getResourcePath()
Specified by:
getResourcePath in interface ResourceAware

setResourcePath

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


Copyright © 2003-2014 Atlassian. All Rights Reserved.