|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
com.sap.tc.cmi.util.CMIAbstractObservableList
Abstract implementation of the ICMIObservableList interface.
This class is not at all thread safe (for peformance reasons). This implementation modifies the contract that AbstractList defines for subclasses. All modifying methods of the List interface have been overridden using the Template/Hook pattern. The template implementations delegate all changes to hook methods and afterwards send out notification events about the changes made. The hook methods only have to take care about the change itself and must not fire events. To identify them and to better reflect their behavior, the names of the hook methods end in *SilentlyPreferably subclasses should override the hook methods only as these are easier to implement. But if the template implementation of a modifying method doesn't fit, subclasses can override or extend that template method as well. If they override it, they have to implement the notification on their own. If they extend it, they must take care to inform listeners about a change after it has been completed. So calls to super typically will be the last step in an extended method.
In general, subclasses must be careful in their modifier implementations when calling other methods that potentially result in notification events. Listeners usually expect to be notified only once about a single change. To implement an unmodifiable list, subclasses have to implement the methods size() and get(int index) as introduced by AbstractList. To implement a modifiable list, subclasses can override the setSilently(int index, Object o) method. If the list is variable-size, they additionally have to override the addSilently(int index, Object element) and removeSilently(int index) methods.This type can be called or extended by applications or frameworks using CMI.
Type Classification:
This class is part of the Common Model Interface and is intended to be subclassed by applications.
| Field Summary |
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
protected |
CMIAbstractObservableList()
Constructor for CMIAbstractObservableList to be called by subclasses. |
| Method Summary | |
void |
add(int index,
Object element)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
int |
addAllSilently(int index,
Collection c)
|
void |
addChangeListener(ICMIObservableListChangeListener listener)
registeres the given listener. |
void |
addSilently(int index,
Object element)
|
void |
clear()
|
protected void |
fireComplexChange(int fromIndex,
int toIndex,
int type)
fire a complex change event of the given type |
protected void |
fireElementAdded(Object o,
int index)
fire an element added event for the given element and index |
protected void |
fireElementChanged(Object o,
int index)
fire an element changed event for the given element and index |
protected void |
fireElementRemoved(Object o,
int index)
fire an element removed event for the given element and index |
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
void |
removeChangeListener(ICMIObservableListChangeListener listener)
registeres the given listener. |
protected void |
removeRange(int fromIndex,
int toIndex)
|
void |
removeRangeSilently(int fromIndex,
int toIndex)
|
Object |
removeSilently(int index)
|
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
Object |
setSilently(int index,
Object element)
|
| Methods inherited from class java.util.AbstractList |
equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList |
| Methods inherited from class java.util.AbstractCollection |
contains, containsAll, isEmpty, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.List |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray |
| Constructor Detail |
protected CMIAbstractObservableList()
| Method Detail |
public void addChangeListener(ICMIObservableListChangeListener listener)
ICMIObservableList
addChangeListener in interface ICMIObservableListICMIObservableList.addChangeListener(ICMIObservableListChangeListener)public void removeChangeListener(ICMIObservableListChangeListener listener)
ICMIObservableList
removeChangeListener in interface ICMIObservableListICMIObservableList.removeChangeListener(ICMIObservableListChangeListener)
protected final void fireElementChanged(Object o,
int index)
protected final void fireElementAdded(Object o,
int index)
protected final void fireElementRemoved(Object o,
int index)
protected final void fireComplexChange(int fromIndex,
int toIndex,
int type)
public void add(int index,
Object element)
add in interface ListList.add(int, Object)public boolean add(Object o)
add in interface ListCollection.add(Object)public boolean addAll(Collection c)
addAll in interface ListCollection.addAll(Collection)
public boolean addAll(int index,
Collection c)
addAll in interface ListList.addAll(int, Collection)public void clear()
clear in interface ListCollection.clear()public Object remove(int index)
remove in interface ListList.remove(int)public boolean remove(Object o)
remove in interface ListCollection.remove(Object)
protected void removeRange(int fromIndex,
int toIndex)
public boolean removeAll(Collection c)
removeAll in interface ListCollection.removeAll(Collection)public boolean retainAll(Collection c)
retainAll in interface ListCollection.retainAll(Collection)
public Object set(int index,
Object element)
set in interface ListList.set(int, Object)
public Object setSilently(int index,
Object element)
public void addSilently(int index,
Object element)
public Object removeSilently(int index)
public int addAllSilently(int index,
Collection c)
public void removeRangeSilently(int fromIndex,
int toIndex)
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||