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

java.lang.Object
  extended by edu.cs.ai.kreator.control.config.ConfigurationObject
      extended by edu.cs.ai.kreator.control.config.ConfigurationCategory
Direct Known Subclasses:
StyleConfigurationCategory

public class ConfigurationCategory
extends ConfigurationObject

This class encapsulates a set of configuration options (and maybe a set of sub-categories) under a common category.

Author:
Matthias Thimm

Field Summary
 
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
ConfigurationCategory(java.lang.String id, java.lang.String caption, java.lang.String description)
          Creates a new configuration category with the given caption and id, empty sub-categories, and empty options that is both visible and editable.
ConfigurationCategory(java.lang.String id, java.lang.String caption, java.lang.String description, int visible, int editable)
          Creates a new configuration category with the given caption,the given visibility, and the given editibility, empty sub-categories.
 
Method Summary
 void add(ConfigurationObject obj)
          Adds a new configuration object (either a configuration option or a configuration category) to this configuration category.
 void addOption(ConfigurationOption option)
          Adds the given configuration option to this configuration category.
 void addSubCategory(ConfigurationCategory subCategory)
          Adds the given configuration category as a subcategory to this configuration category.
 java.util.List<ConfigurationOption> getAllOptions()
          Returns all options contained in the sub-tree spanned by this configuration category.
 java.util.List<ConfigurationCategory> getAllSubCategories()
          Returns all categories contained in the sub-tree spanned by this configuration category.
 java.util.List<ConfigurationOption> getOptions()
          Returns the options of this configuration category.
 java.util.List<ConfigurationCategory> getSubCategories()
          Returns the sub-categories of this configuration category.
 
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
 

Constructor Detail

ConfigurationCategory

public ConfigurationCategory(java.lang.String id,
                             java.lang.String caption,
                             java.lang.String description)
Creates a new configuration category with the given caption and id, empty sub-categories, and empty options that is both visible and editable.

Parameters:
id - The id of this category.
caption - The caption of this category
description - The description of this configuration category.

ConfigurationCategory

public ConfigurationCategory(java.lang.String id,
                             java.lang.String caption,
                             java.lang.String description,
                             int visible,
                             int editable)
Creates a new configuration category with the given caption,the given visibility, and the given editibility, empty sub-categories.

Parameters:
id - The id of this configuration category.
caption - The caption of this configuration category.
description - The description of this configuration category.
visible - whether this configuration category is visible (one of ConfigurationObject.IS_VISIBLE, ConfigurationObject.IS_INVISIBLE)..
editable - whether this configuration category is editable (one of ConfigurationObject.IS_EDITABLE, ConfigurationObject.IS_NOT_EDITABLE).
Method Detail

getSubCategories

public java.util.List<ConfigurationCategory> getSubCategories()
Returns the sub-categories of this configuration category.

Returns:
the sub-categories of this configuration category.

getAllSubCategories

public java.util.List<ConfigurationCategory> getAllSubCategories()
Returns all categories contained in the sub-tree spanned by this configuration category.

Returns:
a list of all sub-categories of this configuration category.

getAllOptions

public java.util.List<ConfigurationOption> getAllOptions()
Returns all options contained in the sub-tree spanned by this configuration category.

Returns:
a list of configuration options.

getOptions

public java.util.List<ConfigurationOption> getOptions()
Returns the options of this configuration category.

Returns:
the options of this configuration category.

addSubCategory

public void addSubCategory(ConfigurationCategory subCategory)
Adds the given configuration category as a subcategory to this configuration category.

Parameters:
subCategory - a configuration category.

addOption

public void addOption(ConfigurationOption option)
Adds the given configuration option to this configuration category.

Parameters:
option - a configuration option.

add

public void add(ConfigurationObject obj)
         throws java.lang.IllegalArgumentException
Adds a new configuration object (either a configuration option or a configuration category) to this configuration category.

Parameters:
obj - either a configuration option or a configuration category
Throws:
java.lang.IllegalArgumentException - if "obj" is neither a configuration option nor a configuration category.