.
Preferably 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.
|
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)
Registers 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)
Unregisters 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 interface java.util.List |
contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray |
CMIAbstractObservableList
protected CMIAbstractObservableList()
- Constructor for CMIAbstractObservableList to be called by subclasses.
addChangeListener
public void addChangeListener(ICMIObservableListChangeListener listener)
- Description copied from interface:
ICMIObservableList
- Registers the given listener. The listener will be notified
about any modification of this list.
- Specified by:
addChangeListener in interface ICMIObservableList
- See Also:
ICMIObservableList.addChangeListener(ICMIObservableListChangeListener)
removeChangeListener
public void removeChangeListener(ICMIObservableListChangeListener listener)
- Description copied from interface:
ICMIObservableList
- Unregisters the given listener.
- Specified by:
removeChangeListener in interface ICMIObservableList
- See Also:
ICMIObservableList.removeChangeListener(ICMIObservableListChangeListener)
fireElementChanged
protected final void fireElementChanged(Object o,
int index)
- fire an element changed event for the given element and index
fireElementAdded
protected final void fireElementAdded(Object o,
int index)
- fire an element added event for the given element and index
fireElementRemoved
protected final void fireElementRemoved(Object o,
int index)
- fire an element removed event for the given element and index
fireComplexChange
protected final void fireComplexChange(int fromIndex,
int toIndex,
int type)
- fire a complex change event of the given type
add
public void add(int index,
Object element)
- Specified by:
add in interface List- Overrides:
add in class AbstractList
- See Also:
List.add(int, Object)
add
public boolean add(Object o)
- Specified by:
add in interface Collection- Specified by:
add in interface List- Overrides:
add in class AbstractList
- See Also:
Collection.add(Object)
addAll
public boolean addAll(Collection c)
- Specified by:
addAll in interface Collection- Specified by:
addAll in interface List- Overrides:
addAll in class AbstractCollection
- See Also:
Collection.addAll(Collection)
addAll
public boolean addAll(int index,
Collection c)
- Specified by:
addAll in interface List- Overrides:
addAll in class AbstractList
- See Also:
List.addAll(int, Collection)
clear
public void clear()
- Specified by:
clear in interface Collection- Specified by:
clear in interface List- Overrides:
clear in class AbstractList
- See Also:
Collection.clear()
remove
public Object remove(int index)
- Specified by:
remove in interface List- Overrides:
remove in class AbstractList
- See Also:
List.remove(int)
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection- Specified by:
remove in interface List- Overrides:
remove in class AbstractCollection
- See Also:
Collection.remove(Object)
removeRange
protected void removeRange(int fromIndex,
int toIndex)
- Overrides:
removeRange in class AbstractList
removeAll
public boolean removeAll(Collection c)
- Specified by:
removeAll in interface Collection- Specified by:
removeAll in interface List- Overrides:
removeAll in class AbstractCollection
- See Also:
Collection.removeAll(Collection)
retainAll
public boolean retainAll(Collection c)
- Specified by:
retainAll in interface Collection- Specified by:
retainAll in interface List- Overrides:
retainAll in class AbstractCollection
- See Also:
Collection.retainAll(Collection)
set
public Object set(int index,
Object element)
- Specified by:
set in interface List- Overrides:
set in class AbstractList
- See Also:
List.set(int, Object)
setSilently
public Object setSilently(int index,
Object element)
addSilently
public void addSilently(int index,
Object element)
removeSilently
public Object removeSilently(int index)
addAllSilently
public int addAllSilently(int index,
Collection c)
removeRangeSilently
public void removeRangeSilently(int fromIndex,
int toIndex)
This class can be accessed from:
|
SC
|
DC
|
[sap.com] FRAMEWORK
|
[sap.com] tc/cmi
|
[sap.com] FRAMEWORK
|
[sap.com] tc/cm/ejb/api
|
Copyright 2010 SAP AG Complete Copyright Notice