org.eclipse.emf.mint.util
Class GroupAdapterImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.eclipse.emf.mint.util.GroupAdapterImpl
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal

public abstract class GroupAdapterImpl
extends org.eclipse.emf.common.notify.impl.AdapterImpl

Adapter for tracking changes to a group of related objects. Each time a related object is added to the group (typically through a reference), changes to its features are tracked and notifications forwarded to registered listeners. This is particularly useful when an object's derived feature depends on a feature that belongs to one of its referenced objects.

Clients may extend this class.


Nested Class Summary
protected static class GroupAdapterImpl.NotifierEList
          Simple list for tracking notifiers.
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
protected  GroupAdapterImpl.NotifierEList targets
          Tracked targets (the group).
 
Fields inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
target
 
Constructor Summary
GroupAdapterImpl()
           
 
Method Summary
protected  void addGroupTargets(java.util.List<? extends org.eclipse.emf.common.notify.Notifier> groupTargets)
          Adds the given targets to the group of tracked targets.
 void dispose()
          Disposes the adapter by removing itself from all its targets.
protected abstract  java.util.List<org.eclipse.emf.ecore.EReference> getGroupReferences(org.eclipse.emf.ecore.EObject object)
          Returns the object's references that define its direct relations.
protected  java.util.List<org.eclipse.emf.ecore.EObject> getGroupTargets(org.eclipse.emf.ecore.EObject object)
          Returns the object's direct relations.
protected  org.eclipse.emf.common.notify.Notifier getRootTarget()
          Returns the group's root object.
protected  boolean isGroupReference(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EReference ref)
          Determines whether the object's reference participates in defining its relations.
 void notifyChanged(org.eclipse.emf.common.notify.Notification msg)
           
protected  void removeGroupTargets(java.util.List<? extends org.eclipse.emf.common.notify.Notifier> groupTargets)
          Removes the targets from the group of tracked targets.
 void setTarget(org.eclipse.emf.common.notify.Notifier target)
           
 void unsetTarget(org.eclipse.emf.common.notify.Notifier target)
           
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, isAdapterForType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targets

protected GroupAdapterImpl.NotifierEList targets
Tracked targets (the group).

Constructor Detail

GroupAdapterImpl

public GroupAdapterImpl()
Method Detail

setTarget

public void setTarget(org.eclipse.emf.common.notify.Notifier target)
Specified by:
setTarget in interface org.eclipse.emf.common.notify.Adapter
Overrides:
setTarget in class org.eclipse.emf.common.notify.impl.AdapterImpl

unsetTarget

public void unsetTarget(org.eclipse.emf.common.notify.Notifier target)
Specified by:
unsetTarget in interface org.eclipse.emf.common.notify.Adapter.Internal
Overrides:
unsetTarget in class org.eclipse.emf.common.notify.impl.AdapterImpl

dispose

public void dispose()
Disposes the adapter by removing itself from all its targets.


notifyChanged

public void notifyChanged(org.eclipse.emf.common.notify.Notification msg)
Specified by:
notifyChanged in interface org.eclipse.emf.common.notify.Adapter
Overrides:
notifyChanged in class org.eclipse.emf.common.notify.impl.AdapterImpl

addGroupTargets

protected void addGroupTargets(java.util.List<? extends org.eclipse.emf.common.notify.Notifier> groupTargets)
Adds the given targets to the group of tracked targets.

Parameters:
groupTargets - new targets to track

removeGroupTargets

protected void removeGroupTargets(java.util.List<? extends org.eclipse.emf.common.notify.Notifier> groupTargets)
Removes the targets from the group of tracked targets.

Parameters:
groupTargets - targets to remove from the group

getGroupTargets

protected java.util.List<org.eclipse.emf.ecore.EObject> getGroupTargets(org.eclipse.emf.ecore.EObject object)
Returns the object's direct relations.

Parameters:
object - object whose direct relations to return
Returns:
object's direct relations

isGroupReference

protected boolean isGroupReference(org.eclipse.emf.ecore.EObject object,
                                   org.eclipse.emf.ecore.EReference ref)
Determines whether the object's reference participates in defining its relations.

Parameters:
object - object
ref - object's reference
Returns:
true if the given reference contributes its direct relations

getGroupReferences

protected abstract java.util.List<org.eclipse.emf.ecore.EReference> getGroupReferences(org.eclipse.emf.ecore.EObject object)
Returns the object's references that define its direct relations.

Parameters:
object - object whose references to return
Returns:
object's references that define its direct relations

getRootTarget

protected org.eclipse.emf.common.notify.Notifier getRootTarget()
Returns the group's root object.

Returns:
the group's root object

Copyright 2008 Ecliptical Software Inc. and others.
All Rights Reserved.