I use @PreserveOnRefresh on my UI, but Page title not restored after user use F5.
I just tried the following annotations on my UI class:
@PreserveOnRefresh
@Title("test page")
This seems to work properly - the title is “test page” at initial load and after refresh. Or did I misunderstand your issue?
But, how to dynamically set Page title ?
Ah, okay, I missed the dynamically part. I think you should be able to set it by just calling Page.getCurrent().setTitle(“title”);
Another option would be to write your own UIProvider and override the getPageTitle(…) method there, but I think this is only called when the UI is first created.
This method could setTitle “Page.getCurrent().setTitle(“title”);”.
And how to getTitle? I could not find the method.
Where are you putting:
Page.getCurrent().setTitle(“title”);
I have tried it in the UI’s init(VaadinRequest request) but it does not work on page refresh. Any ideas??