public class FormLayoutCreator {
public static FormLayout create(Object pmo, BindingContext bindingContext) {
FormLayout formLayout = new FormLayout();
formLayout.setId(Sections.getSectionId(pmo));
UiCreator.createUiElements(pmo, bindingContext,
c -> new CaptionComponentWrapper("", (Component)c,
WrapperType.FIELD))
.forEach(cw -> formLayout.addComponent(cw.getComponent()));
return formLayout;
}
}
Creation of a UI with linkki
Manual Section Creation
If you do not use a standard @UISection
or UI layout, you may still use the same mechanisms employed by the PmoBasedSectionFactory
to read UI annotations, create and bind UI components by way of the UiElementCreator
.
In this example the UI elements of a PMO are directly added to a Vaadin FormLayout
. In this case the @UISection annotation of the PMO is ignored.
The created FormLayout
could simply be used with other UI components:
content.addComponent(FormLayoutCreator.create(pmo, bindingContext));