uk.ac.starlink.ttools.plottask
Class StyleParameter<T>

java.lang.Object
  extended by uk.ac.starlink.task.Parameter<T>
      extended by uk.ac.starlink.task.ChoiceParameter<T>
          extended by uk.ac.starlink.ttools.plottask.StyleParameter<T>
Direct Known Subclasses:
FontParameter, ShaderParameter

public class StyleParameter<T>
extends ChoiceParameter<T>

ChoiceParameter subclass suitable for use with plotting style configuration. Adds a few useful customisations.

Since:
8 Aug 2008
Author:
Mark Taylor

Field Summary
 
Fields inherited from class uk.ac.starlink.task.Parameter
BY_NAME
 
Constructor Summary
StyleParameter(String name, Class<T> clazz)
          Constructs a StyleParameter without initialising any options.
StyleParameter(String name, T[] options)
          Constructs a StyleParameter with a given list of options.
 
Method Summary
 String getOptionList()
          Returns a formatted XML string giving an unordered list of the options for this parameter.
 String getUsage()
          Returns a usage message.
 void setUsage(String usage)
          Sets a usage string for this parameter.
 String stringifyOption(T option)
          Determines how an option will be represented as a string value of this parameter if no name has explicitly been supplied.
 
Methods inherited from class uk.ac.starlink.task.ChoiceParameter
addOption, addOption, clearOptions, getName, getOption, getOptionNames, getOptions, getOptionValueList, objectToString, setDefaultOption, stringToObject
 
Methods inherited from class uk.ac.starlink.task.Parameter
clearValue, getDescription, getName, getPosition, getPreferExplicit, getPrompt, getStringDefault, getValueClass, isNullPermitted, objectValue, setDescription, setDescription, setName, setNullPermitted, setPosition, setPreferExplicit, setPrompt, setStringDefault, setValue, setValueFromObject, setValueFromString, stringValue, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StyleParameter

public StyleParameter(String name,
                      T[] options)
Constructs a StyleParameter with a given list of options.

Parameters:
name - parameter name
options - list of options

StyleParameter

public StyleParameter(String name,
                      Class<T> clazz)
Constructs a StyleParameter without initialising any options.

Parameters:
name - parameter name
Method Detail

setUsage

public void setUsage(String usage)
Description copied from class: Parameter
Sets a usage string for this parameter. This should be terse (in particular no newline characters) and conform to the following rules: The Parameter class uses the string "<value>" as the default usage string.

Overrides:
setUsage in class ChoiceParameter<T>
Parameters:
usage - usage string

getUsage

public String getUsage()
Description copied from class: ChoiceParameter
Returns a usage message. Unless it has been overriden by an earlier call to ChoiceParameter.setUsage(java.lang.String), this will return a usage message based on the list of known options.

Overrides:
getUsage in class ChoiceParameter<T>
Returns:
usage message
See Also:
Parameter.setUsage(java.lang.String)

getOptionList

public String getOptionList()
Returns a formatted XML string giving an unordered list of the options for this parameter. Suitable for insertion into a parameter description. Not enclosed in a <p> element.

Returns:
option list XML string

stringifyOption

public String stringifyOption(T option)
Description copied from class: ChoiceParameter
Determines how an option will be represented as a string value of this parameter if no name has explicitly been supplied. The default implementation is String.valueOf(option), but this may be overrridden.

Overrides:
stringifyOption in class ChoiceParameter<T>
Parameters:
option - option value
Returns:
string representation of option


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.