com.ibm.workplace.wcm.api.plugin.rendering
Interface RenderingPlugin

All Superinterfaces:
AuthoringPlugin, Localized
All Known Subinterfaces:
RenderingPluginDefinition

public interface RenderingPlugin
extends AuthoringPlugin, Localized

Represents a Rendering Plugin.

A RenderingPlugin is used to contribute markup to the page being rendered at runtime and to control if content embedded within the body of the calling [Plugin:RenderingPluginName] tag should be rendered or not.

This interface must be implemented by all classes that will be executed by a WCM Plugin tag. Each RenderingPlugin must also have a public constructor with no arguments.

This class extends Localized which is documented in the WebSphere Portal documentation. The getTitle(Locale) and getDescription(Locale) methods should return a translated title and description for the plugin.

The RenderingPlugin can optionally implement RenderingPluginDefinition instead of RenderingPlugin, in order to define its type and parameters. This is strongly recommended, as it allows the RenderingPlugins to be used more easily.

Contribute your rendering plugin to WCM by using an Eclipse extension point "com.ibm.workplace.wcm.api.RenderingPlugin". Refer to the product documentation for more information.

Since:
7.0
Note:
This interface is designed to be implemented by clients.

Method Summary
 java.lang.String getDescription(java.util.Locale locale)
          Get the translated description of the plugin type.
 java.lang.String getName()
          Get the name for this rendering plugin.
 java.lang.String getTitle(java.util.Locale locale)
          Get the translated title of the plugin.
 boolean render(RenderingPluginModel model)
          The Rendering Plugin should render its output to the provided RenderingPluginModel object's Writer.
 
Methods inherited from interface com.ibm.workplace.wcm.api.plugin.AuthoringPlugin
isShownInAuthoringUI
 
Methods inherited from interface com.ibm.portal.Localized
getLocales
 

Method Detail

getName

java.lang.String getName()

Get the name for this rendering plugin. This is the name which will be used to invoke the tag, using [Plugin:RenderingPluginName].

Therefore, this should be a short String containing only alphanumeric characters. It must not contains spaces or special characters. Names must be unique, or else the plugin will not function correctly.

Note: If the name is changed, this will break the tags where the previous name of the rendering plugin is used.

For example, "Comment".

Returns:
Name of the rendering plugin

getTitle

java.lang.String getTitle(java.util.Locale locale)

Get the translated title of the plugin.

This should return a short title for the plugin, such as "Comment Plugin". It is expected that in English, the title and the name of the plugin will be very similar, so that the title can be used to find a plugin with a given name.

Specified by:
getTitle in interface Localized
Parameters:
locale - the locale for which to retrieve the title, must not be null.
Returns:
the title of this node in the given locale. If a title is not available in the given locale, this method will return null. It is up to the invoker of the method to implement an appropriate fallback mechanism.
See Also:
Localized.getTitle(java.util.Locale)

getDescription

java.lang.String getDescription(java.util.Locale locale)

Get the translated description of the plugin type.

This should return a longer description for the plugin. This should be in the form of a Java String - for example, '\n' is supported as a line break escape character.

The description can contain an example of usage, such as "Plugin that can be used to add a comment that is not rendered.\nE.g. [Plugin:Comment] This is a comment [/Plugin:Comment]". If the description is long, it should be split between multiple lines in this way, as makes sense within the context of the description. The example of usage may not be required if RenderingPluginDefinition is implemented, since the RenderingPlugin parameters and their values are then declared through this interface.

Specified by:
getDescription in interface Localized
Parameters:
locale - the locale for which to retrieve the description, must not be null.
Returns:
the description of this node in the given locale. If a description is not available in the given locale, this method will return null. It is up to the invoker of the method to implement an appropriate fallback mechanism
See Also:
Localized.getDescription(java.util.Locale)

render

boolean render(RenderingPluginModel model)
               throws RenderingPluginException

The Rendering Plugin should render its output to the provided RenderingPluginModel object's Writer.

The RenderingContext can be used to determine which content is being rendering, etc.

Any parameters specific to the wcm:plugin tag are passed as Strings in the provided List.

Parameters:
model - Model to be used for the current rendering of the plugin.
Returns:
true if the inner Contents of the plugin tag should be rendered.
Throws:
RenderingPluginException - Thrown if any error occurs while rendering the plugin.