Jive API (3.0.13) Core Javadocs

com.jivesoftware.community.renderer
Class BaseMacro

java.lang.Object
  extended by com.jivesoftware.community.renderer.BaseMacro
All Implemented Interfaces:
RenderMacro

public abstract class BaseMacro
extends Object
implements RenderMacro

A Base class to be used to create macros.

See Also:
Name, Description, EnableByDefault, SingleTagMacro, RenderType

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jivesoftware.community.renderer.RenderMacro
RenderMacro.Type
 
Constructor Summary
BaseMacro()
           
 
Method Summary
protected static String applyFreemarkerTemplate(freemarker.template.Configuration config, Map<String,Object> properties, String templateName)
          Processes the specified template file and returns a String containing the content of the template file.
protected  String convertToOriginalWikiText(Element element)
           
 List<> getAllowedParameters()
          return a list of all parameters allowed by this macro
protected  String getDefaultParameterValue(Element element)
           
protected  String getDefaultParameterValue(Element element, boolean parseContent)
           
 String getIcon()
          returns the relative path of the icon image.
 List<MacroParameterSet> getMacroParameterSets()
          Returns a list of all available default parameter implementations, if any
 RenderMacro.Type getMacroTag()
          returns tag type
 String getName()
          Returns the name of the macro tag.
 int getOrder()
          returns the order the macro should be run in. 0 should be "normal"
 Map<String,String> getParameters()
          Returns the parameters passed into this tag.
 String getShortMacroName()
          Returns the name of the macro tag Defined by the MacroTagName annotation if defined, otherwise the value of getClass().getShortName() will be used.
 String getUrl()
          Returns an optional URL for setting this macro's properties or an empty String if none
protected  User getUser(RenderContext renderContext)
           
protected  void handleError(Exception e, Element element, String messageKey, String... params)
           
 boolean isButton()
          Returns true if the macro should be displayed as a button in the toolbar as opposed to the insert menu
 boolean isEnabled()
           
protected  boolean isEnabledByDefault()
          Returns the value of the EnableByDefault annotation if it is defined, else true.
 boolean isIncludeContainerAsUrlParam()
          Should the container id and type be included in the url that is included in the macro's RTE menu item.
 boolean isIncludeJiveContentObjectAsUrlParam()
          Should the content object id and type be included in the url that is included in the macro's RTE menu item.
 boolean isShowInRTE()
          Returns true if the macro should be displayed and edited using the RTE editor
 boolean isShowSettings()
          returns true if the macro's settings should be editable in the RTE
 boolean isSingleTagMacro()
          Returns the value of the SingleTagMacro annotation if it is defined, other wise true.
 void setEnabled(boolean enabled)
           
 void setParameters(Map<String,String> parameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jivesoftware.community.renderer.RenderMacro
execute
 

Constructor Detail

BaseMacro

public BaseMacro()
Method Detail

getShortMacroName

public String getShortMacroName()
Returns the name of the macro tag Defined by the MacroTagName annotation if defined, otherwise the value of getClass().getShortName() will be used.

Specified by:
getShortMacroName in interface RenderMacro
Returns:
The name of the tag for the macro.

getName

public String getName()
Returns the name of the macro tag.

Returns:
The name of the macro.

getUrl

public String getUrl()
Returns an optional URL for setting this macro's properties or an empty String if none

Specified by:
getUrl in interface RenderMacro
Returns:
the url

isSingleTagMacro

public boolean isSingleTagMacro()
Returns the value of the SingleTagMacro annotation if it is defined, other wise true.

Specified by:
isSingleTagMacro in interface RenderMacro
Returns:
Whether or not this tag is a single tag.

getOrder

public int getOrder()
returns the order the macro should be run in. 0 should be "normal"

Specified by:
getOrder in interface RenderMacro
Returns:
the order

getIcon

public String getIcon()
Description copied from interface: RenderMacro
returns the relative path of the icon image. For ex: plugins should /resources/images/foo_icon.gif

Specified by:
getIcon in interface RenderMacro
Returns:
the relative path to the icon

isShowInRTE

public boolean isShowInRTE()
Returns true if the macro should be displayed and edited using the RTE editor

Specified by:
isShowInRTE in interface RenderMacro
Returns:
true if it should be shown

isButton

public boolean isButton()
Description copied from interface: RenderMacro
Returns true if the macro should be displayed as a button in the toolbar as opposed to the insert menu

Specified by:
isButton in interface RenderMacro
Returns:
if it should be a button

isShowSettings

public boolean isShowSettings()
Description copied from interface: RenderMacro
returns true if the macro's settings should be editable in the RTE

Specified by:
isShowSettings in interface RenderMacro
Returns:
settings should be shown

getAllowedParameters

public List<> getAllowedParameters()
return a list of all parameters allowed by this macro

Specified by:
getAllowedParameters in interface RenderMacro
Returns:

getMacroParameterSets

public List<MacroParameterSet> getMacroParameterSets()
Returns a list of all available default parameter implementations, if any

Specified by:
getMacroParameterSets in interface RenderMacro
Returns:
a list of parameter sets

getParameters

public Map<String,String> getParameters()
Returns the parameters passed into this tag.

Returns:
The parameters passed into this tag.

setParameters

public void setParameters(Map<String,String> parameters)

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

getMacroTag

public RenderMacro.Type getMacroTag()
returns tag type

Specified by:
getMacroTag in interface RenderMacro
Returns:
the tag type

isIncludeJiveContentObjectAsUrlParam

public boolean isIncludeJiveContentObjectAsUrlParam()
Description copied from interface: RenderMacro
Should the content object id and type be included in the url that is included in the macro's RTE menu item. For plug-ins this is automatically set from the macro metadata in plugin.xml.

Specified by:
isIncludeJiveContentObjectAsUrlParam in interface RenderMacro
Returns:
true if the content object id and type should be included as url parameters

isIncludeContainerAsUrlParam

public boolean isIncludeContainerAsUrlParam()
Description copied from interface: RenderMacro
Should the container id and type be included in the url that is included in the macro's RTE menu item. For plug-ins this is automatically set from the macro metadata in plugin.xml.

Specified by:
isIncludeContainerAsUrlParam in interface RenderMacro
Returns:
true if the container object id and type should be included as url parameters

isEnabledByDefault

protected boolean isEnabledByDefault()
Returns the value of the EnableByDefault annotation if it is defined, else true.

Returns:
Whether or not the plugin is enabled by default.

getDefaultParameterValue

protected String getDefaultParameterValue(Element element,
                                          boolean parseContent)

convertToOriginalWikiText

protected String convertToOriginalWikiText(Element element)

getDefaultParameterValue

protected String getDefaultParameterValue(Element element)

getUser

protected User getUser(RenderContext renderContext)

applyFreemarkerTemplate

protected static String applyFreemarkerTemplate(freemarker.template.Configuration config,
                                                Map<String,Object> properties,
                                                String templateName)
Processes the specified template file and returns a String containing the content of the template file.

Parameters:
config - the freemarker configuration
properties - used for the freemarker context
templateName - name of the template
Returns:
the content of the specified template file

handleError

protected void handleError(Exception e,
                           Element element,
                           String messageKey,
                           String... params)

Jive Product Page

Copyright © 1999-2007 Jive Software.