Class RouteNavUtils

java.lang.Object
org.vaadin.addons.joelpop.appnavlayout.ui.nav.RouteNavUtils

public final class RouteNavUtils extends Object
Stateless helpers for navigating the route hierarchy. @Menu titles are leaf-only display names; all structural logic (depth, grouping, prefix matching) uses the @Route template path.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    leafTitle(com.vaadin.flow.server.menu.MenuEntry entry)
    Returns MenuEntry.title() as the leaf display name — already resolved by MenuConfiguration.getMenuEntries() itself (falling back through @PageTitle to the class name), so this doesn't add a fallback of its own.
    static String
    normalizedPath(com.vaadin.flow.server.menu.MenuEntry entry)
    Returns the path from a MenuEntry with any leading / stripped, matching the format returned by Location.getPath().
    static List<String>
    pathSegments(String routePath)
    Returns the path segments of a route path as an immutable list.
    static String
    Converts a URL route segment to a human-readable label by capitalising each hyphen-delimited word.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • pathSegments

      public static List<String> pathSegments(String routePath)
      Returns the path segments of a route path as an immutable list. An empty path (e.g. the root "") returns an empty list. Strips a leading / so both "catalog/products" and "/catalog/products" return ["catalog", "products"].
    • normalizedPath

      public static String normalizedPath(com.vaadin.flow.server.menu.MenuEntry entry)
      Returns the path from a MenuEntry with any leading / stripped, matching the format returned by Location.getPath().

      MenuEntry.path() returns "/catalog/products"; this method returns "catalog/products".

    • routeSegmentLabel

      public static String routeSegmentLabel(String segment)
      Converts a URL route segment to a human-readable label by capitalising each hyphen-delimited word.

      "catalog""Catalog", "audit-log""Audit Log".

    • leafTitle

      public static String leafTitle(com.vaadin.flow.server.menu.MenuEntry entry)
      Returns MenuEntry.title() as the leaf display name — already resolved by MenuConfiguration.getMenuEntries() itself (falling back through @PageTitle to the class name), so this doesn't add a fallback of its own.