|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<MTJRuntime>
org.eclipse.mtj.core.project.runtime.MTJRuntimeList
public class MTJRuntimeList
This class is used to maintains the list of runtimes for MTJ project. Each
MTJ project have one instance of this class. We retrieve the instance by
IMTJProject.getRuntimeList()
.
Each MTJRuntimeList is stored in the metadata file available in the project
this list belongs to.
Bellow is a sample on the structure of a MTJRuntimeList stored in a metadata
file.
<configurations> <configuration active="true" name="Config1"> ... </configuration> <configuration active="false" name="Config2"> ... </configuration> <configuration active="false" name="Config3"> ... </configuration> </configurations>
MTJRuntime
,
Serialized FormField Summary | |
---|---|
static String |
ELEM_CONFIGURATIONS
The metadata element for storing the list of runtimes. |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
MTJRuntimeList()
Creates a new instance of MTJRuntimeList. |
|
MTJRuntimeList(Element runtimeListElement)
Creates a new MTJRuntimeList from the metadata available in the project holding this list of runtimes. |
Method Summary | |
---|---|
boolean |
add(MTJRuntime runtime)
Appends the specified MTJRuntime to the end of this list. |
boolean |
addAll(Collection<? extends MTJRuntime> runtimes)
Appends all of the MTJRuntimes in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. |
void |
addMTJRuntimeListChangeListener(IMTJRuntimeListChangeListener listener)
Adds the listener to the collection of listeners who will be notified when the runtime list state changes. |
MTJRuntime |
getActiveMTJRuntime()
Get the MTJRuntime that is currently active. |
boolean |
remove(Object o)
Removes a single instance of the specified MTJRuntime from this list, if it is present. |
boolean |
removeAll(Collection<?> runtimes)
Removes from this collection all of its MTJRuntimes that are contained in the specified collection. |
void |
removeMTJRuntimeListChangeListener(IMTJRuntimeListChangeListener listener)
Removes the listener from the collection of listeners who will be notified when the runtime state changes. |
void |
switchActiveMTJRuntime(MTJRuntime runtime)
Switch the current active MTJRuntime. |
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 |
---|
public static final String ELEM_CONFIGURATIONS
Constructor Detail |
---|
public MTJRuntimeList()
public MTJRuntimeList(Element runtimeListElement) throws PersistenceException
We try to read the runtimes from the DOM element retrieved from the project metadata and put them into the runtime list.
runtimeListElement
- The DOM element containing the runtime data
(the ELEM_CONFIGURATIONS
XML element).
PersistenceException
- if fails to create a runtime persisted in
the metadata.Method Detail |
---|
public boolean add(MTJRuntime runtime)
This method notifies all listeners after adding the MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeAdded(AddMTJRuntimeEvent)
.
add
in interface Collection<MTJRuntime>
add
in interface List<MTJRuntime>
add
in class ArrayList<MTJRuntime>
runtime
- MTJRuntime to be appended to this list.
ArrayList.add(java.lang.Object)
public boolean addAll(Collection<? extends MTJRuntime> runtimes) throws NullPointerException
This method notifies all listeners after adding each MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeAdded(AddMTJRuntimeEvent)
.
addAll
in interface Collection<MTJRuntime>
addAll
in interface List<MTJRuntime>
addAll
in class ArrayList<MTJRuntime>
runtimes
- the MTJRuntimes to be inserted into this list.
NullPointerException
- if the specified collection is
null
.ArrayList.addAll(java.util.Collection)
public void addMTJRuntimeListChangeListener(IMTJRuntimeListChangeListener listener)
IMTJRuntimeListChangeListener
interface.
listener
- the listener that should be notified when the state of
the runtime list changes.public MTJRuntime getActiveMTJRuntime()
If no runtime is active this method will return null
.
null
in
no active runtime could be found.public boolean remove(Object o)
This method notifies all listeners after removing the MTJRuntime, through
the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeRemoved(RemoveMTJRuntimeEvent)
.
remove
in interface Collection<MTJRuntime>
remove
in interface List<MTJRuntime>
remove
in class ArrayList<MTJRuntime>
o
- MTJRuntime to be removed from this list, if present.
ArrayList.remove(java.lang.Object)
public boolean removeAll(Collection<?> runtimes)
This method notifies all listeners after removing each MTJRuntime,
through the invocation of
IMTJRuntimeListChangeListener.mtjRuntimeRemoved(RemoveMTJRuntimeEvent)
.
removeAll
in interface Collection<MTJRuntime>
removeAll
in interface List<MTJRuntime>
removeAll
in class AbstractCollection<MTJRuntime>
runtimes
- MTJRuntimes to be removed from this collection.
NullPointerException
- if the specified collection is
null
.AbstractCollection.removeAll(java.util.Collection)
public void removeMTJRuntimeListChangeListener(IMTJRuntimeListChangeListener listener)
Note:Since instance of MTJRuntime have a long life cycle (as long as the MTJ project), clients should remove listener manually when it no longer used.
listener
- the listener that should no longer be notified when the
state of the runtime list changes.public void switchActiveMTJRuntime(MTJRuntime runtime)
runtime
- MTJRuntime to be set as the active one.
|
Mobile Tools for Java Release 1.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |