i want to set a standard page title without defining it in every route class (but for example in the main layout). Is there a simple way to do this? I just could find the following link to define it for a single route class:
[Vaadin Tutorial]
(https://vaadin.com/docs/flow/routing/tutorial-routing-page-titles.html)
public class MainLayout extends VerticalLayout implements AfterNavigationObserver, RouterLayout{
...
@Override
public void afterNavigation(AfterNavigationEvent event) {
UI.getCurrent().getPage().setTitle(titleProvider(event));
// titleProvider can be whatever, and may generate the title via event.getLocation() or similar means
}
}
However, this solution does not seem to work on the initial entering of the application (at least it does not in my case). Also it seems to be more of a hack because it just overrides whatever AbstractNavigationStateRenderer.java is doing in its updatePageTitle method