Package com.onec.ui

Record Class ActionSpec.Action

java.lang.Object
java.lang.Record
com.onec.ui.ActionSpec.Action
Enclosing class:
ActionSpec

public static record ActionSpec.Action(String key, String label, String icon, String logo, ActionScope scope, String navigateUrl, Function<ActionContext,ActionResult> handler, Function<ActionRow,String> iconFn, Function<ActionRow,String> labelFn, Predicate<ActionRow> visibleFn, Predicate<ActionRow> enabledFn) extends Record
A resolved action button. Exactly one of navigateUrl / handler is set.

icon/label are the fixed values (and the fallback). logo is an optional image URL/path shown in place of the lucide icon — a brand mark ("Connect with X"), rendered on page-action and list/row/toolbar buttons. iconFn, labelFn, visibleFn and enabledFn are the optional per-row overrides for a ActionScope.ROW action — any that are non-null are evaluated against each ActionRow when the list renders.

  • Constructor Details

    • Action

      public Action(String key, String label, String icon, String logo, ActionScope scope, String navigateUrl, Function<ActionContext,ActionResult> handler, Function<ActionRow,String> iconFn, Function<ActionRow,String> labelFn, Predicate<ActionRow> visibleFn, Predicate<ActionRow> enabledFn)
      Creates an instance of a Action record class.
      Parameters:
      key - the value for the key record component
      label - the value for the label record component
      icon - the value for the icon record component
      logo - the value for the logo record component
      scope - the value for the scope record component
      navigateUrl - the value for the navigateUrl record component
      handler - the value for the handler record component
      iconFn - the value for the iconFn record component
      labelFn - the value for the labelFn record component
      visibleFn - the value for the visibleFn record component
      enabledFn - the value for the enabledFn record component
  • Method Details

    • isServer

      public boolean isServer()
    • isDynamic

      public boolean isDynamic()
      Whether any aspect of this action varies per row (so the list must resolve it per row).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • label

      public String label()
      Returns the value of the label record component.
      Returns:
      the value of the label record component
    • icon

      public String icon()
      Returns the value of the icon record component.
      Returns:
      the value of the icon record component
    • logo

      public String logo()
      Returns the value of the logo record component.
      Returns:
      the value of the logo record component
    • scope

      public ActionScope scope()
      Returns the value of the scope record component.
      Returns:
      the value of the scope record component
    • handler

      public Function<ActionContext,ActionResult> handler()
      Returns the value of the handler record component.
      Returns:
      the value of the handler record component
    • iconFn

      public Function<ActionRow,String> iconFn()
      Returns the value of the iconFn record component.
      Returns:
      the value of the iconFn record component
    • labelFn

      public Function<ActionRow,String> labelFn()
      Returns the value of the labelFn record component.
      Returns:
      the value of the labelFn record component
    • visibleFn

      public Predicate<ActionRow> visibleFn()
      Returns the value of the visibleFn record component.
      Returns:
      the value of the visibleFn record component
    • enabledFn

      public Predicate<ActionRow> enabledFn()
      Returns the value of the enabledFn record component.
      Returns:
      the value of the enabledFn record component