@Retention(value=RUNTIME) @Target(value=TYPE) public @interface Template
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
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(UiConfig cfg, TabBuilder tab) { tab.fields(cfg.fields.richText("body").label("Text")); } }
TemplateDescription
,
Area
,
TabOrder
,
TabFactory
,
Available
,
I18nBasename
,
DialogFactory
,
TemplateParam
,
TemplateParams
Modifier and Type | Required Element and Description |
---|---|
String |
id
Id of the template.
|
Modifier and Type | Optional Element and Description |
---|---|
TernaryBoolean |
deletable
Specifies whether a component can be deleted.
|
String |
dialog
Id of a dialog to be used for this template.
|
TernaryBoolean |
moveable
Specifies whether a component can be moved.
|
String |
subtype
Specifies the template subtype, such as specific features, e.g.
|
String |
title
Title of the template.
|
String |
type
Specifies the template type, e.g.
|
boolean |
visible
Defines the visibility of the template.
|
TernaryBoolean |
writable
Specifies whether a component can be changed.
|
public abstract String id
<moduleName>:pages/*
or if it's intended to be a component
<moduleName>:components/*
. For example: myModule:pages/mainTemplate
and
myModule:components/textAndImage
.public abstract String title
public abstract String dialog
public abstract boolean visible
public abstract String type
DefaultTemplateTypes
public abstract String subtype
public abstract TernaryBoolean writable
public abstract TernaryBoolean moveable
public abstract TernaryBoolean deletable
Copyright © 2009–2020 Magnolia International Ltd.. All rights reserved.