Interface ActionContext
- All Known Implementing Classes:
ActionContextImpl
public interface ActionContext
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceHandle returned byenter(ActionContext).static final classKeeps the thread-local itself off the public surface; mutate it only throughenter(ActionContext). -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<ActionContext> current()The action whose script is running on the calling thread, or empty on a thread that is not inside one.static ActionContext.Bindingenter(ActionContext context) Bindscontextto the calling thread for the duration of a script action's invocation.
-
Method Details
-
getEventGroup
String getEventGroup() -
getEventName
String getEventName() -
getComponent
PerspectiveElement getComponent() -
getConfig
ActionConfig getConfig() -
current
The action whose script is running on the calling thread, or empty on a thread that is not inside one. Lets code a script reaches tell which event is driving it: aComponentModelDelegate's@ScriptCallablemethod otherwise cannot distinguish a call made from an event handler from one made anywhere else.Still reports the action across a nested invocation the script makes — a component custom method, a project library function — since only
enter(ActionContext)touches the binding. -
enter
Bindscontextto the calling thread for the duration of a script action's invocation. Framework use; close the returned handle in a finally or try-with-resources.Restores the previous binding rather than clearing it, so an action invoked from inside another one does not erase its caller on the way out.
-