ActionContext

data class ActionContext<T>(val sourceValue: T?, val sourceControlContext: ControlContext, val formState: FormState, val formSchema: FormSchema, val errorManager: ErrorManager, val trigger: FormActionTrigger, val coroutineScope: CoroutineScope, val payload: Any? = null)

Context given to a ControlAction, with access to the form state and tools.

Type Parameters

T

type of the value of the control that triggered the action.

Constructors

Link copied to clipboard
constructor(sourceValue: T?, sourceControlContext: ControlContext, formState: FormState, formSchema: FormSchema, errorManager: ErrorManager, trigger: FormActionTrigger, coroutineScope: CoroutineScope, payload: Any? = null)

Properties

Link copied to clipboard
val coroutineScope: CoroutineScope

Scope for launching asynchronous operations (e.g. API calls).

Link copied to clipboard

Access to the error manager.

Link copied to clipboard

Access to the form schema.

Link copied to clipboard

Access to the global form state.

Link copied to clipboard
val payload: Any?
Link copied to clipboard

Context of the control that triggered the action.

Link copied to clipboard

New value of the control that triggered the action.

Link copied to clipboard

Functions

Link copied to clipboard
private fun controlAt(statePath: String): Control<*>
Link copied to clipboard
fun <V : Any> readControl(controlPath: String): V?

Reads the current value of the control at a relative (./, ../) or absolute path.

Link copied to clipboard
private fun resolvedPath(controlPath: String): String
Link copied to clipboard
private fun <V : Any> setValue(controlPath: String, statePath: String, newValue: V?)
Link copied to clipboard
private fun stateAt(statePath: String): ControlState<*>
Link copied to clipboard
fun <V : Any> updateControl(controlPath: String, newValue: V?)

Updates the value of a control at a relative (./, ../) or absolute path. A value the control does not accept (Control.acceptsValue) throws.

Link copied to clipboard
fun <V : Any> updateControls(controlPath: String, newValue: V?)

Updates the values of all controls matching a pattern (e.g. with a * wildcard). The pattern may match nothing - a list of rows can be empty. A path without a wildcard works like updateControl, so without a control it throws.

Link copied to clipboard
fun updateLabel(controlPath: String, newLabel: String?)

Updates the control's label (overrides the default one).