org.scijava.module
Interface ModuleItem<T>

All Superinterfaces:
BasicDetails
All Known Subinterfaces:
MutableModuleItem<T>
All Known Implementing Classes:
AbstractModuleItem, CommandModuleItem, DefaultMutableModuleItem

public interface ModuleItem<T>
extends BasicDetails

A ModuleItem represents metadata about one input or output of a module.

Author:
Aivar Grislis, Curtis Rueden

Method Summary
 void callback(Module module)
          Invokes this item's callback function, if any, on the given module.
 String getCallback()
          Gets the function that is called whenever this item changes.
 List<T> getChoices()
          Gets the list of possible values.
 int getColumnCount()
          Gets the preferred width of the input field in characters (if applicable).
 Type getGenericType()
          Gets the type of the item, including Java generic parameters.
 String getInitializer()
          Gets the function that is called to initialize the item's value.
 ItemIO getIOType()
          Gets the input/output type of the item.
 T getMaximumValue()
          Gets the maximum allowed value (if applicable).
 T getMinimumValue()
          Gets the minimum allowed value (if applicable).
 String getPersistKey()
          Gets the key to use for saving the value persistently.
 T getSoftMaximum()
          Gets the "soft" maximum value (if applicable).
 T getSoftMinimum()
          Gets the "soft" minimum value (if applicable).
 Number getStepSize()
          Gets the preferred step size to use when rendering the item in a user interface (if applicable).
 Class<T> getType()
          Gets the type of the item.
 T getValue(Module module)
          Gets the item's current value with respect to the given module.
 ItemVisibility getVisibility()
          Gets the visibility of the item.
 String getWidgetStyle()
          Gets the preferred widget style to use when rendering the item in a user interface.
 void initialize(Module module)
          Invokes this item's initializer function, if any, on the given module.
 boolean isAutoFill()
          Gets whether the item value is allowed to be auto-filled.
 boolean isInput()
          Gets whether the item is a module input.
 boolean isOutput()
          Gets whether the item is a module output.
 boolean isPersisted()
          Gets whether to remember the most recent value of the parameter.
 boolean isRequired()
          Gets whether the item value must be specified (i.e., no default).
 T loadValue()
          Deprecated.  
 void saveValue(T value)
          Deprecated.  
 void setValue(Module module, T value)
          Sets the item's current value with respect to the given module.
 
Methods inherited from interface org.scijava.BasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 

Method Detail

getType

Class<T> getType()
Gets the type of the item.


getGenericType

Type getGenericType()
Gets the type of the item, including Java generic parameters.

For many modules, this may be the same Class object returned by getType(), but some module inputs or outputs may be backed by a generic type such as List<String> or Iterable<Integer>.

See Also:
Field.getGenericType()

getIOType

ItemIO getIOType()
Gets the input/output type of the item.


isInput

boolean isInput()
Gets whether the item is a module input.


isOutput

boolean isOutput()
Gets whether the item is a module output.


getVisibility

ItemVisibility getVisibility()
Gets the visibility of the item.


isAutoFill

boolean isAutoFill()
Gets whether the item value is allowed to be auto-filled.


isRequired

boolean isRequired()
Gets whether the item value must be specified (i.e., no default).


isPersisted

boolean isPersisted()
Gets whether to remember the most recent value of the parameter.


getPersistKey

String getPersistKey()
Gets the key to use for saving the value persistently.


loadValue

@Deprecated
T loadValue()
Deprecated. 

Loads the item's persisted value. This recalls the value last stored using saveValue(Object).

Note that this is different than obtaining a module instance's current value for the input; see getValue(Module) for that.

See Also:
ModuleService.load(ModuleItem)

saveValue

@Deprecated
void saveValue(T value)
Deprecated. 

Saves the given value to persistent storage. This allows later restoration of the value via loadValue(), even from a different JVM.

See Also:
ModuleService.save(ModuleItem, Object)

getInitializer

String getInitializer()
Gets the function that is called to initialize the item's value.


initialize

void initialize(Module module)
                throws MethodCallException
Invokes this item's initializer function, if any, on the given module.

Throws:
MethodCallException
See Also:
getInitializer()

getCallback

String getCallback()
Gets the function that is called whenever this item changes.

This mechanism enables interdependent items of various types. For example, two int parameters "width" and "height" could update each other when another boolean "Preserve aspect ratio" flag is set.


callback

void callback(Module module)
              throws MethodCallException
Invokes this item's callback function, if any, on the given module.

Throws:
MethodCallException
See Also:
getCallback()

getWidgetStyle

String getWidgetStyle()
Gets the preferred widget style to use when rendering the item in a user interface.


getMinimumValue

T getMinimumValue()
Gets the minimum allowed value (if applicable).


getMaximumValue

T getMaximumValue()
Gets the maximum allowed value (if applicable).


getSoftMinimum

T getSoftMinimum()
Gets the "soft" minimum value (if applicable).

The soft minimum is a hint for use in bounded scenarios, such as rendering in a user interface with a slider or scroll bar widget; the parameter value will not actually be clamped to the soft bounds, but they may be used in certain circumstances where appropriate.


getSoftMaximum

T getSoftMaximum()
Gets the "soft" maximum value (if applicable).

The soft maximum is a hint for use in bounded scenarios, such as rendering in a user interface with a slider or scroll bar widget; the parameter value will not actually be clamped to the soft bounds, but they may be used in certain circumstances where appropriate.


getStepSize

Number getStepSize()
Gets the preferred step size to use when rendering the item in a user interface (if applicable).


getColumnCount

int getColumnCount()
Gets the preferred width of the input field in characters (if applicable).


getChoices

List<T> getChoices()
Gets the list of possible values.


getValue

T getValue(Module module)
Gets the item's current value with respect to the given module.


setValue

void setValue(Module module,
              T value)
Sets the item's current value with respect to the given module.



Copyright © 2009–2014 SciJava. All rights reserved.