Class NavNode

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

public final class NavNode extends Object
A node in the navigation tree — either a group (non-navigable section) or a leaf (navigable view). The presence of menuEntry() distinguishes leaves from groups.

Group nodes carry an explicit title and optional icon supplier. Leaf nodes derive their title from RouteNavUtils.leafTitle(MenuEntry) and their icon from @Menu(icon="collection:name") if present. External icon generators take priority over the menu-derived icon.

  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<com.vaadin.flow.component.icon.Icon>
    Creates and returns a fresh display icon for this node, or empty if none is configured.
    boolean
     
    int
     
    Optional<com.vaadin.flow.server.menu.MenuEntry>
    The menu entry for leaf nodes; empty for group nodes.
    static NavNode
    of(com.vaadin.flow.server.menu.MenuEntry entry)
    Leaf node with no parent (top-level view).
    static NavNode
    of(com.vaadin.flow.server.menu.MenuEntry entry, Supplier<com.vaadin.flow.component.icon.Icon> iconOverride)
    Leaf node with no parent; uses iconOverride if non-null, else derives icon from @Menu.
    static NavNode
    of(com.vaadin.flow.server.menu.MenuEntry entry, Supplier<com.vaadin.flow.component.icon.Icon> iconOverride, NavNode parent)
    Leaf node nested under parent; uses iconOverride if non-null, else derives icon from @Menu.
    static NavNode
    of(com.vaadin.flow.server.menu.MenuEntry entry, NavNode parent)
    Leaf node nested under parent.
    static NavNode
    of(String title, Supplier<com.vaadin.flow.component.icon.Icon> iconSupplier)
    Group node with no parent (top-level section).
    static NavNode
    of(String title, Supplier<com.vaadin.flow.component.icon.Icon> iconSupplier, NavNode parent)
    Group node nested under parent.
    Parent node, or empty for top-level nodes.
    Display title for this node.

    Methods inherited from class Object

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

    • of

      public static NavNode of(String title, Supplier<com.vaadin.flow.component.icon.Icon> iconSupplier)
      Group node with no parent (top-level section).
    • of

      public static NavNode of(String title, Supplier<com.vaadin.flow.component.icon.Icon> iconSupplier, NavNode parent)
      Group node nested under parent.
    • of

      public static NavNode of(com.vaadin.flow.server.menu.MenuEntry entry)
      Leaf node with no parent (top-level view).
    • of

      public static NavNode of(com.vaadin.flow.server.menu.MenuEntry entry, Supplier<com.vaadin.flow.component.icon.Icon> iconOverride)
      Leaf node with no parent; uses iconOverride if non-null, else derives icon from @Menu.
    • of

      public static NavNode of(com.vaadin.flow.server.menu.MenuEntry entry, NavNode parent)
      Leaf node nested under parent.
    • of

      public static NavNode of(com.vaadin.flow.server.menu.MenuEntry entry, Supplier<com.vaadin.flow.component.icon.Icon> iconOverride, NavNode parent)
      Leaf node nested under parent; uses iconOverride if non-null, else derives icon from @Menu.
    • title

      public String title()
      Display title for this node.
    • createIcon

      public Optional<com.vaadin.flow.component.icon.Icon> createIcon()
      Creates and returns a fresh display icon for this node, or empty if none is configured. Each call creates a new Icon instance — do not cache the result.
    • parent

      public Optional<NavNode> parent()
      Parent node, or empty for top-level nodes.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object