Package org.scijava.command
Class InteractiveCommand
- java.lang.Object
-
- org.scijava.module.AbstractModule
-
- org.scijava.module.DefaultMutableModule
-
- org.scijava.command.DynamicCommand
-
- org.scijava.command.InteractiveCommand
-
- All Implemented Interfaces:
Runnable,Cancelable,Command,Interactive,Previewable,Contextual,Logged,Module,MutableModule,SciJavaPlugin
public abstract class InteractiveCommand extends DynamicCommand implements Interactive, Previewable, Logged
A command intended to be run interactively.It is
InteractiveandPreviewable, with the previews used for interactive exploration.Further, this class provides added convenience for keeping certain input parameters synced with active
Displays. It listens forDisplayActivatedEvents, 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.- Author:
- Curtis Rueden
-
-
Field Summary
-
Fields inherited from class org.scijava.command.DynamicCommand
moduleService, pluginService
-
-
Constructor Summary
Constructors Constructor Description InteractiveCommand(String... listenerNames)Creates a new interactive command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> ModuleItem<T>asType(ModuleItem<?> item, Class<T> type)voidcancel()Performs necessary cleanup in response to cancellation of the module execution.LogServicelog()Gets theLogServiceto use when logging activities.protected voidonEvent(DisplayActivatedEvent evt)voidpreview()Computes a preview of the module's execution results, if available.protected <T> voidupdate(ModuleItem<T> item, T newValue)protected voidupdateInput(ModuleItem<?> item)-
Methods inherited from class org.scijava.command.DynamicCommand
cancel, context, getCancelReason, getContext, getInfo, getInput, getOutput, isCanceled, saveInputs, setContext, setInput, setOutput, uncancel
-
Methods inherited from class org.scijava.module.AbstractModule
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, resolveInput, resolveOutput, setInputs, setOutputs, unresolveInput, unresolveOutput
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.scijava.module.Module
getDelegateObject, getInputs, getOutputs, initialize, isInputResolved, isOutputResolved, isResolved, resolveInput, resolveOutput, setInputs, setOutputs, setResolved, unresolveInput, unresolveOutput
-
Methods inherited from interface org.scijava.module.MutableModule
addInput, addInput, addOutput, addOutput, removeInput, removeOutput, run
-
-
-
-
Method Detail
-
preview
public void preview()
Description copied from interface:ModuleComputes a preview of the module's execution results, if available. A preview is a quick approximation of the results that would be obtained by actually executing the module withRunnable.run(). Not all modules support previews.- Specified by:
previewin interfaceModule- Specified by:
previewin interfacePreviewable- Overrides:
previewin classAbstractModule- See Also:
ModuleInfo.canPreview()
-
cancel
public void cancel()
Description copied from interface:ModulePerforms necessary cleanup in response to cancellation of the module execution. This is useful in conjunction withModule.preview()to undo any changes made as a result of the preview.- Specified by:
cancelin interfaceModule- Specified by:
cancelin interfacePreviewable- Overrides:
cancelin classAbstractModule- See Also:
ModuleInfo.canCancel()
-
log
public LogService log()
Description copied from interface:LoggedGets theLogServiceto use when logging activities.
-
updateInput
protected void updateInput(ModuleItem<?> item)
-
asType
protected <T> ModuleItem<T> asType(ModuleItem<?> item, Class<T> type)
-
update
protected <T> void update(ModuleItem<T> item, T newValue)
-
onEvent
protected void onEvent(DisplayActivatedEvent evt)
-
-