I have a detail view with an entityComboBox. I pass in items to populate that combox via a viewConfigurer from a list view.
@Install(to = "redundancyRulesDataGrid.createAction", subject = "viewConfigurer")
private void redundancyRulesDataGridCreateActionViewConfigurer(InfraStructureRedundancyRuleDetailView detailView) {
detailView.setInfraStructureLevelCandidates(levelsDc.getItems());
}
Then, in the detailView. I pick up those items and set them to the appropriate datacontainer that backs the combobox.
@Setter
private List<InfrastructureLevel> candidateParentLevels;
@Subscribe
public void onBeforeShow(final BeforeShowEvent event) {
candidateParentsDc.setItems(doSomethingWith(candidateParentLevels));
}
This works fine. But I can not mimick this in a unit test using viewnavigators. The candidateParentLevels is null and the screen depends on it.
viewNavigators.detailView(UiTestUtils.getCurrentView(), InfrastructureLevel.class)
.newEntity()
.withViewClass(TARGET_VIEW)
.withAfterNavigationHandler(event -> {
InfrastructureLevelDetailView view = event.getView();
view.setCandidateParentLevels(new ArrayList<>());
})
.navigate());
I tried using a ReadyEvent instead, but that still gives the same problem. The readyEvent is still fired before the AfterViewNavigationEvent
I could fall back to using viewNavigators and custom create action instead of using the ViewConfigurer. But the viewConfigurer is much cleaner, it also kinda beats the whole point of the viewConfigurer.