Package su.onno.ui

Class UiActionResolver

java.lang.Object
su.onno.ui.UiActionResolver

public class UiActionResolver extends Object
Collects the custom actions and toolbar inputs declared by every EntityView, indexed by entity class. Actions resolve two ways: as descriptor maps the list/detail surfaces emit (so the client renders the buttons), and by key for the ActionController to execute. Inputs resolve as descriptor maps the list toolbar renders.
  • Constructor Details

  • Method Details

    • forEntity

      public List<ActionSpec.Action> forEntity(Class<?> entity)
    • resolvedForEntity

      public List<ActionSpec.Action> resolvedForEntity(Class<?> entity)
      Static and late-bound actions in authored order, with the same first-view/key-wins merge as startup declarations. Static-only entities return the cached list without re-running view code or allocating a new collection.
    • hasDynamicActions

      public boolean hasDynamicActions(Class<?> entity)
      Whether the entity declares any provider that must be evaluated at menu/action time.
    • find

      public ActionSpec.Action find(Class<?> entity, String key)
      The action whose key matches, or null.
    • hasDynamicRowActions

      public boolean hasDynamicRowActions(Class<?> entity)
      Whether any row action of entity varies per row — the cheap guard the list-data feed checks before decorating rows. Late-bound providers are deliberately excluded: their state is resolved once for the clicked row by the menu endpoint, not once per row in the list feed. When false (the common case), rows ship untouched.
    • rowActionState

      public Map<String,Object> rowActionState(Class<?> entity, Map<String,Object> row)
      Per-row state for the entity's dynamic row actions, keyed by action key — what the list feed attaches to each row (under _actions) so the client can render that row's button with the right icon/label and honour its visibility/enabled state. Only dynamic row actions appear; static ones render from the descriptor unchanged. A function that throws is treated as a no-op (the descriptor value / visible+enabled) so one bad predicate can't break the list.
    • rowActionState

      public Map<String,Object> rowActionState(List<ActionSpec.Action> actions, Map<String,Object> row)
      Resolve per-row state from an already resolved action snapshot (one live-provider evaluation).
    • recordActionState

      public static UiActionResolver.RecordActionState recordActionState(ActionSpec.Action a, Map<String,Object> record)
      Evaluate a's per-record functions against a loaded record (see UiActionResolver.RecordActionState).
    • inputsForEntity

      public List<InputSpec.InputField> inputsForEntity(Class<?> entity)
    • inputDescriptors

      public List<Map<String,Object>> inputDescriptors(Class<?> entity)
      Descriptor maps for the toolbar inputs — what the list surface emits for the client to render.
    • inputFieldMap

      public static Map<String,Object> inputFieldMap(InputSpec.InputField in)
      One input field's descriptor map — shared by the toolbar inputs and an action's form fields.
    • formDescriptors

      public static List<Map<String,Object>> formDescriptors(ActionSpec.Action a)
      An action's form-item descriptor maps (ActionSpec.ActionBuilder.form), empty when none. Scalar fields come first (tagged kind: "field"), then the repeatable row groups (kind: "group", carrying their columns); the client renders each accordingly.
    • formDialogDescriptor

      public static Map<String,Object> formDialogDescriptor(ActionSpec.Action a)
      Optional presentation metadata for an action form's canonical dialog shell.
    • descriptors

      public List<Map<String,Object>> descriptors(Class<?> entity, Set<ActionScope> scopes)
      Descriptor maps for actions in the given scopes — what the list/detail surfaces emit.
    • resolvedDescriptors

      public List<Map<String,Object>> resolvedDescriptors(Class<?> entity, Set<ActionScope> scopes)
      Current descriptor maps including late-bound providers. Called by the dynamic menu endpoint; static list surfaces continue to use descriptors(Class, Set) at zero extra cost.
    • descriptors

      public static List<Map<String,Object>> descriptors(List<ActionSpec.Action> actions, Set<ActionScope> scopes)
      Descriptor maps for an already resolved action snapshot.