org.eclipse.emf.test.models.tree.provider
Class TreeItemProviderAdapterFactory

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterFactoryImpl
      extended by org.eclipse.emf.test.models.tree.util.TreeAdapterFactory
          extended by org.eclipse.emf.test.models.tree.provider.TreeItemProviderAdapterFactory
All Implemented Interfaces:
AdapterFactory, ComposeableAdapterFactory, IChangeNotifier, IDisposable

public class TreeItemProviderAdapterFactory
extends TreeAdapterFactory
implements ComposeableAdapterFactory, IChangeNotifier, IDisposable

This is the factory that is used to provide the interfaces needed to support Viewers. The adapters generated by this factory convert EMF adapter notifications into calls to fireNotifyChanged. The adapters also support Eclipse property sheets. Note that most of the adapters are shared among multiple instances.


Field Summary
protected  IChangeNotifier changeNotifier
          This is used to implement IChangeNotifier
protected  DataItemProvider dataItemProvider
          This keeps track of the one adapter used for all Data instances
protected  NodeItemProvider nodeItemProvider
          This keeps track of the one adapter used for all Node instances
protected  ComposedAdapterFactory parentAdapterFactory
          This keeps track of the root adapter factory that delegates to this adapter factory
protected  java.util.Collection<java.lang.Object> supportedTypes
          This keeps track of all the supported types checked by isFactoryForType
 
Fields inherited from class org.eclipse.emf.test.models.tree.util.TreeAdapterFactory
modelPackage, modelSwitch
 
Constructor Summary
TreeItemProviderAdapterFactory()
          This constructs an instance
 
Method Summary
 Adapter adapt(Notifier notifier, java.lang.Object type)
          This implementation substitutes the factory itself as the key for the adapter
 java.lang.Object adapt(java.lang.Object object, java.lang.Object type)
           
 void addListener(INotifyChangedListener notifyChangedListener)
          This adds a listener
 Adapter createDataAdapter()
          This creates an adapter for a Data
 Adapter createNodeAdapter()
          This creates an adapter for a Node
 void dispose()
          This disposes all of the item providers created by this factory
 void fireNotifyChanged(Notification notification)
          This delegates to changeNotifier and to parentAdapterFactory
 ComposeableAdapterFactory getRootAdapterFactory()
          This returns the root adapter factory that contains this factory
 boolean isFactoryForType(java.lang.Object type)
           
 void removeListener(INotifyChangedListener notifyChangedListener)
          This removes a listener
 void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
          This sets the composed adapter factory that contains this factory
 
Methods inherited from class org.eclipse.emf.test.models.tree.util.TreeAdapterFactory
createAdapter, createEObjectAdapter
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterFactoryImpl
adaptAllNew, adaptNew, associate, createAdapter, resolve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.notify.AdapterFactory
adaptAllNew, adaptNew
 

Field Detail

parentAdapterFactory

protected ComposedAdapterFactory parentAdapterFactory
This keeps track of the root adapter factory that delegates to this adapter factory.


changeNotifier

protected IChangeNotifier changeNotifier
This is used to implement IChangeNotifier.


supportedTypes

protected java.util.Collection<java.lang.Object> supportedTypes
This keeps track of all the supported types checked by isFactoryForType.


nodeItemProvider

protected NodeItemProvider nodeItemProvider
This keeps track of the one adapter used for all Node instances.


dataItemProvider

protected DataItemProvider dataItemProvider
This keeps track of the one adapter used for all Data instances.

Constructor Detail

TreeItemProviderAdapterFactory

public TreeItemProviderAdapterFactory()
This constructs an instance.

Method Detail

createNodeAdapter

public Adapter createNodeAdapter()
This creates an adapter for a Node.

Overrides:
createNodeAdapter in class TreeAdapterFactory
Returns:
the new adapter.
See Also:
Node

createDataAdapter

public Adapter createDataAdapter()
This creates an adapter for a Data.

Overrides:
createDataAdapter in class TreeAdapterFactory
Returns:
the new adapter.
See Also:
Data

getRootAdapterFactory

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

Specified by:
getRootAdapterFactory in interface ComposeableAdapterFactory

setParentAdapterFactory

public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory)
This sets the composed adapter factory that contains this factory.

Specified by:
setParentAdapterFactory in interface ComposeableAdapterFactory

isFactoryForType

public boolean isFactoryForType(java.lang.Object type)

Specified by:
isFactoryForType in interface AdapterFactory
Overrides:
isFactoryForType in class TreeAdapterFactory
Parameters:
type - the key indicating the type of adapter in question.
Returns:
whether this factory is applicable for the type of the object.
See Also:
Adapter.isAdapterForType(java.lang.Object)

adapt

public Adapter adapt(Notifier notifier,
                     java.lang.Object type)
This implementation substitutes the factory itself as the key for the adapter.

Specified by:
adapt in interface AdapterFactory
Overrides:
adapt in class AdapterFactoryImpl
Parameters:
notifier - the notifier to adapt.
type - the key indicating the type of adapter required.
Returns:
a previously existing associated adapter, a new associated adapter if possible, or null otherwise.
See Also:
Adapter.setTarget(org.eclipse.emf.common.notify.Notifier), AdapterFactory.adaptNew(org.eclipse.emf.common.notify.Notifier, java.lang.Object)

adapt

public java.lang.Object adapt(java.lang.Object object,
                              java.lang.Object type)

Specified by:
adapt in interface AdapterFactory
Overrides:
adapt in class AdapterFactoryImpl
Parameters:
object - arbitrary object to adapt.
type - the key indicating the type of adapter required.
Returns:
either an associated adapter or the object itself.
See Also:
AdapterFactoryImpl.adapt(Notifier,Object), AdapterFactoryImpl.resolve(Object, Object)

addListener

public void addListener(INotifyChangedListener notifyChangedListener)
This adds a listener.

Specified by:
addListener in interface IChangeNotifier

removeListener

public void removeListener(INotifyChangedListener notifyChangedListener)
This removes a listener.

Specified by:
removeListener in interface IChangeNotifier

fireNotifyChanged

public void fireNotifyChanged(Notification notification)
This delegates to changeNotifier and to parentAdapterFactory.

Specified by:
fireNotifyChanged in interface IChangeNotifier

dispose

public void dispose()
This disposes all of the item providers created by this factory.

Specified by:
dispose in interface IDisposable

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