public abstract class NestedSectionLayoutDecorator<W,C extends W,M extends C> extends LayoutDecorator<W,C,M>
Modifier and Type | Class and Description |
---|---|
static class |
NestedSectionLayoutDecorator.State<C>
Simple, lightweight structure for saving state.
|
Modifier | Constructor and Description |
---|---|
protected |
NestedSectionLayoutDecorator(LayoutDecoratorConfig<W,C,M> config) |
Modifier and Type | Method and Description |
---|---|
protected abstract C |
createSectionWidget(C previousSectionWidget,
String section,
Map<String,String> attributes,
C container,
M metawidget)
Creates a new widget to hold this section (
getState().currentSection ). |
void |
endContainerLayout(C container,
M metawidget)
Finish the given container, using the given Metawidget to access additional services if
needed (such as state saving).
|
protected abstract NestedSectionLayoutDecorator.State<C> |
getState(C container,
M metawidget) |
protected abstract boolean |
isIgnored(W widget) |
void |
layoutWidget(W widget,
String elementName,
Map<String,String> attributes,
C container,
M 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 |
startContainerLayout(C container,
M metawidget)
Initialise the given container, using the given Metawidget to access additional services if
needed (such as state saving).
|
protected abstract String |
stripSection(Map<String,String> attributes) |
getDelegate, onEndBuild, onStartBuild
protected NestedSectionLayoutDecorator(LayoutDecoratorConfig<W,C,M> config)
public void startContainerLayout(C container, M metawidget)
AdvancedLayout
startContainerLayout
in interface AdvancedLayout<W,C extends W,M extends C>
startContainerLayout
in class LayoutDecorator<W,C extends W,M extends C>
container
- the container to layout. This is often the same as the given Metawidgetmetawidget
- the parent Metawidget. Never nullpublic void layoutWidget(W widget, String elementName, Map<String,String> attributes, C container, M 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<W,C extends W,M extends C>
layoutWidget
in class LayoutDecorator<W,C extends W,M extends C>
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(C container, M metawidget)
AdvancedLayout
endContainerLayout
in interface AdvancedLayout<W,C extends W,M extends C>
endContainerLayout
in class LayoutDecorator<W,C extends W,M extends C>
container
- the container to layout. This is often the same as the given Metawidgetmetawidget
- the Metawidget to use to access additional services. Never nullprotected abstract NestedSectionLayoutDecorator.State<C> getState(C container, M metawidget)
protected abstract boolean isIgnored(W widget)
protected abstract C createSectionWidget(C previousSectionWidget, String section, Map<String,String> attributes, C container, M metawidget)
getState().currentSection
).previousSectionWidget
- the previous section widget (if any). This can be useful for tracing back to, say,
a TabHostCopyright © 2015. All Rights Reserved.