info.magnolia.module.blossom.annotation
Annotation Type Template


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface Template

Used on a Spring Web MVC controller to expose it as a template. A template is either used to render a page or a component.

The title of the template is set with this annotation while the description is set using TemplateDescription.

A component is added to a page using a dialog. A controller that uses this annotation automatically becomes a factory for its dialog. This dialog is automatically assigned an id and you do not need to add the DialogFactory annotation. The functionality for creating the dialog is identical to the functionality of classes that use DialogFactory. More specifically you can use TabFactory, TabValidator, DialogValidator and TabOrder.

If you prefer using a dialog created by a DialogFactory or one configured in Magnolia you can override this behaviour by setting the 'dialog' field.

The class will also be scanned for methods annotated with DialogFactory. This makes it possible to declare dialogs in the same template that they're used for.

It is possible to restrict on which pages a template can be used by using the Available annotation.

You can use I18nBasename to specify which resource bundle should be used for localization of the template's title and description.

For example this template will be exposed with the id "mainTemplate":

 @Controller
 @Template(title = "Main", id = "moduleName:pages/main")
 public class MainTemplate {
   @RequestMapping("/mainTemplate")
   public String render() {
     return "mainTemplate.jsp";
   }
   @TabFactory("Content")
   public void contentTab(TabBuilder tab) {
     tab.addFckEditor("body", "Text", "Text");
     tab.addFile("image", "Image", "Image");
   }
 }
 

Since:
1.0
See Also:
TemplateDescription, Area, TabOrder, TabFactory, TabValidator, DialogValidator, Available, I18nBasename, DialogFactory

Required Element Summary
 String id
          Id of the template.
 String title
          Title of the template.
 
Optional Element Summary
 String dialog
          Id of a dialog to be used for this template.
 boolean visible
          Defines the visibility of the template.
 

Element Detail

id

public abstract String id
Id of the template. Templates intended to be used for pages must have an id in the format <moduleName>:pages/* or if it's intended to be a component <moduleName>:components/*. For example: myModule:pages/mainTemplate and myModule:components/textAndImage.


title

public abstract String title
Title of the template.

dialog

public abstract String dialog
Id of a dialog to be used for this template. By default the controller itself will be responsible for creating the dialog.

Default:
""

visible

public abstract boolean visible
Defines the visibility of the template. When set to false the template is never presented in the user interface. This is useful for templates that are only used for pages that are created by scheduled jobs rather than by editors.

Default:
true


Copyright © 2009-2012 Magnolia International Ltd.. All Rights Reserved.