Class RegionTable
RegionDef — an empty
data-juneau-region container plus one sidecar per host carrying every region descriptor that host
declares.
The container carries identity; the sidecar carries configuration:
The container is deliberately empty and deliberately attribute-only — id, type, and the handshake stamp and
nothing else. Configuration (the populator name, dataUrl, params, renderer, lazy,
refreshMs, the field catalog) rides the sidecar, for the same reason PAGE_META does: an attribute
per descriptor key would put author strings in attribute position on every host, and a JSON envelope is the shape
the client already parses. The attributes are exactly what the runtime scans for, mirroring the existing
data-juneau-page / data-juneau-view / data-juneau-card markers.
One sidecar per host, not per region. One <script> per card in a twelve-card grid is twelve parses;
the existing pattern is one sidecar per view / page / header / bar, and this follows it.
Two sidecar forms, and why the second exists:
sidecar(String, List) stamps a document-unique HTML id, for an ordinary once-per-response host
(a page, a card grid). detailSidecar(List) ships id-less and is found by attribute instead,
because a row-detail sidecar lives inside the <template data-juneau-row-detail> that is cloned per
expanded row — a stamped id would collide across every open panel. This is exactly the split
BarSlot already makes, for the same
reason.
- Since:
- 10.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMarker attribute carrying a region's own id:data-juneau-region.static final StringTheclasson every region container.static final StringAttribute carryingRegionDef.CONTRACT_VERSIONon the region container (the per-host handshake stamp).static final StringAttribute carrying the enclosing response's CSRF token on a region host that is not a<table>— deliberatelyViewTable.CSRF_ATTR, the same attribute the view table already stamps, not a region-specific second name.static final StringAttribute carrying the region's own contract descriptor (itsparamsincluded) as JSON, for a region placed outside a sidecar-bearing host.static final StringAttribute theid-lessdetailSidecar(List)form is found by.static final StringAttribute carrying the region's populator name:data-juneau-region-populate.static final StringAttribute carrying the region's type (RegionDef.TYPE_ROW_DETAILand friends).static final StringHTMLidprefix for thesidecar(String, List)form. -
Method Summary
Modifier and TypeMethodDescriptionBuilds the sidecar envelope: the contract version once, then one descriptor per region in emit order.static ScriptdetailSidecar(List<RegionDef> regions) Emits theid-less, attribute-found sidecar for a host whose subtree is cloned per row.static DivEmits one empty region container.static DivEmits one empty region container, optionally carrying the non-table host's CSRF stamp.static ScriptEmits the per-host sidecar with a document-unique HTMLid.
-
Field Details
-
REGION_ATTR
Marker attribute carrying a region's own id:data-juneau-region.- See Also:
-
REGION_TYPE_ATTR
Attribute carrying the region's type (RegionDef.TYPE_ROW_DETAILand friends).- See Also:
-
REGION_POPULATE_ATTR
Attribute carrying the region's populator name:data-juneau-region-populate.This attribute is how the populator name reaches the runtime at all, so omitting it fails silently in the worst possible way.
juneau-regions.js'smintRegionreads the name withel.getAttribute("data-juneau-region-populate"); a container without it yieldsnull, which resolves to the default populator rather than to an error. So a page whose author registered a named populate would paint the framework default instead, with no console error, no error pane, and a rendered result that looks plausible — the author's populate simply never runs.Deliberately an attribute rather than a sidecar member, unlike most of a region's configuration. The name is needed to decide which function to call at mint time, before any per-host sidecar has been matched to this container; identity-and-dispatch data rides the element, and everything else rides the sidecar.
- See Also:
-
REGION_CONTRACT_ATTR
Attribute carryingRegionDef.CONTRACT_VERSIONon the region container (the per-host handshake stamp).- See Also:
-
REGION_CSRF_ATTR
Attribute carrying the enclosing response's CSRF token on a region host that is not a<table>— deliberatelyViewTable.CSRF_ATTR, the same attribute the view table already stamps, not a region-specific second name.A region that performs a write has no token source of its own: the existing stamp lives on the view
<table>, and a card-body or tab-body region is not beneath one. Rather than mint a second token or teach every populate to hunt for the table's, the host that emits a non-table region stamps the same per-response token it already holds.Reusing the existing attribute name is what makes this cost zero client change:
ctx.write(...)already resolves its token withel.closest("[data-juneau-csrf]"), so a region container carrying this attribute is found by the code that is already there. A region-specific name would have required teaching that resolver a second selector, and the two would then have been able to disagree.A row-detail region is beneath the view table and therefore does not carry this attribute: it inherits the table's by
closest(...), and a second stamp on the same subtree is the hazard rather than the fix for it.- See Also:
-
REGION_DECLARED_ATTR
Attribute carrying the region's own contract descriptor (itsparamsincluded) as JSON, for a region placed outside a sidecar-bearing host.Stamped by
of(RegionDef, String)only when the region declaresparams; the region runtime reads it as the placeholder's declared descriptor.- See Also:
-
REGION_META_ATTR
Attribute theid-lessdetailSidecar(List)form is found by.- See Also:
-
SIDECAR_ID_PREFIX
HTMLidprefix for thesidecar(String, List)form.- See Also:
-
REGION_CLASS
Theclasson every region container.- See Also:
-
-
Method Details
-
of
Emits one empty region container.In-table region HTML (
ViewTable's detail template). Page slots: author HTML plusJuneauViews.regions.mount({ id: populatorName }). Not@Deprecated.- Parameters:
region- The region. Must not benull .- Returns:
- An empty
<div class='juneau-region'>carrying identity, type and the handshake stamp.
-
of
Emits one empty region container, optionally carrying the non-table host's CSRF stamp.In-table region HTML (
ViewTable's detail template). Page slots: author HTML plusJuneauViews.regions.mount({ id: populatorName }). Not@Deprecated.- Parameters:
region- The region. Must not benull .csrfToken- The enclosing response's token for a non-table host, ornull to omit the stamp — which is the correct choice for a row-detail region, since it sits beneath the view table's own stamp and must not carry a second one.- Returns:
- An empty
<div class='juneau-region'>.
-
sidecar
Emits the per-host sidecar with a document-unique HTMLid.No in-table keeper in this module's production emit path; leftover page-slot callers migrate to
JuneauViews.regions.mount. Not@Deprecated.- Parameters:
hostId- The host's own id (a page id, a card-grid id); the sidecar'sidisSIDECAR_ID_PREFIX+ this. Must not benull or blank.regions- Every region this host declares, in emit order. Must not benull or empty.- Returns:
- The
<script type='application/json'>sidecar.
-
detailSidecar
Emits theid-less, attribute-found sidecar for a host whose subtree is cloned per row.See this class's Javadoc: a row-detail sidecar lives inside the cloned
<template data-juneau-row-detail>, so a stampedidwould collide across every open panel.In-table region HTML (
ViewTable's detail template). Not@Deprecated.- Parameters:
regions- Every region this host declares, in emit order. Must not benull or empty.- Returns:
- The
<script type='application/json'>sidecar, carryingREGION_META_ATTR.
-
buildMeta
Builds the sidecar envelope: the contract version once, then one descriptor per region in emit order.- Parameters:
regions- The regions, in emit order. Must not benull or empty.- Returns:
- An ordered
Mapready forJson.of(...).
-