com.vaadin.flow.server.menu.
Class MenuConfiguration
Menu configuration helper class to retrieve available menu entries for application main menu.
Since:
24.5
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCollect ordered list of menu entries for menu population.
getMenuEntries
(Locale locale) Collect ordered list of menu entries for menu population.
Retrieves the page header of the currently shown view.
getPageHeader
(Component content) Retrieves the page header of the currently shown view.
-
Constructor Details
-
MenuConfiguration
public MenuConfiguration()
-
-
Method Details
-
getMenuEntries
Collect ordered list of menu entries for menu population. All client views are collected and any accessible server views.
Returns:
ordered list of
MenuEntry
instances -
getMenuEntries
Collect ordered list of menu entries for menu population. All client views are collected and any accessible server views.
Parameters:
locale
- locale to use for ordering. null for default locale.Returns:
ordered list of
MenuEntry
instances -
getPageHeader
Retrieves the page header of the currently shown view. Can be used in Flow main layouts to render a page header.
Attempts to retrieve header from the following sources:
- from
ViewConfig.title
of the client-side views; - from
HasDynamicTitle.getPageTitle()
if present, then fromPageTitle
value of the server-side route
For server-side routes it falls back to route's Java class name, if a non-null
content
is given. For client-side views it falls back to the React element's function name, if a page header couldn't be retrieved from theViewConfig
.Use
getPageHeader()
method, if a content object is not available.Parameters:
content
- as aComponent
class that represents a content in layout, can benull
, if unavailable.Returns:
optional page header for layout
- from
-
getPageHeader
Retrieves the page header of the currently shown view. Can be used in Flow main layouts to render a page header.
Attempts to retrieve header from the following sources:
- from
ViewConfig.title
of the client-side views; - from
HasDynamicTitle.getPageTitle()
if present, then fromPageTitle
value of the server-side route
For server-side routes it falls back to route's Java class name. For client-side views it falls back to the React element's function name, if a page header couldn't be retrieved from the
ViewConfig
.Note that the possible sources of page header are limited to only available views in automatic menu configuration. If a route has a mandatory route parameters or has a route template, then it won't be used as a possible header source, even if it's shown.
Use
getPageHeader(Component)
if content object is available, e.g. inRouterLayout
based layouts.Returns:
optional page header for layout
- from
-