Class NavNode

java.lang.Object
org.apache.juneau.console.freemarker.NavNode

public final class NavNode extends Object
One node in the console navigation tree. Nodes nest to any depth; <@node> directives append to the node returned by PageCapture.navRoot().
Example:

NavNode root = PageCapture.of(env).navRoot(); NavNode home = root.add("home", "Home", "/home"); home.add("about", "About", "/home/about"); root.find(List.of("home", "about")).map(NavNode::label); // Optional[About]

Since:
10.0.0
  • Method Details

    • add

      public NavNode add(String nodeId, String label, String hrefOrNull) throws freemarker.template.TemplateModelException
      Appends a child node.
      Parameters:
      nodeId - The node id, unique among its siblings.
      label - The visible label.
      hrefOrNull - The link target, or null for a parent-only node.
      Returns:
      The new child.
      Throws:
      freemarker.template.TemplateModelException - If a sibling already has this id (E-3).
    • find

      public Optional<NavNode> find(List<String> idPath)
      Walks a root-first id path from this node.
      Parameters:
      idPath - The ids, root first.
      Returns:
      The node at the end of the path, or empty.
    • id

      public String id()
      Returns:
      The id, or null for the synthetic root.
    • label

      public String label()
      Returns:
      The label.
    • href

      public String href()
      Returns:
      The href, or null.
    • children

      public List<NavNode> children()
      Returns:
      The children, unmodifiable.