Very nice add-on. Feels like a basic feature that is missing from Vaadin Flow.
One question though.
I was planning to use this in a AppLayout. That AppLayout page would sit at studio/:studioId
Then I would have a NavBar to navigate to sub sections
studio/:studioId/details
studio/:studioId/settings
studio/:studioId/equipement
If these subviews would all have the route @Route(“studio”) and the distinction would be made with @UrlParameterMapping. There is ofcourse a problem with Vaadin Flow that says all routes should be unique.
Is there a way to handle this using this add-on?
If not, any other way this could be handled.
I want the id in the url so that it works when people bookmark the page.
Yes, unfortunately, that is the problem that requires some workarounds.
The solution we use here (at vaadin.com) is to create a dispatcher view that, in it’s own turn initializes and adds requested subviews. Something like:
@Route("studio")
@UrlParameterMapping(":studioId/:viewName")
public class ViewDispatcher extends Component implements HasComponents, HasUrlParameterMapping, BeforeEnterObserver {
@UrlParameter
public String studioId;
@UrlParameter(regEx = "details|settings|equipment")
public String viewName;
@Override
public void beforeEnter(BeforeEnterEvent event) {
removeAll();
switch (viewName) {
"details": add(new DetailView(studioId)); break;
"settings": add(new SettingView(studioId)); break;
"equipment": add(new EquipmentView(studioId)); break;
}
}
}