org.scijava.module
Class AbstractModuleItem<T>

java.lang.Object
  extended by org.scijava.AbstractBasicDetails
      extended by org.scijava.module.AbstractModuleItem<T>
All Implemented Interfaces:
BasicDetails, ModuleItem<T>
Direct Known Subclasses:
CommandModuleItem, DefaultMutableModuleItem

public abstract class AbstractModuleItem<T>
extends AbstractBasicDetails
implements ModuleItem<T>

Abstract superclass of ModuleItem implementations.

Author:
Curtis Rueden

Constructor Summary
AbstractModuleItem(ModuleInfo info)
           
 
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).
protected  Class<?> getDelegateClass()
           
 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).
 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()
          Returns the persisted value of a ModuleItem.
 void saveValue(T value)
          Saves the given value to persistent storage.
 void setValue(Module module, T value)
          Sets the item's current value with respect to the given module.
 String 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.ModuleItem
getType
 
Methods inherited from interface org.scijava.BasicDetails
get, getDescription, getLabel, getName, is, set, setDescription, setLabel, setName
 

Constructor Detail

AbstractModuleItem

public AbstractModuleItem(ModuleInfo info)
Method Detail

toString

public String toString()
Overrides:
toString in class AbstractBasicDetails

getGenericType

public Type getGenericType()
Description copied from interface: ModuleItem
Gets the type of the item, including Java generic parameters.

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

Specified by:
getGenericType in interface ModuleItem<T>
See Also:
Field.getGenericType()

getIOType

public ItemIO getIOType()
Description copied from interface: ModuleItem
Gets the input/output type of the item.

Specified by:
getIOType in interface ModuleItem<T>

isInput

public boolean isInput()
Description copied from interface: ModuleItem
Gets whether the item is a module input.

Specified by:
isInput in interface ModuleItem<T>

isOutput

public boolean isOutput()
Description copied from interface: ModuleItem
Gets whether the item is a module output.

Specified by:
isOutput in interface ModuleItem<T>

getVisibility

public ItemVisibility getVisibility()
Description copied from interface: ModuleItem
Gets the visibility of the item.

Specified by:
getVisibility in interface ModuleItem<T>

isAutoFill

public boolean isAutoFill()
Description copied from interface: ModuleItem
Gets whether the item value is allowed to be auto-filled.

Specified by:
isAutoFill in interface ModuleItem<T>

isRequired

public boolean isRequired()
Description copied from interface: ModuleItem
Gets whether the item value must be specified (i.e., no default).

Specified by:
isRequired in interface ModuleItem<T>

isPersisted

public boolean isPersisted()
Description copied from interface: ModuleItem
Gets whether to remember the most recent value of the parameter.

Specified by:
isPersisted in interface ModuleItem<T>

getPersistKey

public String getPersistKey()
Description copied from interface: ModuleItem
Gets the key to use for saving the value persistently.

Specified by:
getPersistKey in interface ModuleItem<T>

loadValue

public T loadValue()
Returns the persisted value of a ModuleItem. Returns null if nothing has been persisted. It is the API user's responsibility to check the return value for null.

Specified by:
loadValue in interface ModuleItem<T>

saveValue

public void saveValue(T value)
Description copied from interface: ModuleItem
Saves the given value to persistent storage. This allows later restoration of the value via ModuleItem.loadValue(), even from a different JVM.

Specified by:
saveValue in interface ModuleItem<T>

getInitializer

public String getInitializer()
Description copied from interface: ModuleItem
Gets the function that is called to initialize the item's value.

Specified by:
getInitializer in interface ModuleItem<T>

initialize

public void initialize(Module module)
                throws MethodCallException
Description copied from interface: ModuleItem
Invokes this item's initializer function, if any, on the given module.

Specified by:
initialize in interface ModuleItem<T>
Throws:
MethodCallException
See Also:
ModuleItem.getInitializer()

getCallback

public String getCallback()
Description copied from interface: ModuleItem
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.

Specified by:
getCallback in interface ModuleItem<T>

callback

public void callback(Module module)
              throws MethodCallException
Description copied from interface: ModuleItem
Invokes this item's callback function, if any, on the given module.

Specified by:
callback in interface ModuleItem<T>
Throws:
MethodCallException
See Also:
ModuleItem.getCallback()

getWidgetStyle

public String getWidgetStyle()
Description copied from interface: ModuleItem
Gets the preferred widget style to use when rendering the item in a user interface.

Specified by:
getWidgetStyle in interface ModuleItem<T>

getMinimumValue

public T getMinimumValue()
Description copied from interface: ModuleItem
Gets the minimum allowed value (if applicable).

Specified by:
getMinimumValue in interface ModuleItem<T>

getMaximumValue

public T getMaximumValue()
Description copied from interface: ModuleItem
Gets the maximum allowed value (if applicable).

Specified by:
getMaximumValue in interface ModuleItem<T>

getSoftMinimum

public T getSoftMinimum()
Description copied from interface: ModuleItem
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.

Specified by:
getSoftMinimum in interface ModuleItem<T>

getSoftMaximum

public T getSoftMaximum()
Description copied from interface: ModuleItem
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.

Specified by:
getSoftMaximum in interface ModuleItem<T>

getStepSize

public Number getStepSize()
Description copied from interface: ModuleItem
Gets the preferred step size to use when rendering the item in a user interface (if applicable).

Specified by:
getStepSize in interface ModuleItem<T>

getColumnCount

public int getColumnCount()
Description copied from interface: ModuleItem
Gets the preferred width of the input field in characters (if applicable).

Specified by:
getColumnCount in interface ModuleItem<T>

getChoices

public List<T> getChoices()
Description copied from interface: ModuleItem
Gets the list of possible values.

Specified by:
getChoices in interface ModuleItem<T>

getValue

public T getValue(Module module)
Description copied from interface: ModuleItem
Gets the item's current value with respect to the given module.

Specified by:
getValue in interface ModuleItem<T>

setValue

public void setValue(Module module,
                     T value)
Description copied from interface: ModuleItem
Sets the item's current value with respect to the given module.

Specified by:
setValue in interface ModuleItem<T>

getDelegateClass

protected Class<?> getDelegateClass()


Copyright © 2009–2014 SciJava. All rights reserved.