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, Module, MutableModule, SciJavaPlugin
public abstract class InteractiveCommand
- extends DynamicCommand
- implements Interactive, Previewable
An ImageJ command intended to be run interactively.
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.
- Author:
- Curtis Rueden
Methods inherited from class org.scijava.command.DynamicCommand |
cancel, context, getCancelReason, getContext, getInfo, getInput, getOutput, isCanceled, setContext, setInput, setOutput |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
run |
InteractiveCommand
public InteractiveCommand(String... listenerNames)
- Creates a new interactive command.
- Parameters:
listenerNames
- The list of names of inputs to keep in sync when the
active display changes. Each input must be a Display
.
preview
public void preview()
- Description copied from interface:
Module
- Computes 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 with
Runnable.run()
. Not all modules support
previews.
- Specified by:
preview
in interface Previewable
- Specified by:
preview
in interface Module
- Overrides:
preview
in class AbstractModule
- See Also:
ModuleInfo.canPreview()
cancel
public void cancel()
- Description copied from interface:
Module
- Performs necessary cleanup in response to cancellation of the module
execution. This is useful in conjunction with
Module.preview()
to undo
any changes made as a result of the preview.
- Specified by:
cancel
in interface Previewable
- Specified by:
cancel
in interface Module
- Overrides:
cancel
in class AbstractModule
- See Also:
ModuleInfo.canCancel()
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)
log
protected LogService log()
onEvent
protected void onEvent(DisplayActivatedEvent evt)
Copyright © 2009–2014 SciJava. All rights reserved.