Mobile Tools for Java
Release 1.0

org.eclipse.mtj.core.model.configuration
Class Configurations

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Configuration>
              extended by org.eclipse.mtj.core.model.configuration.Configurations
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Configuration>, Collection<Configuration>, List<Configuration>, RandomAccess

public class Configurations
extends ArrayList<Configuration>

This class is used to maintains configurations for Midlet project. Each Midlet project have one instance of this class. We retrieve the instance by IMidletSuiteProject#getConfigurations().

See Also:
Serialized Form

Field Summary
static String ELEM_CONFIGURATION
          The configuration element name the meta data xml file.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Configurations()
          The constructor used for create Configurations for a Midlet project that have not yet configurations.
Configurations(Element configsElement)
          Construct Configurations from meta data XML file.
 
Method Summary
 boolean add(Configuration config)
           
 boolean addAll(Collection<? extends Configuration> configs)
           
 void addConfigsChangeListener(IConfigurationsChangeListener listener)
           
 Configuration getActiveConfiguration()
          Get the active configuration.
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> configs)
           
 void removeConfigsChangeListener(IConfigurationsChangeListener listener)
          Note:Since instance of Configurations have a long life cycle (as long as the Midlet project), so we should remove listener manually when it no longer used.
 void switchActiveConfiguration(Configuration configuration)
          Switch the current active configuration.
 
Methods inherited from class java.util.ArrayList
add, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, retainAll, subList
 

Field Detail

ELEM_CONFIGURATION

public static final String ELEM_CONFIGURATION
The configuration element name the meta data xml file.

See Also:
Constant Field Values
Constructor Detail

Configurations

public Configurations()
The constructor used for create Configurations for a Midlet project that have not yet configurations.


Configurations

public Configurations(Element configsElement)
               throws PersistenceException
Construct Configurations from meta data XML file.

Parameters:
configsElement - - The <configurations> xml element.
Throws:
PersistenceException
Method Detail

add

public boolean add(Configuration config)
Specified by:
add in interface Collection<Configuration>
Specified by:
add in interface List<Configuration>
Overrides:
add in class ArrayList<Configuration>

addAll

public boolean addAll(Collection<? extends Configuration> configs)
Specified by:
addAll in interface Collection<Configuration>
Specified by:
addAll in interface List<Configuration>
Overrides:
addAll in class ArrayList<Configuration>

addConfigsChangeListener

public void addConfigsChangeListener(IConfigurationsChangeListener listener)

getActiveConfiguration

public Configuration getActiveConfiguration()
Get the active configuration. If no active one, will return null.

Returns:

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<Configuration>
Specified by:
remove in interface List<Configuration>
Overrides:
remove in class ArrayList<Configuration>

removeAll

public boolean removeAll(Collection<?> configs)
Specified by:
removeAll in interface Collection<Configuration>
Specified by:
removeAll in interface List<Configuration>
Overrides:
removeAll in class AbstractCollection<Configuration>

removeConfigsChangeListener

public void removeConfigsChangeListener(IConfigurationsChangeListener listener)
Note:Since instance of Configurations have a long life cycle (as long as the Midlet project), so we should remove listener manually when it no longer used.

Parameters:
listener -

switchActiveConfiguration

public void switchActiveConfiguration(Configuration configuration)
Switch the current active configuration.

Parameters:
configuration - - configuration to be set as active one.

Mobile Tools for Java
Release 1.0