Class CardSpec
java.lang.Object
org.apache.juneau.console.freemarker.CardSpec
Type-agnostic card entry in the page contract:
id, type, optional src,
title, template, plus a type-specific body map. C2 extends the card grammar.
Example:
CardSpec
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionbare(boolean v) bodyMap()static CardSpecid()static CardSpecDeclares custom topics this card's JS publishes; repeatable, appends.sanitize(boolean v) subscribes(Subscription... v) Wires topics to roles this card's type implements; repeatable, appends.toMap()type()visibleWhen(VisibilityRule... rules) Sets card-level visibility rules.
-
Method Details
-
html
- Parameters:
id- The card id. @return A newhtmlcard.
-
of
- Parameters:
type- The card type. @param id The card id. @return A new card.
-
title
- Parameters:
v- The card title. @return This object.
-
src
- Parameters:
v- A same-origin URL the card loads. @return This object.
-
template
- Parameters:
templateId- The id of a<template data-card>element. @return This object.
-
bare
- Parameters:
v- Whether the card drops its chrome: an html card is inserted with no wrapper element, any other type keeps a wrapper element (classjc-card-bareinstead ofjc-card) but loses the card chrome and its title.- Returns:
- This object.
-
sanitize
- Parameters:
v- Whether an html card's fetchedsrcfragment is rebuilt through the views attribute-allowlist sanitizer instead of being inserted as-is. @return This object.
-
cssClass
- Parameters:
v- Space-separated CSS class names stamped on the card wrapper element. @return This object.
-
body
- Parameters:
key- A type-specific field. @param value Its value. @return This object.
-
publishes
Declares custom topics this card's JS publishes; repeatable, appends.- Parameters:
v- The declarations; each needsretainand must not setpublisher.- Returns:
- This object.
-
visibleWhen
Sets card-level visibility rules. The client evaluates them against the page's facts; this only serializes them.- Parameters:
rules- The rules, ANDed together. None clears them.- Returns:
- This object.
-
subscribes
Wires topics to roles this card's type implements; repeatable, appends.- Parameters:
v- The subscriptions.- Returns:
- This object.
-
id
- Returns:
- The id.
-
type
- Returns:
- The type.
-
bodyMap
- Returns:
- An unmodifiable copy of the type-specific body fields, in insertion order.
-
toMap
- Returns:
- The contract entry, common fields first.
-