org.fhcrc.cpl.toolbox.commandline.arguments
Interface CommandLineArgumentDefinition

All Known Implementing Classes:
BaseArgumentDefinitionImpl, BooleanArgumentDefinition, DecimalArgumentDefinition, DecimalListArgumentDefinition, DeltaMassArgumentDefinition, DirectoryToReadArgumentDefinition, DirectoryToWriteArgumentDefinition, EnumeratedValuesArgumentDefinition, FastaFileArgumentDefinition, FeatureFileArgumentDefinition, FileArgumentDefinition, FileToReadArgumentDefinition, FileToReadListArgumentDefinition, FileToWriteArgumentDefinition, IntegerArgumentDefinition, ModificationListArgumentDefinition, StringArgumentDefinition, StringListArgumentDefinition

public interface CommandLineArgumentDefinition

This interface allows for communication between msInspect and individual CommandLineModules about required and optional arguments. Different types of arguments are validated/converted by different implementing classes. We recommend that these classes also extend BaseArgumentDefinitionImpl, but that is not required.


Field Summary
static java.lang.String UNNAMED_PARAMETER_VALUE_ARGUMENT
           
static java.lang.String UNNAMED_PARAMETER_VALUE_SERIES_ARGUMENT
           
 
Method Summary
 javax.swing.JComponent addComponentsForGUI(java.awt.Container parent, javax.swing.JDialog parentDialog, java.lang.String defaultValue)
          Add GUI components for specifying this argument.
 javax.swing.JComponent addComponentsForGUISeries(java.awt.Container parent, javax.swing.JDialog parentDialog, java.lang.String defaultValue)
          Add GUI components for specifying a series of this type of argument, separated by spaces.
 java.lang.Object convertArgumentValue(java.lang.String argumentValue)
          Validate the argument value and convert it to an Object of the appropriate type
 java.lang.String getArgumentDisplayName()
           
 java.lang.String getArgumentName()
           
 java.lang.Object getDefaultValue()
          Get the default value for this argument, or null if there is none.
 java.lang.String getDefaultValueAsString()
          Get the default value, as a String, for the help text.
 java.lang.String getHelpText()
           
 java.lang.String getValueDescriptor()
          Return a String that will be used as a generic example for the value to be used for this argument, in auto-generated usage
 java.lang.String getValueFromGUIComponent(javax.swing.JComponent component)
          Interrogate the GUI component used for this argument, to get its value.
 boolean hasDefaultValue()
          Does this argument definition have a default value?
 boolean isAdvanced()
          Is this argument "advanced"? That is, can a basic user of the module safely ignore it?
 boolean isRequired()
           
 void setAdvanced(boolean advanced)
          Specify "advanced" status of this argument
 void setArgumentDisplayName(java.lang.String displayName)
          set the name of the argument for display purposes.
 void setDefaultValue(java.lang.Object defaultValue)
          Set the default value for this definition
 void setHelpText(java.lang.String helpText)
           
 void setRequired(boolean required)
          Declare whether this is a required argument.
 java.lang.String valueToString(java.lang.Object argValue)
          Return a String representing this value
 

Field Detail

UNNAMED_PARAMETER_VALUE_ARGUMENT

static final java.lang.String UNNAMED_PARAMETER_VALUE_ARGUMENT
See Also:
Constant Field Values

UNNAMED_PARAMETER_VALUE_SERIES_ARGUMENT

static final java.lang.String UNNAMED_PARAMETER_VALUE_SERIES_ARGUMENT
See Also:
Constant Field Values
Method Detail

getArgumentName

java.lang.String getArgumentName()
Returns:
the name of the argument. When the user enters arguments, their names are checked against this value, case-insensitively

getArgumentDisplayName

java.lang.String getArgumentDisplayName()
Returns:
the name of the argument for display purposes. For named arguments, this should really be the same as getArgumentName(). But for unnamed arguments or unnamed series arguments, this gives the developer a chance to use a different name in the help

setArgumentDisplayName

void setArgumentDisplayName(java.lang.String displayName)
set the name of the argument for display purposes. For named arguments, this should really be the same as getArgumentName(). But for unnamed arguments or unnamed series arguments, this gives the developer a chance to use a different name in the help


getHelpText

java.lang.String getHelpText()
Returns:
help text for specifying this argument, or null if not specified

setHelpText

void setHelpText(java.lang.String helpText)

convertArgumentValue

java.lang.Object convertArgumentValue(java.lang.String argumentValue)
                                      throws ArgumentValidationException
Validate the argument value and convert it to an Object of the appropriate type

Parameters:
argumentValue -
Returns:
true if it validates, false if not
Throws:
ArgumentValidationException

isRequired

boolean isRequired()
Returns:
whether this argument is required

setRequired

void setRequired(boolean required)
Declare whether this is a required argument. This is a convenience method

Parameters:
required -

getValueDescriptor

java.lang.String getValueDescriptor()
Return a String that will be used as a generic example for the value to be used for this argument, in auto-generated usage

Returns:

getDefaultValue

java.lang.Object getDefaultValue()
Get the default value for this argument, or null if there is none. However, since null is a valid default in some cases, hasDefaultValue() should be used to determine whether there is a useful default value

Returns:

getDefaultValueAsString

java.lang.String getDefaultValueAsString()
Get the default value, as a String, for the help text. In most cases, this will be equivalent to getDefaultValue().toString();

Returns:

hasDefaultValue

boolean hasDefaultValue()
Does this argument definition have a default value?

Returns:

setDefaultValue

void setDefaultValue(java.lang.Object defaultValue)
Set the default value for this definition


valueToString

java.lang.String valueToString(java.lang.Object argValue)
Return a String representing this value

Parameters:
argValue -
Returns:

isAdvanced

boolean isAdvanced()
Is this argument "advanced"? That is, can a basic user of the module safely ignore it?

Returns:

setAdvanced

void setAdvanced(boolean advanced)
Specify "advanced" status of this argument

Parameters:
advanced -

addComponentsForGUI

javax.swing.JComponent addComponentsForGUI(java.awt.Container parent,
                                           javax.swing.JDialog parentDialog,
                                           java.lang.String defaultValue)
Add GUI components for specifying this argument. Generally this will be a single field, but more complicated components are allowed. The return value should be the component that will actually contain the user's input. The components should be added directly to parent. If a dialog box needs to be opened, parentDialog can be referenced. The initial value of the field, if any, is passed in -- no need for the component to check the default

Parameters:
parent -
parentDialog -
defaultValue -
Returns:

addComponentsForGUISeries

javax.swing.JComponent addComponentsForGUISeries(java.awt.Container parent,
                                                 javax.swing.JDialog parentDialog,
                                                 java.lang.String defaultValue)
Add GUI components for specifying a series of this type of argument, separated by spaces. Generally this will be a single field, but more complicated components are allowed. The return value should be the component that will actually contain the user's input. The components should be added directly to parent. If a dialog box needs to be opened, parentDialog can be referenced. The initial value of the field, if any, is passed in -- no need for the component to check the default. This is for arguments named UNNAMED_SERIES_ARGUMENT_VALUE

Parameters:
parent -
parentDialog -
defaultValue -
Returns:

getValueFromGUIComponent

java.lang.String getValueFromGUIComponent(javax.swing.JComponent component)
Interrogate the GUI component used for this argument, to get its value. Most argument types will use text fields, but not all (e.g., JComboBox for Boolean and Enumerated)

Parameters:
component -
Returns:


Fred Hutchinson Cancer Research Center