Package uk.ac.starlink.ttools.plottask
Class ColorParameter
- java.lang.Object
-
- uk.ac.starlink.task.Parameter<T>
-
- uk.ac.starlink.ttools.plottask.NamedObjectParameter<java.awt.Color>
-
- uk.ac.starlink.ttools.plottask.ColorParameter
-
public class ColorParameter extends NamedObjectParameter<java.awt.Color>
-
-
Constructor Summary
Constructors Constructor Description ColorParameter(java.lang.String name)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
colorValue(uk.ac.starlink.task.Environment env)
Returns the value of this parameter as a Color object.java.awt.Color
fromString(java.lang.String name)
Translates a string value for this parameter into the object value which it represents.java.lang.String
getFormatDescription()
Returns an XML string, suitable for inclusion in a parameter description, which explains the format of values accepted by this parameter.void
setDefaultColor(java.awt.Color color)
Sets the default value of this parameter to a given color object.java.lang.String
toString(java.awt.Color option)
Translates a possible option value of this parameter into a string which represents it as a string value.-
Methods inherited from class uk.ac.starlink.ttools.plottask.NamedObjectParameter
addOption, getNames, getOptionList, getOptions, getUsage, setDefaultOption, setUsage, stringToObject
-
Methods inherited from class uk.ac.starlink.task.Parameter
clearValue, getDescription, getName, getPosition, getPreferExplicit, getPrompt, getStringDefault, getValueClass, isNullPermitted, objectToString, objectValue, setDescription, setDescription, setName, setNullPermitted, setPosition, setPreferExplicit, setPrompt, setStringDefault, setValue, setValueFromObject, setValueFromString, stringValue, toArray, toString
-
-
-
-
Method Detail
-
colorValue
public java.awt.Color colorValue(uk.ac.starlink.task.Environment env) throws uk.ac.starlink.task.TaskException
Returns the value of this parameter as a Color object.- Parameters:
env
- execution environment- Throws:
uk.ac.starlink.task.TaskException
-
setDefaultColor
public void setDefaultColor(java.awt.Color color)
Sets the default value of this parameter to a given color object.- Parameters:
color
- colour
-
toString
public java.lang.String toString(java.awt.Color option)
Description copied from class:NamedObjectParameter
Translates a possible option value of this parameter into a string which represents it as a string value.- Overrides:
toString
in classNamedObjectParameter<java.awt.Color>
- Parameters:
option
- object value- Returns:
- corresponding string
-
fromString
public java.awt.Color fromString(java.lang.String name)
Description copied from class:NamedObjectParameter
Translates a string value for this parameter into the object value which it represents. Must return a suitable object value for this parameter, or throw an unchecked exception.The implementation must be such that
fromString(toString(o)).equals(o)
.- Specified by:
fromString
in classNamedObjectParameter<java.awt.Color>
- Parameters:
name
- option name- Returns:
- corresponding option value
-
getFormatDescription
public java.lang.String getFormatDescription()
Returns an XML string, suitable for inclusion in a parameter description, which explains the format of values accepted by this parameter. The returned string is not enclosed in a <p> element.- Returns:
- format description XML string
-
-