Available: | Confluence 4.3.3 and later |
This plugin module enable you to register a new device-type specific renderer to be used when rendering Confluence content for a specific device type (where device type is known at render time by ConversionContext.html#getOutputDeviceType(). The Renderer you are registering must already exist as a named bean in your plugins Spring configuration.
The root element for the Component plugin module is device-type-renderer
. It allows the following attributes and child elements for configuration:
Name* | Description |
---|---|
key | The identifier of the plugin module. This key must be unique within the plugin where it is defined. The key must match the id of a Spring configured bean present in your plugins Spring context. The bean must implement the Renderer interface. Default: N/A |
i18n-name-key | The localisation key for the human-readable name of the plugin module. |
name | The human-readable name of the plugin module. I.e. the human-readable name of the component. Default: The plugin key. |
*key is required
Name* | Description |
---|---|
description | The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body. |
device-type | The device type that this renderer will be used for (e.g. at render time ConversionContext.html#getOutputDeviceType() will be queried and the Renderer with a configured 'device-type' that matches will be used. This element can be repeated for each device type this renderer applies to. |
*device-type is required
Here is an example atlassian-plugin.xml
file containing a single public component:
1 2 3 4 5 6 7 8 9 10 11
<atlassian-plugin name="Hello World" key="example.plugin.helloworld" plugins-version="2">
<plugin-info>
<description>A basic component module test</description>
<vendor name="Atlassian Software Systems" url="http://www.atlassian.com"/>
<version>1.0</version>
</plugin-info>
<device-type-renderer name="Mobile Renderer" key="mobileViewRenderer">
<description>The renderer used for rendering content in Confluence Mobile.</description>
<device-type>mobile</device-type>
</device-type-renderer>
</atlassian-plugin>
The matching Spring configuration for the plugin would need to have a bean configured with the id 'mobileViewRenderer' to match the key on the <device-type-renderer> element, e.g.
pluginContext.xml Snippet
1 2 3 4
<beans:bean id="mobileViewRenderer" class="com.atlassian.confluence.content.render.xhtml.DefaultRenderer">
<beans:constructor-arg index="0">
<beans:bean class="com.atlassian.confluence.content.render.xhtml.TransformerChain">
etc...
Some information to be aware of when developing or configuring a Device Type Renderer plugin module:
The renderer component referred to must implement the Renderer interface. For example, it could be a DefaultRenderer.
If multiple renderers register against the same device type only the last one registered will be used.
RELATED TOPICS
Writing Confluence Plugins
Installing a Plugin
Information sourced from Plugin Framework documentation