Class PathPrefixNavGrouper
- All Implemented Interfaces:
NavGrouper
NavGrouper — derives the navigation hierarchy from route path
segments, mirroring the structure of @Route paths.
Group metadata comes from a NavGroup resolver when set, falling back to
humanised path segment labels. Leaf titles come from RouteNavUtils.leafTitle(MenuEntry).
Leaf icons come from the configured viewIconGenerator (default: none).
Path-based group nodes carry no icon; use a NavGroup resolver with
NavGroup.icon() to assign icons to groups.
When a NavGroup resolver assigns a root group to any view, all views
sharing the same first path segment are merged into that group automatically,
even if they carry no annotation — provided all NavGroup-assigned views are
processed by nodeFor(MenuEntry) before any path-based views are processed.
Group nodes are cached so the same NavNode instance is returned for
the same group identity across multiple nodeFor(MenuEntry) calls. Group identity for a
NavGroup resolver is its (parent, title()) pair, not the resolved
NavGroup object itself — NavGroup declares no equals(), and a
resolver that (as is natural) builds a fresh instance per call would otherwise never
merge two siblings resolving to the same group.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionnodeFor(com.vaadin.flow.server.menu.MenuEntry entry) Returns theNavNoderepresentingentryin the navigation tree.voidreset()Clears any cached state so the nextNavGrouper.nodeFor(MenuEntry)calls start fresh.setNavGroupDefResolver(Function<com.vaadin.flow.server.menu.MenuEntry, NavGroup> resolver) setViewIconGenerator(Function<com.vaadin.flow.server.menu.MenuEntry, Supplier<com.vaadin.flow.component.icon.Icon>> generator) Sets the icon generator for leaf nav nodes; default returns no icon.
-
Constructor Details
-
PathPrefixNavGrouper
public PathPrefixNavGrouper()
-
-
Method Details
-
setViewIconGenerator
public PathPrefixNavGrouper setViewIconGenerator(Function<com.vaadin.flow.server.menu.MenuEntry, Supplier<com.vaadin.flow.component.icon.Icon>> generator) Sets the icon generator for leaf nav nodes; default returns no icon. -
reset
public void reset()Description copied from interface:NavGrouperClears any cached state so the nextNavGrouper.nodeFor(MenuEntry)calls start fresh.- Specified by:
resetin interfaceNavGrouper