org.scijava.module
Class AbstractModuleInfo

java.lang.Object
  extended by org.scijava.AbstractBasicDetails
      extended by org.scijava.AbstractUIDetails
          extended by org.scijava.module.AbstractModuleInfo
All Implemented Interfaces:
Comparable<Prioritized>, BasicDetails, Identifiable, ModuleInfo, Prioritized, UIDetails, Validated
Direct Known Subclasses:
DefaultMutableModuleInfo, ScriptInfo

public abstract class AbstractModuleInfo
extends AbstractUIDetails
implements ModuleInfo, Identifiable

Abstract superclass of ModuleInfo implementation.

By default, ModuleItems are stored in HashMaps and ArrayLists, internally.

Author:
Curtis Rueden

Field Summary
 
Fields inherited from interface org.scijava.UIDetails
APPLICATION_MENU_ROOT
 
Constructor Summary
AbstractModuleInfo()
           
 
Method Summary
 boolean canCancel()
          Gets whether the module condones cancellation.
 boolean canPreview()
          Gets whether the module supports previews.
 boolean canRunHeadless()
          Gets whether the module condones headless execution.
protected  void clearParameters()
          Clears input and output parameters.
 String getIdentifier()
          Gets a string intended to function as an identifier for the object.
 String getInitializer()
          Gets the function that is called to initialize the module's values.
 ModuleItem<?> getInput(String name)
          Gets the input item with the given name.
<T> ModuleItem<T>
getInput(String name, Class<T> type)
          Gets the input item with the given name and type.
 ModuleItem<?> getOutput(String name)
          Gets the output item with the given name.
<T> ModuleItem<T>
getOutput(String name, Class<T> type)
          Gets the output item with the given name and type.
 List<ValidityProblem> getProblems()
          Gets the list of problems encountered while initializing the object.
 String getTitle()
          Gets an appropriate title for the object, for use in a user interface.
protected  List<ModuleItem<?>> inputList()
          Gets outputMap, initializing if needed.
protected  Map<String,ModuleItem<?>> inputMap()
          Gets inputMap, initializing if needed.
 Iterable<ModuleItem<?>> inputs()
          Gets the list of input items.
 boolean isInteractive()
          Gets whether the module is intended to be run interactively.
 boolean isValid()
          Gets whether the object is completely valid (i.e., no problems during initialization).
protected  List<ModuleItem<?>> outputList()
          Gets outputList, initializing if needed.
protected  Map<String,ModuleItem<?>> outputMap()
          Gets inputList, initializing if needed.
 Iterable<ModuleItem<?>> outputs()
          Gets the list of output items.
protected  void parseParameters()
          Parses input and output parameters.
protected  void registerInput(ModuleItem<?> input)
          Adds an input.
protected  void registerOutput(ModuleItem<?> output)
          Adds an output.
 void update(EventService eventService)
          Notifies interested parties that the module info has been modified.
 
Methods inherited from class org.scijava.AbstractUIDetails
compareTo, getIconPath, getMenuPath, getMenuRoot, getPriority, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setPriority, setSelectable, setSelected, setSelectionGroup, setVisible, toString
 
Methods inherited from class org.scijava.AbstractBasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.module.ModuleInfo
createModule, getDelegateClassName, loadDelegateClass
 
Methods inherited from interface org.scijava.UIDetails
getIconPath, getMenuPath, getMenuRoot, getSelectionGroup, isEnabled, isSelectable, isSelected, isVisible, setEnabled, setIconPath, setMenuPath, setMenuRoot, setSelectable, setSelected, setSelectionGroup, setVisible
 
Methods inherited from interface org.scijava.BasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

AbstractModuleInfo

public AbstractModuleInfo()
Method Detail

getInput

public ModuleItem<?> getInput(String name)
Description copied from interface: ModuleInfo
Gets the input item with the given name.

Specified by:
getInput in interface ModuleInfo

getInput

public <T> ModuleItem<T> getInput(String name,
                                  Class<T> type)
Description copied from interface: ModuleInfo
Gets the input item with the given name and type.

Specified by:
getInput in interface ModuleInfo

getOutput

public ModuleItem<?> getOutput(String name)
Description copied from interface: ModuleInfo
Gets the output item with the given name.

Specified by:
getOutput in interface ModuleInfo

getOutput

