Class AbstractModuleItem<T>
- java.lang.Object
-
- org.scijava.AbstractBasicDetails
-
- org.scijava.module.AbstractModuleItem<T>
-
- All Implemented Interfaces:
BasicDetails,ModuleItem<T>,Named
- Direct Known Subclasses:
CommandModuleItem,DefaultMutableModuleItem
public abstract class AbstractModuleItem<T> extends AbstractBasicDetails implements ModuleItem<T>
Abstract superclass ofModuleItemimplementations.- Author:
- Curtis Rueden
-
-
Constructor Summary
Constructors Constructor Description AbstractModuleItem(ModuleInfo info)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcallback(Module module)Invokes this item's callback function, if any, on the given module.StringgetCallback()Gets the function that is called whenever this item changes.List<T>getChoices()Gets the list of possible values.intgetColumnCount()Gets the preferred width of the input field in characters (if applicable).TgetDefaultValue()Gets the default value.protected Class<?>getDelegateClass()TypegetGenericType()Gets the type of the item, including Java generic parameters.ModuleInfogetInfo()Gets theModuleInfoto which this item belongs.StringgetInitializer()Gets the function that is called to initialize the item's value.ItemIOgetIOType()Gets the input/output type of the item.TgetMaximumValue()Gets the maximum allowed value (if applicable).TgetMinimumValue()Gets the minimum allowed value (if applicable).StringgetPersistKey()Gets the key to use for saving the value persistently.TgetSoftMaximum()Gets the "soft" maximum value (if applicable).TgetSoftMinimum()Gets the "soft" minimum value (if applicable).NumbergetStepSize()Gets the preferred step size to use when rendering the item in a user interface (if applicable).StringgetValidater()Gets the function that is called to validate the item's value.TgetValue(Module module)Gets the item's current value with respect to the given module.ItemVisibilitygetVisibility()Gets the visibility of the item.StringgetWidgetStyle()Gets the preferred widget style to use when rendering the item in a user interface.voidinitialize(Module module)Invokes this item's initializer function, if any, on the given module.booleanisAutoFill()Gets whether the item value is allowed to be auto-filled.booleanisInput()Gets whether the item is a module input.booleanisOutput()Gets whether the item is a module output.booleanisPersisted()Gets whether to remember the most recent value of the parameter.booleanisRequired()Gets whether the item value must be specified (i.e., no default).TloadValue()Deprecated.voidsaveValue(T value)Deprecated.voidsetValue(Module module, T value)Sets the item's current value with respect to the given module.StringtoString()voidvalidate(Module module)Invokes this item's validation function, if any, on the given module.-
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.BasicDetails
get, getDescription, getLabel, is, set, setDescription, setLabel
-
Methods inherited from interface org.scijava.module.ModuleItem
getType, validateMessage
-
-
-
-
Constructor Detail
-
AbstractModuleItem
public AbstractModuleItem(ModuleInfo info)
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classAbstractBasicDetails
-
getInfo
public ModuleInfo getInfo()
Description copied from interface:ModuleItemGets theModuleInfoto which this item belongs.- Specified by:
getInfoin interfaceModuleItem<T>
-
getGenericType
public Type getGenericType()
Description copied from interface:ModuleItemGets the type of the item, including Java generic parameters.For many modules, this may be the same
Classobject returned byModuleItem.getType(), but some module inputs or outputs may be backed by a generic type such asList<String>orIterable<Integer>.- Specified by:
getGenericTypein interfaceModuleItem<T>- See Also:
Field.getGenericType()
-
getIOType
public ItemIO getIOType()
Description copied from interface:ModuleItemGets the input/output type of the item.- Specified by:
getIOTypein interfaceModuleItem<T>
-
isInput
public boolean isInput()
Description copied from interface:ModuleItemGets whether the item is a module input.- Specified by:
isInputin interfaceModuleItem<T>
-
isOutput
public boolean isOutput()
Description copied from interface:ModuleItemGets whether the item is a module output.- Specified by:
isOutputin interfaceModuleItem<T>
-
getVisibility
public ItemVisibility getVisibility()
Description copied from interface:ModuleItemGets the visibility of the item.- Specified by:
getVisibilityin interfaceModuleItem<T>
-
isAutoFill
public boolean isAutoFill()
Description copied from interface:ModuleItemGets whether the item value is allowed to be auto-filled.- Specified by:
isAutoFillin interfaceModuleItem<T>
-
isRequired
public boolean isRequired()
Description copied from interface:ModuleItemGets whether the item value must be specified (i.e., no default).- Specified by:
isRequiredin interfaceModuleItem<T>
-
isPersisted
public boolean isPersisted()
Description copied from interface:ModuleItemGets whether to remember the most recent value of the parameter.- Specified by:
isPersistedin interfaceModuleItem<T>
-
getPersistKey
public String getPersistKey()
Description copied from interface:ModuleItemGets the key to use for saving the value persistently.- Specified by:
getPersistKeyin interfaceModuleItem<T>
-
loadValue
@Deprecated public T loadValue()
Deprecated.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:
loadValuein interfaceModuleItem<T>- See Also:
ModuleService.load(ModuleItem)
-
saveValue
@Deprecated public void saveValue(T value)
Deprecated.Description copied from interface:ModuleItemSaves the given value to persistent storage. This allows later restoration of the value viaModuleItem.loadValue(), even from a different JVM.- Specified by:
saveValuein interfaceModuleItem<T>- See Also:
ModuleService.save(ModuleItem, Object)
-
getInitializer
public String getInitializer()
Description copied from interface:ModuleItemGets the function that is called to initialize the item's value.- Specified by:
getInitializerin interfaceModuleItem<T>
-
initialize
public void initialize(Module module) throws MethodCallException
Description copied from interface:ModuleItemInvokes this item's initializer function, if any, on the given module.- Specified by:
initializein interfaceModuleItem<T>- Throws:
MethodCallException- See Also:
ModuleItem.getInitializer()
-
getValidater
public String getValidater()
Description copied from interface:ModuleItemGets the function that is called to validate the item's value.- Specified by:
getValidaterin interfaceModuleItem<T>
-
validate
public void validate(Module module) throws MethodCallException
Description copied from interface:ModuleItemInvokes this item's validation function, if any, on the given module.The validation function may signal failure either by throwing an exception or by returning a non-empty
Stringerror message.- Specified by:
validatein interfaceModuleItem<T>- Throws:
MethodCallException- if validation fails or the method cannot be invoked. When the validater returns a non-empty String, aMethodCallExceptionis thrown with that string as its message.- See Also:
ModuleItem.getValidater(),ModuleItem.validateMessage(Module)
-
getCallback
public String getCallback()
Description copied from interface:ModuleItemGets 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:
getCallbackin interfaceModuleItem<T>
-
callback
public void callback(Module module) throws MethodCallException
Description copied from interface:ModuleItemInvokes this item's callback function, if any, on the given module.- Specified by:
callbackin interfaceModuleItem<T>- Throws:
MethodCallException- See Also:
ModuleItem.getCallback()
-
getWidgetStyle
public String getWidgetStyle()
Description copied from interface:ModuleItemGets the preferred widget style to use when rendering the item in a user interface.- Specified by:
getWidgetStylein interfaceModuleItem<T>
-
getDefaultValue
public T getDefaultValue()
Description copied from interface:ModuleItemGets the default value.- Specified by:
getDefaultValuein interfaceModuleItem<T>
-
getMinimumValue
public T getMinimumValue()
Description copied from interface:ModuleItemGets the minimum allowed value (if applicable).- Specified by:
getMinimumValuein interfaceModuleItem<T>
-
getMaximumValue
public T getMaximumValue()
Description copied from interface:ModuleItemGets the maximum allowed value (if applicable).- Specified by:
getMaximumValuein interfaceModuleItem<T>
-
getSoftMinimum
public T getSoftMinimum()
Description copied from interface:ModuleItemGets 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:
getSoftMinimumin interfaceModuleItem<T>
-
getSoftMaximum
public T getSoftMaximum()
Description copied from interface:ModuleItemGets 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:
getSoftMaximumin interfaceModuleItem<T>
-
getStepSize
public Number getStepSize()
Description copied from interface:ModuleItemGets the preferred step size to use when rendering the item in a user interface (if applicable).- Specified by:
getStepSizein interfaceModuleItem<T>
-
getColumnCount
public int getColumnCount()
Description copied from interface:ModuleItemGets the preferred width of the input field in characters (if applicable).- Specified by:
getColumnCountin interfaceModuleItem<T>
-
getChoices
public List<T> getChoices()
Description copied from interface:ModuleItemGets the list of possible values.- Specified by:
getChoicesin interfaceModuleItem<T>
-
getValue
public T getValue(Module module)
Description copied from interface:ModuleItemGets the item's current value with respect to the given module.- Specified by:
getValuein interfaceModuleItem<T>
-
setValue
public void setValue(Module module, T value)
Description copied from interface:ModuleItemSets the item's current value with respect to the given module.- Specified by:
setValuein interfaceModuleItem<T>
-
getDelegateClass
protected Class<?> getDelegateClass()
-
-