Class SwitcherDef

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

public final class SwitcherDef extends Object
Builder for a switcher card: one card slot that shows one of several named views, each holding one card or a strip of sections that each hold a card.

A view with a single section that has the default id and no model block serializes as a plain card; any other view serializes as sections. A switcher cannot hold another switcher. Validation runs in toCardSpec() and is shared with SwitcherCardType through validate(String, Map), so both paths report the same messages.

Example:

CardSpec c = SwitcherDef.create("revenue-sw").title("Revenue") .view("chart", "Chart", v -> v.section(ChartDef.line("revenue-chart").src("/console/store/stats/revenue").toCardSpec())) .view("data", "Data", v -> v.section("all", "All", CardSpec.of("html", "d1")).section("open", "Open", CardSpec.of("html", "d2"))) .initialView("chart") .toCardSpec();

Since:
10.0.0