public <T> ModuleItem<T> getOutput(String name,
                                   Class<T> type)
Description copied from interface: ModuleInfo
Gets the output item with the given name and type.

Specified by:
getOutput in interface ModuleInfo

inputs

public Iterable<ModuleItem<?>> inputs()
Description copied from interface: ModuleInfo
Gets the list of input items.

Specified by:
inputs in interface ModuleInfo

outputs

public Iterable<ModuleItem<?>> outputs()
Description copied from interface: ModuleInfo
Gets the list of output items.

Specified by:
outputs in interface ModuleInfo

isInteractive

public boolean isInteractive()
Description copied from interface: ModuleInfo
Gets whether the module is intended to be run interactively. Typically this means its inputs are supposed to be presented in a non-modal dialog box, with Runnable.run() being called whenever any of the values change.

Specified by:
isInteractive in interface ModuleInfo

canPreview

public boolean canPreview()
Description copied from interface: ModuleInfo
Gets whether the module supports previews. A preview is a quick approximation of the results that would be obtained by actually executing the module with Runnable.run(). If this method returns false, then calling Module.preview() will have no effect.

Specified by:
canPreview in interface ModuleInfo

canCancel

public boolean canCancel()
Description copied from interface: ModuleInfo
Gets whether the module condones cancellation. Strictly speaking, any module execution can be canceled during preprocessing, but this flag is a hint that doing so may be a bad idea, and the UI may want to disallow it. If this method returns false, then calling Module.cancel() will have no effect.

Specified by:
canCancel in interface ModuleInfo

canRunHeadless

public boolean canRunHeadless()
Description copied from interface: ModuleInfo
Gets whether the module condones headless execution. Strictly speaking, there is no guarantee that any module will work headless just because it declares itself so, but this flag hints that headless execution is likely to succeed (if flag is true), or fail (if flag is false).

Specified by:
canRunHeadless in interface ModuleInfo

getInitializer

public String getInitializer()
Description copied from interface: ModuleInfo
Gets the function that is called to initialize the module's values.

Specified by:
getInitializer in interface ModuleInfo

update

public void update(EventService eventService)
Description copied from interface: ModuleInfo
Notifies interested parties that the module info has been modified. This mechanism is useful for updating any corresponding user interface such as menu items that are linked to the module.

For classes implementing this interface directly, this method should publish a ModulesUpdatedEvent to the event bus (see update(EventService) for an example).

Specified by:
update in interface ModuleInfo

getTitle

public String getTitle()
Description copied from interface: UIDetails
Gets an appropriate title for the object, for use in a user interface. The result is prioritized as follows:
  1. Item label
  2. Menu path's leaf entry name
  3. Item name
  4. Item's class name, without package prefix

Specified by:
getTitle in interface UIDetails
Overrides:
getTitle in class AbstractUIDetails

isValid

public boolean isValid()
Description copied from interface: Validated
Gets whether the object is completely valid (i.e., no problems during initialization).

Specified by:
isValid in interface Validated

getProblems

public List<ValidityProblem> getProblems()
Description copied from interface: Validated
Gets the list of problems encountered while initializing the object.

Specified by:
getProblems in interface Validated
Returns:
The list of problems, or a zero-length list in the case of Validated.isValid() returning true.

getIdentifier

public String getIdentifier()
Description copied from interface: Identifiable
Gets a string intended to function as an identifier for the object.

Specified by:
getIdentifier in interface Identifiable

parseParameters

protected void parseParameters()
Parses input and output parameters. Intended to be overridden by concrete subclasses.


clearParameters

protected void clearParameters()
Clears input and output parameters.


registerInput

protected void registerInput(ModuleItem<?> input)
Adds an input. Intended to be called from overridden parseParameters() methods.


registerOutput

protected void registerOutput(ModuleItem<?> output)
Adds an output. Intended to be called from overridden parseParameters() methods.


inputMap

protected Map<String,ModuleItem<?>> inputMap()
Gets inputMap, initializing if needed.


outputMap

protected Map<String,ModuleItem<?>> outputMap()
Gets inputList, initializing if needed.


inputList

protected List<ModuleItem<?>> inputList()
Gets outputMap, initializing if needed.


outputList

protected List<ModuleItem<?>> outputList()
Gets outputList, initializing if needed.



Copyright © 2009–2014 SciJava. All rights reserved.