Interface HasDynamicTitle

All Superinterfaces:
Serializable
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface HasDynamicTitle extends Serializable
Allows to resolve navigation target title dynamically at runtime, based on the live state of the navigation target instance.

Because getPageTitle() is an instance method, it is resolved from the view that is actually shown and can therefore reflect state that only exists once the view has been created and navigated to. Use this interface when the title depends on such live state, for example:

  • a value looked up while building the view and cached in an instance field, so the lookup is not repeated only to compute the title;
  • a title that changes after navigation while the view is shown;
  • a title that depends on the view's own access control or navigation awareness.
Since it needs an instance, it can only produce a title for a route that is actually shown. To resolve a title without an instance — for example for routes that are not shown, such as the entries of a breadcrumb trail or a menu — use the instance-free counterpart DynamicPageTitle together with a PageTitleGenerator instead.

NOTE: It is not legal for a class to both implement HasDynamicTitle and have a PageTitle annotation.

Since:
1.0.
Author:
Vaadin Ltd
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the title of this navigation target.
  • Method Details

    • getPageTitle

      String getPageTitle()
      Gets the title of this navigation target.
      Returns:
      the title of this navigation target