public class CompositeWidgetBuilder<W,M extends W> extends Object implements AdvancedWidgetBuilder<W,M>
Each sub-WidgetBuilder in the list is invoked, in order, calling its buildWidget
method. The first non-null result is returned. If all sub-WidgetBuilders return null, null is
returned (the parent Metawidget will generally instantiate a nested Metawidget in this case).
Note: the name CompositeWidgetBuilder refers to the Composite design pattern.
Constructor and Description |
---|
CompositeWidgetBuilder(CompositeWidgetBuilderConfig<W,M> config) |
Modifier and Type | Method and Description |
---|---|
W |
buildWidget(String elementName,
Map<String,String> attributes,
M metawidget)
Builds the most appropriate widget for this business field.
|
WidgetBuilder<W,M>[] |
getWidgetBuilders()
Exposed for
getValue calls. |
void |
onEndBuild(M metawidget)
Event called at the end of widget building, after all widgets have been built and added to
the
Layout . |
void |
onStartBuild(M metawidget)
Event called at the start of the widget building process, before any
WidgetBuilder s are called. |
public CompositeWidgetBuilder(CompositeWidgetBuilderConfig<W,M> config)
public void onStartBuild(M metawidget)
AdvancedWidgetBuilder
WidgetBuilder
s are called. WidgetBuilder
s may wish to act on this
event to initialize themselves ready for processing. This event is only called once per
inspection, not once per widget built.onStartBuild
in interface AdvancedWidgetBuilder<W,M extends W>
metawidget
- the parent Metawidget. Never nullpublic W buildWidget(String elementName, Map<String,String> attributes, M metawidget)
WidgetBuilder
buildWidget
in interface WidgetBuilder<W,M extends W>
elementName
- XML node name of the business field. Typically 'entity', 'property' or 'action'.
Never nullattributes
- attributes of the business field to build a widget for. Never null. This Map is
modifiable - changes will be passed to subsequent WidgetBuilders, WidgetProcessors
and Layoutsmetawidget
- the parent Metawidget. Never nullpublic void onEndBuild(M metawidget)
AdvancedWidgetBuilder
Layout
. WidgetBuilders
s may wish to act on this event to clean
themselves up after processing. This event is only called once per inspection, not once per
widget built.onEndBuild
in interface AdvancedWidgetBuilder<W,M extends W>
metawidget
- the parent Metawidget. Never nullpublic WidgetBuilder<W,M>[] getWidgetBuilders()
getValue
calls.Copyright © 2015. All Rights Reserved.