Package com.vaadin.flow.router
Annotation Interface DynamicPageTitle
Resolves the page title of a navigation target dynamically through a
PageTitleGenerator, without creating an instance of the navigation
target.
This is the instance-free counterpart of HasDynamicTitle: the title
is resolved purely from the navigation target class and its route parameters,
which makes it usable for routes that are not (and should not be)
instantiated, such as the entries of a breadcrumb trail or a menu.
@Route("products/:productId")
@DynamicPageTitle(ProductTitleGenerator.class)
public class ProductView extends Div {
// ...
}
A PageTitle value may be declared alongside this annotation; it is
then handed to the generator through PageTitleContext.value() (for
example as an i18n message key) rather than used as the title directly.
When the title instead depends on the live state of the already shown view
— for example a value looked up while building the view or a title that
changes after navigation — implement HasDynamicTitle on the
view itself.
- Since:
- 25.2
- Author:
- Vaadin Ltd
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends PageTitleGenerator> Gets thePageTitleGeneratortype used to resolve the title.
-
Element Details
-
value
Class<? extends PageTitleGenerator> valueGets thePageTitleGeneratortype used to resolve the title.- Returns:
- the generator type, not
null
-