com.atlassian.plugin.web.descriptors
Class DefaultWebPanelModuleDescriptor
java.lang.Object
com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor<WebPanel>
com.atlassian.plugin.web.descriptors.DefaultWebPanelModuleDescriptor
- All Implemented Interfaces:
- com.atlassian.plugin.ModuleDescriptor<WebPanel>, com.atlassian.plugin.Resourced, com.atlassian.plugin.StateAware, ConditionalDescriptor, ContextAware, WebFragmentModuleDescriptor<WebPanel>, WebPanelModuleDescriptor, WeightedDescriptor
public class DefaultWebPanelModuleDescriptor
- extends AbstractWebFragmentModuleDescriptor<WebPanel>
- implements WebPanelModuleDescriptor
The web panel module declares a single web panel in atlassian-plugin.xml. Its
XML element contains a location string that should match existing locations
in the host application where web panels can be embedded.
A web panel also contains a single resource child element that contains the
contents of the web panel. This can be plain HTML, or a (velocity) template
to provide dynamic content.
A resource element's type attribute identifies the format of the
panel's content (currently "static" and "velocity" are supported) which
allows the plugin framework to use the appropriate
WebPanelRenderer.
A web panel's resource element can either contain its contents embedded in
the resource element itself, as part of the atlassian-plugin.xml
file, or it can link to a file on the classpath when the
location attribute is used.
Examples
A web panel that contains static, embedded HTML:
<web-panel key="myPanel" location="general">
<resource name="view" type="static"><![CDATA[<b>Hello World!</b>]]></resource>
</web-panel>
A web panel that contains an embedded velocity template:
<web-panel key="myPanel" location="general">
<resource name="view" type="velocity"><![CDATA[#set($name = 'foo')My name is $name]]></resource>
</web-panel>
A web panel that contains uses a velocity template that is on the classpath
(part of the plugin's jar file):
<web-panel key="myPanel" location="general">
<resource name="view" type="velocity" location="templates/pie.vm"/>
</web-panel>
Finally it is also possible to provide your own custom class that is
responsible for producing the panel's HTML, by using the descriptor's
class attribute:
<web-panel key="myPanel" location="general" class="com.example.FooWebPanel"/>
Note that FooWebPanel must implement
WebPanel.
- Since:
- 2.5.0
|
Field Summary |
static String |
XML_ELEMENT_NAME
Host applications should use this string when registering the web panel
module descriptor. |
| Fields inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor |
key, moduleClass, moduleClassName, moduleFactory, name, plugin, resources, singleton |
| Methods inherited from class com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor |
equals, getCondition, getContextProvider, getTooltip, getWebLabel, getWebParams, hashCode, makeCondition, makeConditions, makeConditions, makeContextProvider, setWebInterfaceManager |
| Methods inherited from class com.atlassian.plugin.descriptors.AbstractModuleDescriptor |
assertModuleClassImplements, checkPermissions, destroy, destroy, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getModuleClassName, getName, getParams, getPlugin, getPluginKey, getRequiredPermissions, getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation, isEnabledByDefault, isSingleton, isSingletonByDefault, isSystemModule, loadClass, loadClass, satisfiesMinJavaVersion, setPlugin, toString |
| Methods inherited from interface com.atlassian.plugin.ModuleDescriptor |
destroy, destroy, equals, getCompleteKey, getDescription, getDescriptionKey, getI18nNameKey, getKey, getMinJavaVersion, getModuleClass, getName, getParams, getPlugin, getPluginKey, hashCode, isEnabledByDefault, isSystemModule, satisfiesMinJavaVersion |
| Methods inherited from interface com.atlassian.plugin.Resourced |
getResourceDescriptor, getResourceDescriptors, getResourceDescriptors, getResourceLocation |
XML_ELEMENT_NAME
public static final String XML_ELEMENT_NAME
- Host applications should use this string when registering the web panel
module descriptor.
- See Also:
- Constant Field Values
DefaultWebPanelModuleDescriptor
public DefaultWebPanelModuleDescriptor(com.atlassian.plugin.hostcontainer.HostContainer hostContainer,
com.atlassian.plugin.module.ModuleFactory moduleClassFactory,
WebInterfaceManager webInterfaceManager)
init
public void init(com.atlassian.plugin.Plugin plugin,
org.dom4j.Element element)
throws com.atlassian.plugin.PluginParseException
- Specified by:
init in interface com.atlassian.plugin.ModuleDescriptor<WebPanel>- Overrides:
init in class AbstractWebFragmentModuleDescriptor<WebPanel>
- Throws:
com.atlassian.plugin.PluginParseException
provideValidationRules
protected void provideValidationRules(com.atlassian.plugin.util.validation.ValidationPattern pattern)
- Overrides:
provideValidationRules in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<WebPanel>
getLocation
public String getLocation()
- Description copied from interface:
WebPanelModuleDescriptor
- Returns the location in the host application where the web panel should be embedded.
- Specified by:
getLocation in interface WebPanelModuleDescriptor
getWeight
public int getWeight()
- Specified by:
getWeight in interface WebFragmentModuleDescriptor<WebPanel>- Specified by:
getWeight in interface WeightedDescriptor- Overrides:
getWeight in class AbstractWebFragmentModuleDescriptor<WebPanel>
getModule
public WebPanel getModule()
- Specified by:
getModule in interface com.atlassian.plugin.ModuleDescriptor<WebPanel>- Specified by:
getModule in class com.atlassian.plugin.descriptors.AbstractModuleDescriptor<WebPanel>
enabled
public void enabled()
- Specified by:
enabled in interface com.atlassian.plugin.StateAware- Overrides:
enabled in class AbstractWebFragmentModuleDescriptor<WebPanel>
disabled
public void disabled()
- Specified by:
disabled in interface com.atlassian.plugin.StateAware- Overrides:
disabled in class AbstractWebFragmentModuleDescriptor<WebPanel>
Copyright © 2014 Atlassian. All rights reserved.