public class

DefaultWebPanelModuleDescriptor

extends AbstractWebFragmentModuleDescriptor<T>
implements WebPanelModuleDescriptor
java.lang.Object
   ↳ com.atlassian.plugin.descriptors.AbstractModuleDescriptor<T>
     ↳ com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor<T>
       ↳ com.atlassian.plugin.web.descriptors.DefaultWebPanelModuleDescriptor

Class Overview

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.

Summary

Constants
String XML_ELEMENT_NAME Host applications should use this string when registering the web panel module descriptor.
[Expand]
Inherited Constants
From interface com.atlassian.plugin.web.descriptors.WebFragmentModuleDescriptor
[Expand]
Inherited Fields
From class com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
Public Constructors
DefaultWebPanelModuleDescriptor(HostContainer hostContainer, ModuleFactory moduleClassFactory, WebInterfaceManager webInterfaceManager)
Public Methods
void disabled()
Disables the module descriptor.
void enabled()
Enables the descriptor by loading the module class.
String getLocation()
Returns the location in the host application where the web panel should be embedded.
WebPanel getModule()
The particular module object created by this plugin.
int getWeight()
void init(Plugin plugin, Element element)
Initialise a module given it's parent plugin and the XML element representing the module.
Protected Methods
void provideValidationRules(ValidationPattern pattern)
Provides validation rules for the pattern
[Expand]
Inherited Methods
From class com.atlassian.plugin.web.descriptors.AbstractWebFragmentModuleDescriptor
From class com.atlassian.plugin.descriptors.AbstractModuleDescriptor
From class java.lang.Object
From interface com.atlassian.plugin.ModuleDescriptor
From interface com.atlassian.plugin.Resourced
From interface com.atlassian.plugin.StateAware
From interface com.atlassian.plugin.web.descriptors.ConditionalDescriptor
From interface com.atlassian.plugin.web.descriptors.ContextAware
From interface com.atlassian.plugin.web.descriptors.WebFragmentModuleDescriptor
From interface com.atlassian.plugin.web.descriptors.WebPanelModuleDescriptor
From interface com.atlassian.plugin.web.descriptors.WeightedDescriptor

Constants

public static final String XML_ELEMENT_NAME

Host applications should use this string when registering the web panel module descriptor.

Constant Value: "web-panel"

Public Constructors

public DefaultWebPanelModuleDescriptor (HostContainer hostContainer, ModuleFactory moduleClassFactory, WebInterfaceManager webInterfaceManager)

Public Methods

public void disabled ()

Disables the module descriptor. Classes overriding this method MUST call super.disabled() after their own disabling code.

public void enabled ()

Enables the descriptor by loading the module class. Classes overriding this method MUST call super.enabled() before their own enabling code.

public String getLocation ()

Returns the location in the host application where the web panel should be embedded.

public WebPanel getModule ()

The particular module object created by this plugin.

Returns
  • The module object created by this plugin.

public int getWeight ()

public void init (Plugin plugin, Element element)

Initialise a module given it's parent plugin and the XML element representing the module.

Since atlassian-plugins v2.2, you can no longer load classes from the plugin in this method, because the OSGi bundle that they will live in is not built yet. Load classes in the enabled() method instead.

Parameters
plugin The plugin that the module belongs to. Must not be null.
element XML element representing the module. Must not be null.

Protected Methods

protected void provideValidationRules (ValidationPattern pattern)

Provides validation rules for the pattern

Parameters
pattern The validation pattern