Package su.onno.ui

Class ActionRow

java.lang.Object
su.onno.ui.ActionRow

public final class ActionRow extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    bool(String column)
    The column read as a boolean: true for a Boolean.TRUE, the strings "true"/"t"/"1" (case-insensitive, how H2/Postgres booleans read back through the resolved row), or a non-zero number; false otherwise (including absent).
    <E> boolean
    bool(Field<E,Boolean> field)
    Read a boolean using a compiler-checked field reference.
    <E extends Enum<E>>
    E
    enumValue(String column, Class<E> enumType)
    column resolved back to a constant of enumType, or null if empty/unmatched.
    <T, E extends Enum<E>>
    E
    enumValue(Field<T,E> field, Class<E> enumType)
    Resolve an enum using a compiler-checked field reference.
    get(String column)
    The raw stored value of column (a ref/enum reads back as its UUID), or null.
    <E, V> Object
    get(Field<E,V> field)
    Read a raw value using a compiler-checked field reference.
    id()
    This row's id (_id), or null if absent/unparseable.
    text(String column)
    The display string of column: 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
    text(Field<E,V> field)
    Read display text using a compiler-checked field reference.
    The underlying row map (resolved values keyed by column) — an escape hatch for ad-hoc reads.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • id

      public UUID id()
      This row's id (_id), or null if absent/unparseable.
    • get

      public Object get(String column)
      The raw stored value of column (a ref/enum reads back as its UUID), or null.
    • get

      public <E, V> Object get(Field<E,V> field)
      Read a raw value using a compiler-checked field reference.
    • bool

      public boolean bool(String column)
      The column read as a boolean: true for a Boolean.TRUE, the strings "true"/"t"/"1" (case-insensitive, how H2/Postgres booleans read back through the resolved row), or a non-zero number; false otherwise (including absent).
    • bool

      public <E> boolean bool(Field<E,Boolean> field)
      Read a boolean using a compiler-checked field reference.
    • text

      public String text(String column)
      The display string of column: 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

      public <E, V> String text(Field<E,V> field)
      Read display text using a compiler-checked field reference.
    • enumValue

      public <E extends Enum<E>> E enumValue(String column, Class<E> enumType)
      column resolved back to a constant of enumType, or null if empty/unmatched. Enum fields are stored as deterministic UUIDs; display labels and legacy constant-name strings are deliberately not accepted as storage identities.
    • enumValue

      public <T, E extends Enum<E>> E enumValue(Field<T,E> field, Class<E> enumType)
      Resolve an enum using a compiler-checked field reference.
    • values

      public Map<String,Object> values()
      The underlying row map (resolved values keyed by column) — an escape hatch for ad-hoc reads.