Package org.apache.juneau.console.views


package org.apache.juneau.console.views
A typed, declarative "rich DataTables view" toolkit that serializes to the frozen VIEW_META JSON wire contract consumed by the first-party client runtime.

This optional module builds on juneau-console-datatables (the server-side query protocol). Table authoring now lives in FTL <@card type="datatables"> catalogs; this module keeps the VIEW_META JSON contract constants (ViewsMixin, ViewTable), region mounting (RegionDef, RegionTable), bulk-mutate / row-action types, and the first-party juneau-views.js/juneau-ribbon.js/juneau-renders.js runtime.

The module owns a dependency-free base .tag chip stylesheet and takes no hard dependency on juneau-console: the base chip keeps client-rendered views legible standalone, while console-ui's palette themes the shared .tag.<domain>.<value> class-name contract when present.

Alongside the DataTables view it also hosts the reusable calendar widget. A page mounts an empty data-juneau-calendar marker; the shipped juneau-calendar.js/juneau-calendar.css runtime hydrates it, and the month layout (grid, spanning-bar lanes, chip order, "+N more") is computed client-side by juneau-calendar.js. The CalendarDef bean itself lives in juneau-console-widgets (bean-only, no dependency on views); views composes it here.

Complex dialogs and nested popups (v1):

A RowAction whose presentation is DIALOG opens a declarative popup dialog described by ModalDef. The dialog may carry a FormDef whose FormDef.Input controls are the seven-type vocabulary — text, textarea, password (masked, write-only, never pre-filled), checkbox, toggle (a role=switch), select (single-select), and action (a button holding an ActionRef that opens a further dialog for a named row action, the composition trigger). Typed inputs are always painted from the model with createElement + .value / .checked / textContent — never as markup — so a live-data or hostile field value can never become an element. The client adds advisory inline validation (required, maxLength, pattern) that blocks the confirm while the server submit stays fully authoritative; a pattern that a browser regex engine rejects fails open rather than blocking a legitimate submit.

At runtime, dialogs, cell popovers, and row-action menus share a single popup layer stack that owns focus trapping, Escape-dismiss of the top layer, focus restore on close, and z-ordering. Cell-anchored surfaces are portalled to document.body as position:fixed so an overflow ancestor cannot clip them; the page-size chooser stays position:absolute. The v1 stack caps dialog-kind layers at two: a third dialog is a visible refusal painted into the current top dialog rather than an unbounded stack.

Both beans implements Widget: each declares a CONTRACT_VERSION and a validate() invariant check, and each guarantees the instance version is present from construction, confirm-only or form-bearing alike — independent of whether the serving path calls checked(). When a form is present the client enforces a fail-loud handshake — BOTH the modal and the nested form version must match the runtime's baked-in version or the dialog refuses to open; a confirm-only dialog (no form) is never version-gated, even though it now carries the same version.

Relocated: the dialog beans now live in the widgets module

ModalDef and FormDef were general enough to belong to the shared widget vocabulary, so they have moved from this package to org.apache.juneau.console.widgets. This is a breaking package relocation with no shim: a deprecated forwarding class left behind here would re-create the views→widgets dependency in reverse, so applications update their imports instead. Only the dialog beans moved — the table/row-action types they are used with (RowAction, IdempotencyKey, ActionResult, WritePermit) stay here. The dialog/form runtime also stays here, inside juneau-views.js: after the move a widgets-module bean is driven by a views-module script, which is deliberate rather than accidental (splitting that monolith is a separate concern).

Follow-ons (not in this cut):

  • A second in-tree dialog-form consumer is a 10.0-destination follow-on.
  • Richer controls (cron editor, rich text) are deferred.

See Also:

Since:
10.0.0