de.jstacs.utils.galaxy
Class MultilineSimpleParameter

java.lang.Object
  extended by de.jstacs.AnnotatedEntity
      extended by de.jstacs.parameters.Parameter
          extended by de.jstacs.parameters.SimpleParameter
              extended by de.jstacs.utils.galaxy.MultilineSimpleParameter
All Implemented Interfaces:
GalaxyConvertible, Rangeable, Storable, Cloneable

public class MultilineSimpleParameter
extends SimpleParameter

An extension of SimpleParameter that renders as a textarea in Galaxy, which is only suitable for DataType.STRINGs. Besides the toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean) and fromGalaxy(String, StringBuffer), all functionality is inherited from SimpleParameter.

Author:
Jan Grau

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.parameters.SimpleParameter
SimpleParameter.DatatypeNotValidException, SimpleParameter.IllegalValueException
 
Field Summary
 
Fields inherited from class de.jstacs.parameters.SimpleParameter
defaultValue, required, validator, value
 
Fields inherited from class de.jstacs.parameters.Parameter
parent
 
Fields inherited from class de.jstacs.AnnotatedEntity
comment, datatype, name
 
Constructor Summary
MultilineSimpleParameter(StringBuffer representation)
          The standard constructor for the interface Storable.
MultilineSimpleParameter(String name, String comment, boolean required)
          Creates a new MultilineSimpleParameter with no default value.
MultilineSimpleParameter(String name, String comment, boolean required, Object defaultVal)
          Creates a new MultilineSimpleParameter with given default value.
MultilineSimpleParameter(String name, String comment, boolean required, ParameterValidator validator)
          Creates a new MultilineSimpleParameter with no default value and a ParameterValidator.
MultilineSimpleParameter(String name, String comment, boolean required, ParameterValidator validator, Object defaultVal)
          Creates a new MultilineSimpleParameter with given default value and a ParameterValidator.
 
Method Summary
 void fromGalaxy(String namePrefix, StringBuffer command)
          Parses the contents of command in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean) and sets the values of the Parameter or ParameterSet accordingly.
 void toGalaxy(String namePrefix, String configPrefix, int depth, StringBuffer descBuffer, StringBuffer configBuffer, boolean addLine)
          Creates an Galaxy XML-representation of the parameters and appends it to descBuffer and variable configuration and appends it to configBuffer.
 
Methods inherited from class de.jstacs.parameters.SimpleParameter
appendFurtherInfos, checkValue, clone, equals, extractFurtherInfos, getErrorMessage, getRangedInstance, getValidator, getValue, getXMLTag, hasDefaultOrIsSet, isAtomic, isRangeable, isRequired, isSet, reset, setDefault, setRangeable, setValidator, setValue, toString
 
Methods inherited from class de.jstacs.parameters.Parameter
getParent, isComparable, setParent
 
Methods inherited from class de.jstacs.AnnotatedEntity
getComment, getDatatype, getName, toXML
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultilineSimpleParameter

public MultilineSimpleParameter(String name,
                                String comment,
                                boolean required,
                                Object defaultVal)
                         throws SimpleParameter.DatatypeNotValidException,
                                SimpleParameter.IllegalValueException
Creates a new MultilineSimpleParameter with given default value.

Parameters:
name - the name of the parameter
comment - a comment on the parameter that tells the user some details about it
required - determines if the parameter is required
defaultVal - the default value
Throws:
DatatypeNotValidException - if datatype is not in the values allowed for a SimpleParameter
IllegalValueException - if the default value is not a valid value with respect to datatype
SimpleParameter.DatatypeNotValidException
SimpleParameter.IllegalValueException

MultilineSimpleParameter

public MultilineSimpleParameter(String name,
                                String comment,
                                boolean required,
                                ParameterValidator validator,
                                Object defaultVal)
                         throws ParameterException
Creates a new MultilineSimpleParameter with given default value and a ParameterValidator.

Parameters:
name - the name of the parameter
comment - a comment on the parameter that tells the user some details about it
required - determines if the parameter is required
validator - the validator for the parameter values
defaultVal - the default value
Throws:
ParameterException - if either the default value is not a valid value with respect to datatype or datatype is not in the values allowed for a SimpleParameter

MultilineSimpleParameter

public MultilineSimpleParameter(String name,
                                String comment,
                                boolean required,
                                ParameterValidator validator)
                         throws SimpleParameter.DatatypeNotValidException
Creates a new MultilineSimpleParameter with no default value and a ParameterValidator.

Parameters:
name - the name of the parameter
comment - a comment on the parameter that tells the user some details about it
required - determines if the parameter is required
validator - the validator for the parameter values
Throws:
DatatypeNotValidException - if datatype is not in the values allowed for a SimpleParameter
SimpleParameter.DatatypeNotValidException

MultilineSimpleParameter

public MultilineSimpleParameter(String name,
                                String comment,
                                boolean required)
                         throws SimpleParameter.DatatypeNotValidException
Creates a new MultilineSimpleParameter with no default value.

Parameters:
name - the name of the parameter
comment - a comment on the parameter that tells the user some details about it
required - determines if the parameter is required
Throws:
DatatypeNotValidException - if datatype is not one of the allowed DataTypes
SimpleParameter.DatatypeNotValidException

MultilineSimpleParameter

public MultilineSimpleParameter(StringBuffer representation)
                         throws NonParsableException
The standard constructor for the interface Storable. Constructs a MultilineSimpleParameter out of an XML representation.

Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the SimpleParameter could not be restored from the StringBuffer representation
Method Detail

toGalaxy

public void toGalaxy(String namePrefix,
                     String configPrefix,
                     int depth,
                     StringBuffer descBuffer,
                     StringBuffer configBuffer,
                     boolean addLine)
              throws Exception
Description copied from interface: GalaxyConvertible
Creates an Galaxy XML-representation of the parameters and appends it to descBuffer and variable configuration and appends it to configBuffer. The variable configuration is also used to parse user-supplied values returned by Galaxy.

Specified by:
toGalaxy in interface GalaxyConvertible
Overrides:
toGalaxy in class SimpleParameter
Parameters:
namePrefix - the prefix of the variable name used in Galaxy
configPrefix - the prefix for conditionals
depth - the depth in the parameter hierarchy, used for graphical representation of nesting
descBuffer - the buffer for the parameter description
configBuffer - the buffer for the configuration line
addLine - if true, a line is added before the title of a parameter
Throws:
Exception - if the conversion fails

fromGalaxy

public void fromGalaxy(String namePrefix,
                       StringBuffer command)
                throws Exception
Description copied from interface: GalaxyConvertible
Parses the contents of command in the format defined by configBuffer of GalaxyConvertible.toGalaxy(String, String, int, StringBuffer, StringBuffer, boolean) and sets the values of the Parameter or ParameterSet accordingly.

Specified by:
fromGalaxy in interface GalaxyConvertible
Overrides:
fromGalaxy in class SimpleParameter
Parameters:
namePrefix - the prefix of the variable name
command - the command string
Throws:
Exception - if the command string could not be parsed