Class ListSpec<E>
EntityView.list(su.onno.ui.ListSpec<E>).
With no calls the list shows the auto-generated columns (built-in system
columns + visible custom fields, in their configured order). Call
columns(java.lang.String...) to take explicit control of which columns appear and in what
order, or hide(java.lang.String...)/label(java.lang.String, java.lang.String) to tweak the defaults. Field names are
the entity's Java field names (e.g. "displayName"); "code",
"description" (catalogs) and "number", "date",
"posted" (documents) address the built-in system columns.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumA per-group subtotal function (row count is always present and needs no declaration).static final recordA declared per-group subtotal: the aggregatefnover a numericfield.static final classA custom list-body renderer: the widget-registryListSpec.CustomSpec.typethe client resolves the component from, an optional toolbar-toggleListSpec.CustomSpec.label(else the UI'slist.customViewmessage), and whether the list opens on the custom view.static final recordA resolved list filter: the bound field, its label, the control type and — for theListSpec.FilterType.OPTIONS/ListSpec.FilterType.MULTI_OPTIONScontrols — itschoices(each a value→label pair).static final classFluent builder for one filter;ListSpec.FilterBuilder.options/ListSpec.FilterBuilder.multiple()/ListSpec.FilterBuilder.multiOptions(java.lang.String...)/ListSpec.FilterBuilder.contains()/ListSpec.FilterBuilder.startsWith()/ListSpec.FilterBuilder.dateRange()pick the control type.static enumHow a filter narrows the list query (and which control the grid renders).static final classWhere a list's map geometry comes from, and how it reads.static final recordOne choice of aListSpec.FilterType.OPTIONS/ListSpec.FilterType.MULTI_OPTIONSfilter: thevaluematched against the field by the query, and thelabelthe UI renders for it.static enumA conditional row tint (seerowStyle(java.util.function.Function<su.onno.ui.ActionRow, su.onno.ui.ListSpec.RowStyle>)): a semantic tone the client maps to its theme (a translucent background wash over the row), not a raw color — so the same view reads correctly in light and dark themes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaggregate(String field, ListSpec.Agg fn) Declare a per-group subtotal shown on each group header (and rolled up as a grand total): an aggregatefnover a numericfield.aggregate(String field, ListSpec.Agg fn, String label) Asaggregate(String, Agg)with an explicit header label (else the field name).aggregate(Field<E, N> field, ListSpec.Agg fn) Add an aggregate over a compiler-checked numeric field.aggregate(Field<E, N> field, ListSpec.Agg fn, String label) Add a labelled aggregate over a compiler-checked numeric field.The declared per-group subtotals, in declaration order.Attach a declared row-action submenu to a column's cells: right-clicking the cell (e.g.Attach a cell menu to a compiler-checked field.Add an explicit column with a custom header label.Add a compiler-checked column with a custom label.Take explicit control: only these fields, in this order.Take explicit control with compiler-checked getter references.Delegate the list's body to a custom renderer registered in the UI's widget registry (a consumer plugin'sregisterListRenderer("type", Component)via@onno/widget-sdk) — tiles, cards, a gallery, whatever the component draws.The custom-renderer spec, or null whencustomwas never called (default grid only).The field the list opens grouped by, ornullwhen it opens flat (the default).defaultGroupBy(String field) Open the list already grouped byfieldinstead of flat.defaultGroupBy(Field<E, V> field) Open grouped by a compiler-checked field.booleanexplicit()Declare a user-facing filter control bound tofield(an entity field name, like the column/sort field names).Declare a filter bound to a compiler-checked field.filters()The declared list filters, in declaration order.The fields offered in the group-by picker, in declaration order (empty = no grouping).Declare compiler-checked grouping fields.hidden()Hide fields from the default column set (ignored whencolumns(java.lang.String...)is used).Hide compiler-checked fields from the default set.include()Override a column's header label.Override a compiler-checked column's label.labels()map()Enable a map view for this list: a Table ⇄ Map toggle in the toolbar that plots the records as markers over OpenStreetMap tiles.mapSpec()The map view spec, or null whenmap()was never called (no map view).noSearch()Turn the search bar off for this list.intpageSize()The authored page size, or0to inherit the globalonno.ui.list.page-size.pageSize(int pageSize) Rows fetched per keyset window.rowStyle(Function<ActionRow, ListSpec.RowStyle> style) Conditional row formatting: tint a row by its data.The conditional row-formatting function, ornullwhenrowStyle(java.util.function.Function<su.onno.ui.ActionRow, su.onno.ui.ListSpec.RowStyle>)wasn't called.booleansearchable(boolean searchable) Whether the list shows a search bar (server-side filter across text columns).The column the list is sorted by initially (a field name); ascending.The initial sort column + direction.Compiler-checked initial sort field.Compiler-checked initial sort field and direction.booleantitle()
-
Constructor Details
-
ListSpec
public ListSpec()
-
-
Method Details
-
title
-
searchable
Whether the list shows a search bar (server-side filter across text columns). Default on. -
noSearch
Turn the search bar off for this list. -
sortBy
The column the list is sorted by initially (a field name); ascending. -
sortBy
The initial sort column + direction. -
sortBy
Compiler-checked initial sort field. -
sortBy
Compiler-checked initial sort field and direction. -
columns
Take explicit control: only these fields, in this order. -
columns
Take explicit control with compiler-checked getter references. -
column
Add an explicit column with a custom header label. -
column
Add a compiler-checked column with a custom label. -
label
Override a column's header label. -
label
Override a compiler-checked column's label. -
hide
Hide fields from the default column set (ignored whencolumns(java.lang.String...)is used). -
hide
Hide compiler-checked fields from the default set. -
filter
Declare a user-facing filter control bound tofield(an entity field name, like the column/sort field names). Unlike a toolbarinput— which feeds action handlers — a filter drives the list query itself: its value narrows the rows the grid shows. Returns aListSpec.FilterBuilder; pick the control withListSpec.FilterBuilder.options(a SELECT matched for equality),ListSpec.FilterBuilder.multiple()orListSpec.FilterBuilder.multiOptions(java.lang.String...)(a multi-select matched asfield IN (…)),ListSpec.FilterBuilder.contains()/ListSpec.FilterBuilder.startsWith()(a field-scoped typeahead for high-cardinality fields, matched case-insensitively asLIKE), orListSpec.FilterBuilder.dateRange()(from/to pickers, afield >= from AND field <= torange).When several filters are declared they combine with
AND: each contributes its ownWHEREfragment and the row must satisfy all of them. AmultiOptionsfilter is internally anOR/INover its picked values, but across different filters the combination is alwaysAND. A filter whose control is left empty (no selection, blank text) contributes no constraint, and a filter on a field the entity no longer has degrades to "no constraint" rather than failing the list.An
@Enumeration-typed field persists as deterministic UUIDs, so the UI resolver translates a select filter's options for it: author each option as the constant name ("SHIPPED") or its@EnumLabeltext, or author no options (.multiOptions()) to offer every declared value, labelled like the entity's pills.list.filter("season").options("2024", "2025", "2026"); // SELECT -> season = value list.filter("city").options("Madrid", "Paris").multiple(); // multi-select -> city IN (…) list.filter("doctorName").label("Doctor").contains(); // typeahead -> doctor_name ILIKE %v% list.filter("role").multiOptions("Хирург", "Терапевт"); // multi-select -> role IN (…) list.filter("checkIn").dateRange(); // from/to pickers -> checkIn range // value→label split: the query matches the stored value, the dropdown shows the label var statuses = new LinkedHashMap<String, String>(); // ordered: dropdown follows it statuses.put("NEW", "Новый"); statuses.put("FILES_RECEIVED", "Файлы получены"); list.filter("statusName").label("Статус").multiOptions(statuses); -
filter
Declare a filter bound to a compiler-checked field. -
map
Enable a map view for this list: a Table ⇄ Map toggle in the toolbar that plots the records as markers over OpenStreetMap tiles. Returns aListSpec.MapSpec; tell it where each record's geometry comes from — a numeric latitude/longitude pair viaListSpec.MapSpec.lat(java.lang.String)/ListSpec.MapSpec.lng(java.lang.String), a GeoJSON field viaListSpec.MapSpec.geoJson(java.lang.String), or both — and optionally aListSpec.MapSpec.label(java.lang.String)field for the marker popup andListSpec.MapSpec.defaultViewto open on the map. Field names are entity field names, like the column/sort/filter ones.Calling
map()more than once returns the same spec (so chained calls accumulate). A map whose geo field(s) don't resolve to real columns degrades to "no map view" rather than failing the list.list.map().lat("latitude").lng("longitude"); // split numeric fields list.map().geoJson("location").defaultView(); // GeoJSON; open on the map -
custom
Delegate the list's body to a custom renderer registered in the UI's widget registry (a consumer plugin'sregisterListRenderer("type", Component)via@onno/widget-sdk) — tiles, cards, a gallery, whatever the component draws. The framework keeps owning the chrome: search, declarative filters, sorting, the keyset feed, live refresh and the toolbar all still work and drive the rows the renderer receives. Returns aListSpec.CustomSpec; optionally set the toggleListSpec.CustomSpec.labelandListSpec.CustomSpec.defaultViewto open on the custom view (a Table ⇄ custom toggle appears in the toolbar, likemap()).Calling
custom(type)again replaces the type but keeps the same spec (so chained calls accumulate, mirroringmap()). A type with no registered renderer on the client degrades to the default grid rather than failing the list — same philosophy as amap()whose geo fields don't resolve.list.custom("bookTiles"); // Table ⇄ custom toggle list.custom("bookTiles").label("Shelf").defaultView(); // open on the tiles, labelled "Shelf" -
pageSize
Rows fetched per keyset window. Left unset (or<= 0) the list inherits the global default (onno.ui.list.page-size, itself50). Clamped to the server's list ceiling. -
cellMenu
Attach a declared row-action submenu to a column's cells: right-clicking the cell (e.g. a status pill) opens JUST that submenu's entries as a flat menu at the cursor — one click to the choices, instead of row-menu → submenu. The label must match a.menu("…")used by this view's ROW actions; per-row visibility/labels/colors apply exactly as in the row menu. Anywhere else on the row keeps the full context menu.list.cellMenu("status", "Change status"); // right-click the pill → the status choices -
cellMenu
Attach a cell menu to a compiler-checked field. -
cellMenus
-
groupable
-
groupable
Declare compiler-checked grouping fields. -
defaultGroupBy
Open the list already grouped byfieldinstead of flat. The field must also be declaredgroupable— it names one of the picker's choices, and the viewer can still switch to another grouping or back to "None". A default that isn't among the groupable columns (or doesn't resolve to a real column) is ignored with a warning rather than failing the list.list.groupable("status", "warehouse").defaultGroupBy("status"); // opens grouped by status -
defaultGroupBy
Open grouped by a compiler-checked field. -
aggregate
Declare a per-group subtotal shown on each group header (and rolled up as a grand total): an aggregatefnover a numericfield. Only meaningful alongsidegroupable; every group always carries its row count regardless. The subtotal is formatted with the field's own.format(...)hint, so a money column reads as money.list.groupable("status").aggregate("total", Agg.SUM); // Σ total per status list.groupable("region").aggregate("amount", Agg.AVG, "Avg"); // labelled average per region -
aggregate
Asaggregate(String, Agg)with an explicit header label (else the field name). -
aggregate
Add an aggregate over a compiler-checked numeric field. -
aggregate
Add a labelled aggregate over a compiler-checked numeric field. -
rowStyle
Conditional row formatting: tint a row by its data. The function is evaluated per row on the server as the list feeds (sameActionRowaccessor the state-awarerow actionsuse) and returns theListSpec.RowStyleto apply — ornullfor the default look. A function that throws is treated asnullfor that row, so one bad predicate can't break the list.// urgent orders read red, delivered ones green list.rowStyle(row -> row.bool("urgent") ? RowStyle.DANGER : row.enumValue("status", Status.class) == Status.DELIVERED ? RowStyle.SUCCESS : null); -
title
-
include
-
labels
-
explicit
public boolean explicit() -
searchable
public boolean searchable() -
sortField
-
sortDescending
public boolean sortDescending() -
pageSize
public int pageSize()The authored page size, or0to inherit the globalonno.ui.list.page-size. -
groupable
The fields offered in the group-by picker, in declaration order (empty = no grouping). -
defaultGroupBy
The field the list opens grouped by, ornullwhen it opens flat (the default). -
aggregates
The declared per-group subtotals, in declaration order. -
rowStyleFn
The conditional row-formatting function, ornullwhenrowStyle(java.util.function.Function<su.onno.ui.ActionRow, su.onno.ui.ListSpec.RowStyle>)wasn't called. -
filters
The declared list filters, in declaration order. -
mapSpec
The map view spec, or null whenmap()was never called (no map view). -
customSpec
The custom-renderer spec, or null whencustomwas never called (default grid only).
-