public abstract class InteractiveCommand extends DynamicCommand implements Interactive, Previewable, Logged
It is Interactive
and Previewable
, with the previews used for
interactive exploration.
Further, this class provides added convenience for keeping certain input
parameters synced with active Display
s. It listens for
DisplayActivatedEvent
s, updating the inputs specified in the
constructor when such events occur. Individual interactive commands can then
add callback methods to affected inputs, for reacting to a change in the
active display.
moduleService, pluginService
Constructor and Description |
---|
InteractiveCommand(String... listenerNames)
Creates a new interactive command.
|
Modifier and Type | Method and Description |
---|---|
protected <T> ModuleItem<T> |
asType(ModuleItem<?> item,
Class<T> type) |
void |
cancel()
Performs necessary cleanup in response to cancellation of the module
execution.
|
LogService |
log()
Gets the
LogService to use when logging activities. |
protected void |
onEvent(DisplayActivatedEvent evt) |
void |
preview()
Computes a preview of the module's execution results, if available.
|
protected <T> void |
update(ModuleItem<T> item,
T newValue) |
protected void |
updateInput(ModuleItem<?> item) |
cancel, context, getCancelReason, getContext, getInfo, getInput, getOutput, isCanceled, saveInputs, setContext, setInput, setOutput, uncancel
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, resolveInput, resolveOutput, setInputs, setOutputs, unresolveInput, unresolveOutput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addInput, addInput, addOutput, addOutput, removeInput, removeOutput, run
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, isResolved, resolveInput, resolveOutput, setInputs, setOutputs, setResolved, unresolveInput, unresolveOutput
public void preview()
Module
Runnable.run()
. Not all modules support
previews.preview
in interface Previewable
preview
in interface Module
preview
in class AbstractModule
ModuleInfo.canPreview()
public void cancel()
Module
Module.preview()
to undo
any changes made as a result of the preview.cancel
in interface Previewable
cancel
in interface Module
cancel
in class AbstractModule
ModuleInfo.canCancel()
public LogService log()
Logged
LogService
to use when logging activities.protected void updateInput(ModuleItem<?> item)
protected <T> ModuleItem<T> asType(ModuleItem<?> item, Class<T> type)
protected <T> void update(ModuleItem<T> item, T newValue)
protected void onEvent(DisplayActivatedEvent evt)
Copyright © 2015–2022 SciJava. All rights reserved.