org.eclipse.emf.edit.provider
Class ItemProviderAdapter.ChildrenStore

java.lang.Object
  extended by org.eclipse.emf.edit.provider.ItemProviderAdapter.ChildrenStore
Enclosing class:
ItemProviderAdapter

protected static class ItemProviderAdapter.ChildrenStore
extends java.lang.Object

A ChildrenStore stores a number of objects that are to be presented as the children of an object. Each of a set of features may have either one or any number of children objects associated with it, depending on its multiplicity. The objects associated with a multiplicity-many feature are accessed and manipulated as an EList, typically mirroring the actual values of that feature, with some or all in wrappers, as necessary. The object associated with a multiplicity-1 feature is typically accessed and set directly, although a modifiable, singleton list view is available. This class provides a number of convenient methods for access by feature, as well as a method, getChildren that returns the complete collection of children from all features as an unmodifiable list.


Nested Class Summary
protected static class ItemProviderAdapter.ChildrenStore.Entry
          An Entry represents the children from a feature.
 
Field Summary
protected  ItemProviderAdapter.ChildrenStore.Entry[] entries
           
 
Constructor Summary
ItemProviderAdapter.ChildrenStore(java.util.Collection<? extends EStructuralFeature> features)
          Creates a store for the children of the given features.
 
Method Summary
 void clear()
          Clears the children of all features in the store.
 boolean contains(EStructuralFeature feature)
          Returns whether the store handles children of the specified feature.
protected  EList<java.lang.Object> createList(EStructuralFeature feature)
          Returns a list, either a full list implementation or a fixed-sized modifiable singleton list, depending on the multiplicity of the feature.
 java.lang.Object get(EStructuralFeature feature, int index)
          Returns either a single element of the specified feature or, if index is -1, the value view.
 java.util.List<java.lang.Object> getChildren()
          Returns a list containing all children of all features in the store.
protected  ItemProviderAdapter.ChildrenStore.Entry getEntry(EStructuralFeature feature)
           
 EList<java.lang.Object> getList(EStructuralFeature feature)
          Returns the list view of the specified feature, or null if the store does not handle the feature.
 int getOffset(EStructuralFeature feature)
          Returns the offset in the list returned by getChildren of given feature's children.
 java.lang.Object getValue(EStructuralFeature feature)
          Returns the value view of the specified feature.
 boolean set(EStructuralFeature feature, int index, java.lang.Object object)
          Sets either a single element of the specified feature or, if the index is -1, the value of the feature.
 boolean setValue(EStructuralFeature feature, java.lang.Object value)
          Sets the value of the specified feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entries

protected ItemProviderAdapter.ChildrenStore.Entry[] entries
Constructor Detail

ItemProviderAdapter.ChildrenStore

public ItemProviderAdapter.ChildrenStore(java.util.Collection<? extends EStructuralFeature> features)
Creates a store for the children of the given features.

Method Detail

getEntry

protected ItemProviderAdapter.ChildrenStore.Entry getEntry(EStructuralFeature feature)

createList

protected EList<java.lang.Object> createList(EStructuralFeature feature)
Returns a list, either a full list implementation or a fixed-sized modifiable singleton list, depending on the multiplicity of the feature. Before accessing an entry's list, the store should always check if it is null and if so, allocate it using this method.


contains

public boolean contains(EStructuralFeature feature)
Returns whether the store handles children of the specified feature.


getList

public EList<java.lang.Object> getList(EStructuralFeature feature)
Returns the list view of the specified feature, or null if the store does not handle the feature.


getValue

public java.lang.Object getValue(EStructuralFeature feature)
Returns the value view of the specified feature. For a single-valued feature, this is the value itself, which may be null. For a multi-valued feature, it is just the whole list.


setValue

public boolean setValue(EStructuralFeature feature,
                        java.lang.Object value)
Sets the value of the specified feature. For a multi-valued feature, the specified value is treated as a Collection, and all of its elements are added to the emptied list.


get

public java.lang.Object get(EStructuralFeature feature,
                            int index)
Returns either a single element of the specified feature or, if index is -1, the value view.


set

public boolean set(EStructuralFeature feature,
                   int index,
                   java.lang.Object object)
Sets either a single element of the specified feature or, if the index is -1, the value of the feature.


getChildren

public java.util.List<java.lang.Object> getChildren()
Returns a list containing all children of all features in the store. Null, single-valued features are excluded. The list can be freely modified without affecting the store.


getOffset

public int getOffset(EStructuralFeature feature)
Returns the offset in the list returned by getChildren of given feature's children.


clear

public void clear()
Clears the children of all features in the store. Multi-valued features are cleared, and single-valued features are set to null.


Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.