jmix
jmix copied to clipboard
Tab injection does not work when TabSheet is placed in component container
Environment
Jmix version: 2.1.3
Bug Description
See Russian support forum: topic.
When TabSheet is placed in VerticalLayout/HorizontalLayout/FormLayout and probably other layouts, controller dependency injector cannot find Tab instance.
Steps To Reproduce
- Add to XML:
<layout>
<vbox>
<tabSheet id="tabSheet2"
width="100%">
<tab id="tab3" label="tab3">
<span text="content"/>
</tab>
<tab id="tab4"
label="tab4">
<span text="content"/>
</tab>
</tabSheet>
<hbox>
<tabSheet id="tabSheet1"
width="100%">
<tab id="tab1" label="tab1">
<span text="content"/>
</tab>
<tab id="tab2" label="tab2">
<span text="content"/>
</tab>
</tabSheet>
</hbox>
</vbox>
</layout>
- Add to the controller:
@ViewComponent("tabSheet1.tab1")
private Tab tab1;
@ViewComponent("tabSheet2.tab3")
private Tab tab3;
@Subscribe
public void onBeforeShow(final BeforeShowEvent event) {
Objects.requireNonNull(tab1);
Objects.requireNonNull(tab3);
}
- Set debug breakpoint to
onBeforeShow
Current Behavior
Both instances are null.
Expected Behavior
Tabs are not null.