Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic route titles #2397

Closed
Legioth opened this issue Sep 14, 2017 · 1 comment
Closed

Dynamic route titles #2397

Legioth opened this issue Sep 14, 2017 · 1 comment

Comments

@Legioth
Copy link
Member

Legioth commented Sep 14, 2017

For a navigation target that implements HasDynamicTitle, its getTitle method is run after delivering BeforeNavigationEvent to get the title to use when navigation to that view.

It is not legal for a class to both implement HasDynamicTitle and have a @Title annotation, which should be detected at initialization phase.

@Route("blog")
public void BlogPage extends Div  implements HasUrlParameter<String>, HasDynamicTitle {
  @Override
  public void setParameter(BeforeNavigationEvent event, String id) {
    showPost(BlogService.get().findPost(id));
  }

  @Override
  public String getTitle() {
    return getCurrentPost().getTitle();
  }
}
@torok-peter
Copy link
Contributor

torok-peter commented Oct 13, 2017

As it turned out that HtmlComponent already has a getTitle method but with different signature, it was decided to rename HasDynamicTitle::getTitle to getPageTitle to avoid conflicts. And for consistency, the Title annotation is also renamed to PageTitle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants