org.eclipse.emf.edit.provider
Class DecoratorAdapterFactory

java.lang.Object
  extended by org.eclipse.emf.edit.provider.DecoratorAdapterFactory
All Implemented Interfaces:
AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable
Direct Known Subclasses:
MappingEditor.MyDecoratorAdapterFactory

public abstract class DecoratorAdapterFactory
extends java.lang.Object
implements AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable

This abstract class provides support for creating IItemProviderDecorators for the adapters created by another AdapterFactory.


Field Summary
protected  ChangeNotifier changeNotifier
          This keeps track of all the Viewers.
protected  AdapterFactory decoratedAdapterFactory
          This keeps the AdapterFactory being decorated.
protected  java.util.HashMap<java.lang.Object,IItemProviderDecorator> itemProviderDecorators
           
protected  ComposedAdapterFactory parentAdapterFactory
          This is used to implement the ComposeableAdapterFactory interface.
 
Constructor Summary
DecoratorAdapterFactory(AdapterFactory decoratedAdapterFactory)
          This creates an instance that decorates the adapters from the given adapter factory.
 
Method Summary
 Adapter adapt(Notifier target, java.lang.Object type)
          This delegates to adapt(Object,Object)
 java.lang.Object adapt(java.lang.Object target, java.lang.Object type)
          All adapter creation is delegated to this method, which yields decorated item providers.
 void adaptAllNew(Notifier target)
          Creates a new associated adapter of each type of adapter supported by this factory, as necessary.
 Adapter adaptNew(Notifier target, java.lang.Object type)
          This interface is not support; an exception will be thrown.
 void addListener(INotifyChangedListener notifyChangedListener)
          This adds another listener.
protected abstract  IItemProviderDecorator createItemProviderDecorator(java.lang.Object target, java.lang.Object Type)
          This is called when a new decorator is needed by adapt(Object,Object).
 void dispose()
          This is called to dispose the object.
 void fireNotifyChanged(Notification notification)
          This calls notifyChanged for each listener.
 AdapterFactory getDecoratedAdapterFactory()
          This returns the adapter factory whose adapters are being decorated.
 ComposeableAdapterFactory getRootAdapterFactory()
          This returns the root adapter factory that delegates to this factory.
 boolean isFactoryForType(java.lang.Object type)
          This just delegates to the decoratedAdapterFactory.
 void removeListener(INotifyChangedListener notifyChangedListener)
          This removes a listener.
 void setDecoratedAdapterFactory(AdapterFactory decoratedAdapterFactory)
          This sets the adapter factory whose adapters will be decorated.
 void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
          This sets the direct parent adapter factory into which this factory is composed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

itemProviderDecorators

protected java.util.HashMap<java.lang.Object,IItemProviderDecorator> itemProviderDecorators

decoratedAdapterFactory

protected AdapterFactory decoratedAdapterFactory
This keeps the AdapterFactory being decorated.


parentAdapterFactory

protected ComposedAdapterFactory parentAdapterFactory
This is used to implement the ComposeableAdapterFactory interface.


changeNotifier

protected ChangeNotifier changeNotifier
This keeps track of all the Viewers.

Constructor Detail

DecoratorAdapterFactory

public DecoratorAdapterFactory(AdapterFactory decoratedAdapterFactory)
This creates an instance that decorates the adapters from the given adapter factory.

Method Detail

isFactoryForType

public boolean isFactoryForType(java.lang.Object type)
This just delegates to the decoratedAdapterFactory.

Specified by:
isFactoryForType in interface AdapterFactory
Parameters:
type - the key indicating the type of adapter in question.
Returns:
whether this factory supports adapters for the given type.
See Also:
Adapter.isAdapterForType(java.lang.Object)

getDecoratedAdapterFactory

public AdapterFactory getDecoratedAdapterFactory()
This returns the adapter factory whose adapters are being decorated.


setDecoratedAdapterFactory

public void setDecoratedAdapterFactory(AdapterFactory decoratedAdapterFactory)
This sets the adapter factory whose adapters will be decorated.


createItemProviderDecorator

protected abstract IItemProviderDecorator createItemProviderDecorator(java.lang.Object target,
                                                                      java.lang.Object Type)
This is called when a new decorator is needed by adapt(Object,Object).


adapt

public java.lang.Object adapt(java.lang.Object target,
                              java.lang.Object type)
All adapter creation is delegated to this method, which yields decorated item providers. It hooks up the decorators created by createItemProviderDecorator(java.lang.Object, java.lang.Object) to the adapters returned by decoratedAdapterFactory.

Specified by:
adapt in interface AdapterFactory
Parameters:
target - arbitrary object to adapt.
type - the key indicating the type of adapter required.
Returns:
either an associated adapter or the object itself.

adapt

public Adapter adapt(Notifier target,
                     java.lang.Object type)
This delegates to adapt(Object,Object)

Specified by:
adapt in interface AdapterFactory
Parameters:
target - the notifier to adapt.
type - the key indicating the type of adapter required.
Returns:
an associated adapter.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier), AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)

adaptNew

public Adapter adaptNew(Notifier target,
                        java.lang.Object type)
This interface is not support; an exception will be thrown.

Specified by:
adaptNew in interface AdapterFactory
Parameters:
target - the notifier to adapt.
type - the key indicating the type of adapter required.
Returns:
a new associated adapter.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier), Notifier.eAdapters()

adaptAllNew

public void adaptAllNew(Notifier target)
Description copied from interface: AdapterFactory
Creates a new associated adapter of each type of adapter supported by this factory, as necessary. This is typically used to adapt newly created objects.

Specified by:
adaptAllNew in interface AdapterFactory
Parameters:
target - notifier to adapt.
See Also:
AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)

getRootAdapterFactory

public ComposeableAdapterFactory getRootAdapterFactory()
This returns the root adapter factory that delegates to this factory.

Specified by:
getRootAdapterFactory in interface ComposeableAdapterFactory

setParentAdapterFactory

public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
This sets the direct parent adapter factory into which this factory is composed.

Specified by:
setParentAdapterFactory in interface ComposeableAdapterFactory

addListener

public void addListener(INotifyChangedListener notifyChangedListener)
Description copied from interface: IChangeNotifier
This adds another listener.

Specified by:
addListener in interface IChangeNotifier

removeListener

public void removeListener(INotifyChangedListener notifyChangedListener)
Description copied from interface: IChangeNotifier
This removes a listener.

Specified by:
removeListener in interface IChangeNotifier

fireNotifyChanged

public void fireNotifyChanged(Notification notification)
Description copied from interface: IChangeNotifier
This calls notifyChanged for each listener.

Specified by:
fireNotifyChanged in interface IChangeNotifier

dispose

public void dispose()
Description copied from interface: IDisposable
This is called to dispose the object.

Specified by:
dispose in interface IDisposable

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