public class FreemarkerLayout extends Object implements AdvancedLayout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
Constructor and Description |
---|
FreemarkerLayout(FreemarkerLayoutConfig config)
Configure the FreemarkerLayout using the given
config.getDirectoryForTemplateLoading() and config.getTemplate() (see
freemarker.template.Configuration).
|
Modifier and Type | Method and Description |
---|---|
void |
endContainerLayout(StaticXmlWidget container,
StaticXmlMetawidget metawidget)
Finish the given container, using the given Metawidget to access additional services if
needed (such as state saving).
|
void |
layoutWidget(StaticXmlWidget widget,
String elementName,
Map<String,String> attributes,
StaticXmlWidget container,
StaticXmlMetawidget metawidget)
Layout the given widget within the given container, using the given
elementName and attributes as a guide and the given Metawidget to access
additional services if needed (such as state saving)
|
void |
onEndBuild(StaticXmlMetawidget metawidget)
Event called at the end of widget building, after all widgets have been built and added to
the
Layout . |
void |
onStartBuild(StaticXmlMetawidget metawidget)
Event called at the start of the widget building process, before the
WidgetBuilder is called. |
void |
startContainerLayout(StaticXmlWidget container,
StaticXmlMetawidget metawidget)
Initialise the given container, using the given Metawidget to access additional services if
needed (such as state saving).
|
public FreemarkerLayout(FreemarkerLayoutConfig config)
public void onStartBuild(StaticXmlMetawidget metawidget)
AdvancedLayout
WidgetBuilder
is called. Layout
s may wish to act on this event to
initialize themselves ready for processing, or to perform 'outermost-container-only'
processing, such as adding facets. This event is only called once per inspection, not once
per widget built.onStartBuild
in interface AdvancedLayout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
metawidget
- the parent Metawidget. Never nullpublic void startContainerLayout(StaticXmlWidget container, StaticXmlMetawidget metawidget)
AdvancedLayout
startContainerLayout
in interface AdvancedLayout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
container
- the container to layout. This is often the same as the given Metawidgetmetawidget
- the parent Metawidget. Never nullpublic void layoutWidget(StaticXmlWidget widget, String elementName, Map<String,String> attributes, StaticXmlWidget container, StaticXmlMetawidget metawidget)
Layout
layoutWidget is called immediately after WidgetBuilder.buildWidget and WidgetProcessor.processWidget, and before the next widget is generated. An alternate design would be to 'collect' all widgets generated by buildWidget and processWidget, then iterate over them separately for the layout. If you prefer this approach, you can simulate it by having layoutWidget do nothing but 'remember' each widget, then iterate over them in endContainerLayout (see the AdvancedLayout interface). However not all UI frameworks allow this approach, because they do not suport widgets being instantiated independent of a layout, nor moved between layouts (e.g. SWT)
layoutWidget
in interface Layout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
widget
- the widget to layout. Never nullelementName
- XML node name of the business field. Typically 'entity',
'property' or 'action'. Never nullattributes
- attributes of the widget to layout. Never null. This Map is
modifiable - changes will be passed to subsequent
WidgetProcessors and Layoutscontainer
- the container to add to. This is often the same as the given
Metawidgetmetawidget
- the Metawidget to use to access additional services. Never
nullpublic void endContainerLayout(StaticXmlWidget container, StaticXmlMetawidget metawidget)
AdvancedLayout
endContainerLayout
in interface AdvancedLayout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
container
- the container to layout. This is often the same as the given Metawidgetmetawidget
- the Metawidget to use to access additional services. Never nullpublic void onEndBuild(StaticXmlMetawidget metawidget)
AdvancedLayout
Layout
. Layout
s may wish to act on this event to clean
themselves up after processing, or to perform 'outermost-container-only' processing, such as
adding facets. This event is only called once per inspection, not once per widget built.onEndBuild
in interface AdvancedLayout<StaticXmlWidget,StaticXmlWidget,StaticXmlMetawidget>
metawidget
- the parent Metawidget. Never nullCopyright © 2015. All Rights Reserved.