Interface NavGrouper
- All Known Implementing Classes:
PathPrefixNavGrouper
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy for mapping
MenuEntry items to their position in the navigation
tree. The returned NavNode encodes both the leaf and its full ancestor
chain via NavNode.parent().
The default implementation is PathPrefixNavGrouper, which derives the
hierarchy from route path segments.
Contract for implementors:
nodeFor(MenuEntry)must be idempotent: calling it multiple times with the sameMenuEntrymust return a node that is equal to the one returned on the first call. The framework callsnodeForduring both the initial nav build and on every subsequent navigation event (to resolve the active section for highlighting), so implementations that mutate state on the first call will produce incorrect results.- The order in which entries are passed to
nodeForis not guaranteed. Implementations that need a specific processing order (e.g. to register explicit group roots before path-based siblings) must handle that ordering internally, for example by lazily performing a full-population pass on the first call usingMenuConfiguration.getMenuEntries().
-
Method Summary
Modifier and TypeMethodDescriptionnodeFor(com.vaadin.flow.server.menu.MenuEntry entry) Returns theNavNoderepresentingentryin the navigation tree.default voidreset()Clears any cached state so the nextnodeFor(MenuEntry)calls start fresh.
-
Method Details
-
reset
default void reset()Clears any cached state so the nextnodeFor(MenuEntry)calls start fresh.