Page Decorators

Decorators allow content generated by one of your servlet modules to appear in the FishEye/Crucible UI without you needing to generate headers, footers, sidebars and so on. 

What is a Decorator?

A decorator creates standard parts of the page and inserts the content created by a plugin servlet in the appropriate place. For example, the atl.general decorator provides the standard header and footer, while the atl.admin decorator also provides the left hand column of administration links, with the plugin generated content in a section to its right.

So, a servlet which is rendering a URL from a web item in the system.admin location would request the atl.admin decorator.

All servlet plugins whose response is rendered as a Fisheye/Crucible page should specify a decorator in the response. Meta tags in the head of the HTML page are used to choose a decorator and provide it with any parameters it needs.

Decorator Code Example

The decorator name and parameters are given thus:

<head>
...
<meta name='decorator' content='fisheye.userprofile.tab'/>
<meta name='profile.tab.key' content='com.atlassian.crucible.example.plugin.event.crucible-example-event-plugin:test-profile-tab'/>
...
</head>

The value given by the content parameter of the profile.tab.key is the plugin module key of the web-item which creates the tab we want, shown as selected when this page is rendered.

Alternatively you can request a decorator by setting an attribute on the request in your servlet:

request.setAttribute("decorator", "fisheye.userprofile.tab");
// request.setAttribute("meta.profile.tab.key", "twitter"); -- should work, but doesn't
response.setContentType("text/html");

Note that:

  • Specifying meta parameters as attributes doesn't seem to work – put them in your page instead.
  • Only responses with a content type of text/html are decorated.

Table of Decorator Parameters

Decorator

Description

atl.general

Provides standard header and footer.

Parameters: None

atl.admin

Provides left hand column of administration links.

Parameters: None

fisheye.userprofile.tab

Content rendered as a single tab on the user profile page.

Parameters: profile.tab.key The plugin module key of the web item which created the tab.

fisheye.report.tab

Content rendered as a single tab on the Source, Reports page

Parameters: report.tab.key The plugin module key of the web item which created the tab.

crucible.report.tab

Content rendered as a single tab on the Reviews, Reports page

Parameters: report.tab.key The plugin module key of the web item which created the tab. repository.path this needs to be provided if the report relates to a particular repository and path. It has the form <repo name>/<path within repo>.

Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport