public class DynamicCommandInfo extends DefaultMutableModuleInfo
DynamicCommand
's associated
ModuleInfo
.
This class wraps a plain CommandInfo
object (e.g. from the
CommandService
's index, present due to an @Plugin
annotation
on the DynamicCommand
class), delegating to it for the
UIDetails
methods. The plain CommandInfo
cannot be used
as-is, however, because we need to override the ModuleInfo
methods as
well as provide metadata manipulation functionality such as
MutableModuleInfo.addInput(ModuleItem)
.
APPLICATION_MENU_ROOT
Constructor and Description |
---|
DynamicCommandInfo(CommandInfo info,
Class<? extends DynamicCommand> moduleClass) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCancel()
Gets whether the module condones cancellation.
|
boolean |
canPreview()
Gets whether the module supports previews.
|
String |
getDescription()
Gets a string describing the object.
|
String |
getIconPath()
Gets the resource path to an icon representing the object.
|
String |
getInitializer()
Gets the function that is called to initialize the module's values.
|
protected Field |
getInputField(String name)
|
String |
getLabel()
Gets the name to appear in a UI, if applicable.
|
MenuPath |
getMenuPath()
Gets the path to the object's suggested position in the menu structure.
|
String |
getMenuRoot()
Gets the name of the menu structure to which the object belongs.
|
<T> MutableModuleItem<T> |
getMutableInput(String name,
Class<T> type)
Gets the mutable input with the given name and type.
|
<T> MutableModuleItem<T> |
getMutableOutput(String name,
Class<T> type)
Gets the mutable output with the given name and type.
|
String |
getName()
Gets the name of the object.
|
protected Field |
getOutputField(String name)
|
double |
getPriority()
Gets the sort priority of the object.
|
List<ValidityProblem> |
getProblems()
Gets the list of problems encountered while initializing the object.
|
String |
getSelectionGroup()
Gets the name of the selection group to which the object belongs.
|
String |
getTitle()
Gets an appropriate title for the object, for use in a user interface.
|
boolean |
isEnabled()
Gets whether the object should be enabled in the user interface.
|
boolean |
isInteractive()
Gets whether the module is intended to be run interactively.
|
boolean |
isSelectable()
Gets whether the object can be selected (e.g., checking and unchecking its
menu item) in the user interface.
|
boolean |
isSelected()
Gets whether the object is selected (e.g., its menu item is checked) in the
user interface.
|
boolean |
isValid()
Gets whether the object is completely valid (i.e., no problems during
initialization).
|
void |
setDescription(String description)
Sets a string describing the object.
|
void |
setEnabled(boolean enabled)
Sets whether the object should be enabled in the user interface.
|
void |
setIconPath(String iconPath)
Sets the resource path to an icon representing the object.
|
void |
setLabel(String label)
Sets the name to appear in a UI, if applicable.
|
void |
setMenuPath(MenuPath menuPath)
Sets the path to the object's suggested position in the menu structure.
|
void |
setMenuRoot(String menuRoot)
Sets the name of the menu structure to which the object belongs.
|
void |
setName(String name)
Sets the name of the object.
|
void |
setPriority(double priority)
Sets the sort priority of the object.
|
void |
setSelectable(boolean selectable)
Sets whether the object can be selected (e.g., checking and unchecking its
menu item) in the user interface.
|
void |
setSelected(boolean selected)
Sets whether the object is selected (e.g., its menu item is checked) in the
user interface.
|
void |
setSelectionGroup(String selectionGroup)
Sets the name of the selection group to which the object belongs.
|
addInput, addOutput, getModuleClass, removeInput, removeOutput, setModuleClass
clearParameters, getInput, getInput, getOutput, getOutput, inputList, inputMap, inputs, outputList, outputMap, outputs, parseParameters, registerInput, registerOutput
isVisible, setVisible, toString
get, is, set
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createModule, getDelegateClassName, loadDelegateClass
canRunHeadless, getIdentifier, getInput, getInput, getLocation, getOutput, getOutput, getVersion, inputs, outputs, update
compareTo, isVisible, setVisible
get, is, set
public DynamicCommandInfo(CommandInfo info, Class<? extends DynamicCommand> moduleClass)
public <T> MutableModuleItem<T> getMutableInput(String name, Class<T> type)
If the input is not mutable (i.e., a MutableModuleItem
), a
ClassCastException
will be thrown. However, this method is always
safe to call for inputs declared using the @Parameter
notation of
Command
s; it is only unsafe when called to retrieve inputs added
dynamically using DefaultMutableModuleInfo.addInput(ModuleItem)
, where the
ModuleItem
in question was of unknown (i.e., potentially
non-mutable) origin.
ClassCastException
- if input is not a MutableModuleItem
.public <T> MutableModuleItem<T> getMutableOutput(String name, Class<T> type)
If the output is not mutable (i.e., a MutableModuleItem
), a
ClassCastException
will be thrown. However, this method is always
safe to call for outputs declared using the @Parameter
notation of
Command
s; it is only unsafe when called to retrieve outputs added
dynamically using DefaultMutableModuleInfo.addInput(ModuleItem)
, where the
ModuleItem
in question was of unknown (i.e., potentially
non-mutable) origin.
ClassCastException
- if output is not a MutableModuleItem
.public boolean isInteractive()
ModuleInfo
Runnable.run()
being called whenever any of the values change.public boolean canPreview()
ModuleInfo
Runnable.run()
. If this method returns false, then
calling Module.preview()
will have no effect.public boolean canCancel()
ModuleInfo
Module.cancel()
will
have no effect.public String getInitializer()
ModuleInfo
public String getTitle()
UIDetails
public MenuPath getMenuPath()
UIDetails
getMenuPath
in interface UIDetails
getMenuPath
in class AbstractUIDetails
public String getMenuRoot()
UIDetails
getMenuRoot
in interface UIDetails
getMenuRoot
in class AbstractUIDetails
public String getIconPath()
UIDetails
getIconPath
in interface UIDetails
getIconPath
in class AbstractUIDetails
public double getPriority()
Prioritized
getPriority
in interface Prioritized
getPriority
in class AbstractUIDetails
Priority
public boolean isSelectable()
UIDetails
isSelectable
in interface UIDetails
isSelectable
in class AbstractUIDetails
public String getSelectionGroup()
UIDetails
getSelectionGroup
in interface UIDetails
getSelectionGroup
in class AbstractUIDetails
public boolean isSelected()
UIDetails
isSelected
in interface UIDetails
isSelected
in class AbstractUIDetails
public boolean isEnabled()
UIDetails
isEnabled
in interface UIDetails
isEnabled
in class AbstractUIDetails
public void setMenuPath(MenuPath menuPath)
UIDetails
setMenuPath
in interface UIDetails
setMenuPath
in class AbstractUIDetails
public void setMenuRoot(String menuRoot)
UIDetails
setMenuRoot
in interface UIDetails
setMenuRoot
in class AbstractUIDetails
public void setIconPath(String iconPath)
UIDetails
setIconPath
in interface UIDetails
setIconPath
in class AbstractUIDetails
public void setPriority(double priority)
Prioritized
setPriority
in interface Prioritized
setPriority
in class AbstractUIDetails
Priority
public void setEnabled(boolean enabled)
UIDetails
setEnabled
in interface UIDetails
setEnabled
in class AbstractUIDetails
public void setSelectable(boolean selectable)
UIDetails
setSelectable
in interface UIDetails
setSelectable
in class AbstractUIDetails
public void setSelectionGroup(String selectionGroup)
UIDetails
setSelectionGroup
in interface UIDetails
setSelectionGroup
in class AbstractUIDetails
public void setSelected(boolean selected)
UIDetails
setSelected
in interface UIDetails
setSelected
in class AbstractUIDetails
public String getLabel()
BasicDetails
getLabel
in interface BasicDetails
getLabel
in class AbstractBasicDetails
public String getDescription()
BasicDetails
getDescription
in interface BasicDetails
getDescription
in class AbstractBasicDetails
public void setLabel(String label)
BasicDetails
setLabel
in interface BasicDetails
setLabel
in class AbstractBasicDetails
public void setDescription(String description)
BasicDetails
setDescription
in interface BasicDetails
setDescription
in class AbstractBasicDetails
public String getName()
Named
getName
in interface Named
getName
in class AbstractBasicDetails
public void setName(String name)
Named
setName
in interface Named
setName
in class AbstractBasicDetails
public boolean isValid()
Validated
public List<ValidityProblem> getProblems()
Validated
Validated.isValid()
returning true.Copyright © 2015–2022 SciJava. All rights reserved.