Class CardDirectiveModel

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

public final class CardDirectiveModel extends Object implements freemarker.template.TemplateDirectiveModel
The <@card> FreeMarker directive: adds one entry to the page contract's cards[].

html (the default) and terminal-view are built in. datatables, terminal and every other well-formed type name is dispatched through the host's CardTypeRegistry: a registered CardTypeHandler validates it, and an unregistered type falls back to the generic passthrough. Every type other than html requires id=.

type="html" (the default) takes exactly one content source: a body (emitted as <template data-card="{id}">), template= (reuses another card's template), or src= (fetched same-origin by the shell). type="datatables" takes src= or a JSON5 catalog body and becomes the C1 bridge card. type="terminal-view" takes a JSON5 {contractVersion: '1', terminalView: {...}} body and becomes the terminal-view bridge card (see TerminalViewDef). type="terminal" takes a JSON5 {contractVersion: '1', terminal: {...}} body and becomes the terminal card (see TerminalDef). A card without id= gets jc-card-N. <@card> is only valid inside <@page>; markup around it becomes jc-seg-N segments, so the authored order is kept.

Example:

<@page tab="releases"> <@card id="intro" title="Releases"><p>All releases.</p></@card> <@card type="datatables" id="releases"> { dataUrl: '/rest/releases/data', columns: [ { key: 'name', label: 'Name' } ] } </@card> </@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