edu.cs.ai.kreator.control.config
Class StringSelectionConfigurationOption

java.lang.Object
  extended by edu.cs.ai.kreator.control.config.ConfigurationObject
      extended by edu.cs.ai.kreator.control.config.ConfigurationOption
          extended by edu.cs.ai.kreator.control.config.StringSelectionConfigurationOption
Direct Known Subclasses:
AliasStringSelectionConfigurationOption, LoggingLevelStringSelectionConfigurationOption

public class StringSelectionConfigurationOption
extends ConfigurationOption

This class represents a string selection configuration option, i.e. an option with a single string as value, which can only be chosen from a fixed set of strings.

Author:
Matthias Thimm

Field Summary
protected  java.util.List<java.lang.String> selectableValues
          The list of selectable values for this option.
 
Fields inherited from class edu.cs.ai.kreator.control.config.ConfigurationOption
REQUIRES_NO_RESTART, REQUIRES_RESTART
 
Fields inherited from class edu.cs.ai.kreator.control.config.ConfigurationObject
IS_EDITABLE, IS_INVISIBLE, IS_NOT_EDITABLE, IS_VISIBLE, PATHCAPTION_DELIMITER, PATHID_DELIMITER
 
Constructor Summary
StringSelectionConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description)
           
StringSelectionConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int requiresRestart)
           
StringSelectionConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int visible, int editable)
           
StringSelectionConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int visible, int editable, int requiresRestart)
           
 
Method Summary
 void addSelectableValue(java.lang.String value)
          Adds a new selectable value to this option.
 java.util.List<java.lang.String> getSelectableValues()
          Returns the list of selectable values for this option.
 boolean isValid(java.lang.Object value)
          Checks whether the given value object is valid for this option.
 java.lang.Object parseValue(java.lang.String value)
          Parses the given value (read from the XML) into a usable format appropriate for usage.
 java.lang.String writeValue(java.lang.Object value)
          Translates the given value to a string appropriate to be saved in the XML.
 
Methods inherited from class edu.cs.ai.kreator.control.config.ConfigurationOption
getDefaultValue, hasDefaultValue, requiresRestart, setDefaultValue
 
Methods inherited from class edu.cs.ai.kreator.control.config.ConfigurationObject
getCaption, getDescription, getId, getParent, getPathCaption, getPathId, hasParent, isEditable, isVisible, setParent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

selectableValues

protected java.util.List<java.lang.String> selectableValues
The list of selectable values for this option.

Constructor Detail

StringSelectionConfigurationOption

public StringSelectionConfigurationOption(java.lang.String id,
                                          java.lang.String caption,
                                          java.lang.String description)

StringSelectionConfigurationOption

public StringSelectionConfigurationOption(java.lang.String id,
                                          java.lang.String caption,
                                          java.lang.String description,
                                          int visible,
                                          int editable)

StringSelectionConfigurationOption

public StringSelectionConfigurationOption(java.lang.String id,
                                          java.lang.String caption,
                                          java.lang.String description,
                                          int requiresRestart)

StringSelectionConfigurationOption

public StringSelectionConfigurationOption(java.lang.String id,
                                          java.lang.String caption,
                                          java.lang.String description,
                                          int visible,
                                          int editable,
                                          int requiresRestart)
Method Detail

addSelectableValue

public void addSelectableValue(java.lang.String value)
Adds a new selectable value to this option.

Parameters:
value - a string.

getSelectableValues

public java.util.List<java.lang.String> getSelectableValues()
Returns the list of selectable values for this option.

Returns:
the list of selectable values for this option.

isValid

public boolean isValid(java.lang.Object value)
Description copied from class: ConfigurationOption
Checks whether the given value object is valid for this option.

Specified by:
isValid in class ConfigurationOption
Parameters:
value - a value.
Returns:
"TRUE" if the given value is valid for this option.

parseValue

public java.lang.Object parseValue(java.lang.String value)
                            throws java.lang.IllegalArgumentException
Description copied from class: ConfigurationOption
Parses the given value (read from the XML) into a usable format appropriate for usage. NOTE: This is the inverse to ConfigurationOption#writeValue(java.langObject)

Specified by:
parseValue in class ConfigurationOption
Parameters:
value - a value as string.
Returns:
the option's value in an appropriate format.
Throws:
java.lang.IllegalArgumentException - if the string could not be parsed.

writeValue

public java.lang.String writeValue(java.lang.Object value)
                            throws java.lang.IllegalArgumentException
Description copied from class: ConfigurationOption
Translates the given value to a string appropriate to be saved in the XML. This method should only be invoked on a value if ConfigurationOption#isValid(java.lang.Object) verified the validity of the value. NOTE: This is the inverse to ConfigurationOption#parseValue(java.lang.String)

Specified by:
writeValue in class ConfigurationOption
Parameters:
value - a value of this option.
Returns:
a string representation of the value.
Throws:
java.lang.IllegalArgumentException - if the value does not conform to this option.