Class NodeDirectiveModel

java.lang.Object
org.apache.juneau.console.freemarker.NodeDirectiveModel
All Implemented Interfaces:
freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

public final class NodeDirectiveModel extends Object implements freemarker.template.TemplateDirectiveModel
The recursive <@node> console FreeMarker directive: one entry in a <@navigation> tree, of any depth, or (with under=) a page-scoped addition appended under an existing chrome nav node.

Attributes: id (required, checked against the id grammar — E-4), label (required), href (required on a leaf — E-2), visible (a strict boolean, omit defaults to true — E-5), selected (a strict boolean, omit defaults to false — E-5), and under (a chrome nav id path; see below). format= and any unknown attribute are rejected. A duplicate sibling id is rejected (E-3). At most one node tree-wide may set selected=true (E-6).

visible=false omits the node and its whole subtree — the body is not even rendered. A node not nested inside <@navigation> and without under= is rejected fail-closed.

Example:

<@navigation> <@node id="work" label="Work" href="/work"> <@node id="work-queue" label="Queue" href="/work/queue"/> </@node> <@node id="setup" label="Setup" href="/setup" visible=isAdmin/> </@navigation>

under=: page-scoped nav additions:

under= is allowed only on a <@node> that is a direct child of <@page>, or of <@console> outside <@navigation>; anywhere else it is E-B14. The node (and any ordinary nested <@node> children, built exactly as inside <@navigation>) is recorded as a pending addition and applied at </@console>, before activeNav resolves. An unknown under= path is E-B8; a duplicate sibling under the resolved parent is E-3. PageSpec.navUnder(String, PageCapture.NavAdder) is the Java twin; both funnel into the same resolution pass. Pending additions resolve in order — Java navUnder calls first, then <@node under> in document order — so an addition can target only a node created by an earlier one; a forward reference is E-B8.

<@page tab="fleet/instances/${instance.id}/logs"> <@node under="fleet/instances" id=instance.id label=instance.name href="/fleet/instances/${instance.id}"> <@node id="logs" label="Logs" href="/fleet/instances/${instance.id}/logs" selected=true/> </@node> </@page>

Since:
10.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The shared-variable name this directive registers under.

    Fields inherited from interface freemarker.template.TemplateModel

    NOTHING
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body)
     

    Methods inherited from class java.lang.Object

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

  • Method Details

    • execute

      public void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body) throws freemarker.template.TemplateException, IOException
      Specified by:
      execute in interface freemarker.template.TemplateDirectiveModel
      Throws:
      freemarker.template.TemplateException
      IOException