Package su.onno.ui
Class ActionRow
java.lang.Object
su.onno.ui.ActionRow
A read-only view of one record's resolved data — a list row, or the record a detail surface
loaded — handed to the per-record functions of an
action
(.icon(...), .label(...), .visibleWhen(...), .enabledWhen(...))
and to a list's conditional row formatting, so a single control can
vary by that record's state — a pause "Suspend" on a running record flipping to a
play "Resume" when it's stopped, or a button shown only on the rows it applies to.
It wraps the resolved row the list already computed (the same shape the grid renders), so no
extra query runs: raw attribute values plus the resolved _display strings refs and enums
carry. Read a field with text(String) (the human/display value — for an enum this is the
@EnumLabel value when labelled, else the constant name), enumValue(String, Class)
(typed back to your enum), or get(String) (the raw stored value). All lookups are
case-insensitive.
a.action("toggle").scope(ActionScope.ROW)
.icon(row -> row.enumValue("status", Status.class) == Status.STOPPED ? "play" : "pause")
.label(row -> row.enumValue("status", Status.class) == Status.STOPPED ? "Resume" : "Suspend")
.handler(ctx -> ...);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe column read as a boolean:truefor aBoolean.TRUE, the strings"true"/"t"/"1"(case-insensitive, how H2/Postgres booleans read back through the resolved row), or a non-zero number;falseotherwise (including absent).<E> booleanRead a boolean using a compiler-checked field reference.<E extends Enum<E>>
Ecolumnresolved back to a constant ofenumType, ornullif empty/unmatched.<T,E extends Enum<E>>
EResolve an enum using a compiler-checked field reference.The raw stored value ofcolumn(a ref/enum reads back as its UUID), ornull.<E,V> Object Read a raw value using a compiler-checked field reference.id()This row's id (_id), ornullif absent/unparseable.The display string ofcolumn: the resolved{column}_display(a ref's label, an enum's constant name) when present, else the raw value as text, else""— never null.<E,V> String Read display text using a compiler-checked field reference.values()The underlying row map (resolved values keyed by column) — an escape hatch for ad-hoc reads.
-
Constructor Details
-
ActionRow
-
-
Method Details
-
id
This row's id (_id), ornullif absent/unparseable. -
get
The raw stored value ofcolumn(a ref/enum reads back as its UUID), ornull. -
get
Read a raw value using a compiler-checked field reference. -
bool
The column read as a boolean:truefor aBoolean.TRUE, the strings"true"/"t"/"1"(case-insensitive, how H2/Postgres booleans read back through the resolved row), or a non-zero number;falseotherwise (including absent). -
bool
Read a boolean using a compiler-checked field reference. -
text
The display string ofcolumn: the resolved{column}_display(a ref's label, an enum's constant name) when present, else the raw value as text, else""— never null. -
text
Read display text using a compiler-checked field reference. -
enumValue
columnresolved back to a constant ofenumType, ornullif empty/unmatched. Enum fields are stored as deterministic UUIDs; display labels and legacy constant-name strings are deliberately not accepted as storage identities. -
enumValue
Resolve an enum using a compiler-checked field reference. -
values
The underlying row map (resolved values keyed by column) — an escape hatch for ad-hoc reads.
-