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

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.StringListConfigurationOption
              extended by edu.cs.ai.kreator.control.config.PathListConfigurationOption

public class PathListConfigurationOption
extends StringListConfigurationOption

This class represents a path list configuration option, i.e. an option with a list of paths as value.

Author:
Matthias Thimm, Adam Chachaj

Field Summary
static org.apache.log4j.Logger LOG
           
 
Fields inherited from class edu.cs.ai.kreator.control.config.StringListConfigurationOption
STRING_DELIMITER
 
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
PathListConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description)
           
PathListConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int requiresRestart)
           
PathListConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int visible, int editable)
           
PathListConfigurationOption(java.lang.String id, java.lang.String caption, java.lang.String description, int visible, int editable, int requiresRestart)
           
 
Method Summary
 javax.swing.filechooser.FileFilter getFileFilter()
          Returns the file filter of this option.
 boolean getMultiSelectionEnabled()
          Checks whether the selection of multiples files is allowed.
 int getType()
          Returns the type of the paths (one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES)
 boolean hasFileFilter()
          Checks whether this option comes with a file filter.
 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.
 void setFileFilter(javax.swing.filechooser.FileFilter fileFilter)
          Sets the file filter for this option.
 void setMultiSelectionEnabled(boolean multiSelectionEnabled)
          Sets the selection mode.
 void setType(int type)
          Sets the type of paths (one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES)
 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

LOG

public static final org.apache.log4j.Logger LOG
Constructor Detail

PathListConfigurationOption

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

PathListConfigurationOption

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

PathListConfigurationOption

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

PathListConfigurationOption

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

setFileFilter

public void setFileFilter(javax.swing.filechooser.FileFilter fileFilter)
Sets the file filter for this option.

Parameters:
fileFilter - a file filter.

hasFileFilter

public boolean hasFileFilter()
Checks whether this option comes with a file filter.

Returns:
"true" iff this option comes with a file filter.

getFileFilter

public javax.swing.filechooser.FileFilter getFileFilter()
Returns the file filter of this option.

Returns:
the file filter of this option.

getMultiSelectionEnabled

public boolean getMultiSelectionEnabled()
Checks whether the selection of multiples files is allowed.

Returns:
"true" if selection of multiples files is allowed.

setMultiSelectionEnabled

public void setMultiSelectionEnabled(boolean multiSelectionEnabled)
Sets the selection mode.

Parameters:
multiSelectionEnabled - a boolean value.

setType

public void setType(int type)
Sets the type of paths (one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES)

Parameters:
type - one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES

getType

public int getType()
Returns the type of the paths (one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES)

Returns:
the type of the paths (one of JFileChooser.FILES_ONLY, JFileChooser.DIRECTORIES_ONLY, JFileChooser.FILES_AND_DIRECTORIES)

isValid

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

Overrides:
isValid in class StringListConfigurationOption
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)
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)

Overrides:
parseValue in class StringListConfigurationOption
Parameters:
value - a value as string.
Returns:
the option's value in an appropriate format.

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)

Overrides:
writeValue in class StringListConfigurationOption
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.