## org.eclipse.emf.edit.provider
Class ItemProviderDecorator

    java.lang.Object
      org.eclipse.emf.edit.provider.ItemProviderDecorator

All Implemented Interfaces:
  IChangeNotifier, IDisposable, IItemProviderDecorator, INotifyChangedListener

Direct Known Subclasses:
  MappedObjectItemProvider

    public class ItemProviderDecorator

extends java.lang.Object
implements INotifyChangedListener, IItemProviderDecorator, IChangeNotifier, IDisposable

This implementation provides a convenient reusable base for item providers that will be used as decorators of other item providers. Default implementations for the following interfaces are provided: `IEditingDomainItemProvider`, `IItemLabelProvider`, `IItemPropertySource`, `IStructuredItemContentProvider`, `IItemFontProvider`, `IItemColorProvider`, `ITableItemFontProvider`, `ITableItemColorProvider`, `ITableItemLabelProvider`, and `ITreeItemContentProvider`, and `IUpdateableItemText.getUpdateableText(java.lang.Object)`.

Field Summary
`protected AdapterFactory` `adapterFactory` This keeps track of the adapter factory that created this adaptor.
`protected IChangeNotifier` `changeNotifier` This is used to implement `IChangeNotifier`.
`protected IChangeNotifier` `decoratedItemProvider` This keeps track of the item provider being decorated.

Constructor Summary
`ItemProviderDecorator(AdapterFactory adapterFactory)` An instance is created from an adapter factory.

Method Summary
`void` `addListener(INotifyChangedListener listener)` This adds another listener.
`Command` `createCommand(java.lang.Object object, EditingDomain domain, java.lang.Class<? extends Command> commandClass, CommandParameter commandParameter)` This implements `IEditingDomainItemProvider.createCommand` by delegating to `(IEditingDomainItemProvider)``decoratedItemProvider`.
`void` `dispose()` This is called to dispose the object.
`void` `fireNotifyChanged(Notification notification)` This delegates to the `adapterFactory`.
`AdapterFactory` `getAdapterFactory()` This provides access to the factory.
`java.lang.Object` `getBackground(java.lang.Object object)` This implements `IItemColorProvider.getBackground` by delegating to `(IItemColorProvider)``decoratedItemProvider`.
`java.lang.Object` `getBackground(java.lang.Object object, int columnIndex)` This implements `ITableItemColorProvider.getBackground` by delegating to `(ITableItemColorProvider)``decoratedItemProvider`.
`java.util.Collection<?>` `getChildren(java.lang.Object object)` This implements `ITreeItemContentProvider.getChildren` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.
`java.lang.Object` `getColumnImage(java.lang.Object object, int columnIndex)` This implements `ITableItemLabelProvider.getColumnImage` by delegating to `(ITableItemLabelProvider)``decoratedItemProvider`.
`java.lang.String` `getColumnText(java.lang.Object object, int columnIndex)` This implements `ITableItemLabelProvider.getColumnText` by delegating to `(ITableItemLabelProvider)``decoratedItemProvider`.
`IChangeNotifier` `getDecoratedItemProvider()` This returns the item provider that this decorates.
`java.lang.Object` `getEditableValue(java.lang.Object object)` This implements `IItemPropertySource.getEditableValue` by delegating to `(IItemPropertySource)``decoratedItemProvider`.
`java.util.Collection<?>` `getElements(java.lang.Object object)` This implements `IStructuredItemContentProvider.getElements` by delegating to `(IStructuredItemContentProvider)``decoratedItemProvider`.
`java.lang.Object` `getFont(java.lang.Object object)` This implements `IItemFontProvider.getFont` by delegating to `(IItemFontProvider)``decoratedItemProvider`.
`java.lang.Object` `getFont(java.lang.Object object, int columnIndex)` This implements `ITableItemFontProvider.getFont` by delegating to `(IItemFontProvider)``decoratedItemProvider`.
`java.lang.Object` `getForeground(java.lang.Object object)` This implements `IItemColorProvider.getForeground` by delegating to `(IItemColorProvider)``decoratedItemProvider`.
`java.lang.Object` `getForeground(java.lang.Object object, int columnIndex)` This implements `ITableItemColorProvider.getForeground` by delegating to `(ITableItemColorProvider)``decoratedItemProvider`.
`java.lang.Object` `getImage(java.lang.Object object)` This implements `IItemLabelProvider.getImage` by delegating to `(IItemLabelProvider)``decoratedItemProvider`.
`java.util.Collection<?>` `getNewChildDescriptors(java.lang.Object object, EditingDomain editingDomain, java.lang.Object sibling)` This implements `IEditingDomainItemProvider.getNewChildDescriptors` by delegating to `(IEditingDomainItemProvider)``decoratedItemProvider`.
`java.lang.Object` `getParent(java.lang.Object object)` This implements `ITreeItemContentProvider.getParent` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.
`IItemPropertyDescriptor` `getPropertyDescriptor(java.lang.Object object, java.lang.Object propertyId)` This implements `IItemPropertySource.getPropertyDescriptors` by delegating to `(IItemPropertySource)``decoratedItemProvider`.
`java.util.List<IItemPropertyDescriptor>` `getPropertyDescriptors(java.lang.Object object)` This implements `IItemPropertySource.getPropertyDescriptors` by delegating to `(IItemPropertySource)``decoratedItemProvider`.
`java.lang.String` `getText(java.lang.Object object)` This implements `IItemLabelProvider.getText` by delegating to `(IItemLabelProvider)``decoratedItemProvider`.
`java.lang.String` `getUpdateableText(java.lang.Object object)` This implements `IUpdateableItemText.getUpdateableText` by delegating to `(IUpdateableItemText)``decoratedItemProvider`.
`boolean` `hasChildren(java.lang.Object object)` This implements `ITreeItemContentProvider.hasChildren` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.
`boolean` `isAdapterForType(java.lang.Object type)` This returns true, only if this adapter was created by the given factory; the adapter factory is used as the type key.
`void` `notifyChanged(Notification notification)` This will be called by the `decoratedItemProvider` when it normally fires a notification to it's adapter factory.
`void` `removeListener(INotifyChangedListener listener)` This removes a listener.
`void` `setDecoratedItemProvider(IChangeNotifier decoratedItemProvider)` This sets the item provider that this decorates; it also hooks up the `INotifyChangedListener`.
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### adapterFactory

    protected AdapterFactory adapterFactory

  This keeps track of the adapter factory that created this adaptor. It is also used as the key/type for this adapter.

### decoratedItemProvider

    protected IChangeNotifier decoratedItemProvider

  This keeps track of the item provider being decorated.

### changeNotifier

    protected IChangeNotifier changeNotifier

  This is used to implement `IChangeNotifier`.

Constructor Detail

### ItemProviderDecorator

    public ItemProviderDecorator(AdapterFactory adapterFactory)

  An instance is created from an adapter factory. The factory is used as a key so that we always know which factory created this adapter.

Method Detail

### isAdapterForType

    public boolean isAdapterForType(java.lang.Object type)

  This returns true, only if this adapter was created by the given factory; the adapter factory is used as the type key.

### getAdapterFactory

    public AdapterFactory getAdapterFactory()

  This provides access to the factory.

### getDecoratedItemProvider

    public IChangeNotifier getDecoratedItemProvider()

  This returns the item provider that this decorates.

  Specified by:
    `getDecoratedItemProvider` in interface `IItemProviderDecorator`

### setDecoratedItemProvider

    public void setDecoratedItemProvider(IChangeNotifier decoratedItemProvider)

  This sets the item provider that this decorates; it also hooks up the `INotifyChangedListener`.

  Specified by:
    `setDecoratedItemProvider` in interface `IItemProviderDecorator`

### addListener

    public void addListener(INotifyChangedListener listener)

  Description copied from interface: `IChangeNotifier`
  This adds another listener.

  Specified by:
    `addListener` in interface `IChangeNotifier`

### removeListener

    public void removeListener(INotifyChangedListener listener)

  Description copied from interface: `IChangeNotifier`
  This removes a listener.

  Specified by:
    `removeListener` in interface `IChangeNotifier`

### fireNotifyChanged

    public void fireNotifyChanged(Notification notification)

  This delegates to the `adapterFactory`. The event type is a value from the static constants in `Notifier`.

  Specified by:
    `fireNotifyChanged` in interface `IChangeNotifier`

### getPropertyDescriptors

    public java.util.List<IItemPropertyDescriptor> getPropertyDescriptors(java.lang.Object object)

  This implements `IItemPropertySource.getPropertyDescriptors` by delegating to `(IItemPropertySource)``decoratedItemProvider`.

### getPropertyDescriptor

    public IItemPropertyDescriptor getPropertyDescriptor(java.lang.Object object,
                                                         java.lang.Object propertyId)

  This implements `IItemPropertySource.getPropertyDescriptors` by delegating to `(IItemPropertySource)``decoratedItemProvider`.

### getEditableValue

    public java.lang.Object getEditableValue(java.lang.Object object)

  This implements `IItemPropertySource.getEditableValue` by delegating to `(IItemPropertySource)``decoratedItemProvider`.

### getElements

    public java.util.Collection<?> getElements(java.lang.Object object)

  This implements `IStructuredItemContentProvider.getElements` by delegating to `(IStructuredItemContentProvider)``decoratedItemProvider`.

### getChildren

    public java.util.Collection<?> getChildren(java.lang.Object object)

  This implements `ITreeItemContentProvider.getChildren` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.

### hasChildren

    public boolean hasChildren(java.lang.Object object)

  This implements `ITreeItemContentProvider.hasChildren` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.

### getParent

    public java.lang.Object getParent(java.lang.Object object)

  This implements `ITreeItemContentProvider.getParent` by delegating to `(ITreeItemContentProvider)``decoratedItemProvider`.

### getImage

    public java.lang.Object getImage(java.lang.Object object)

  This implements `IItemLabelProvider.getImage` by delegating to `(IItemLabelProvider)``decoratedItemProvider`.

### getColumnImage

    public java.lang.Object getColumnImage(java.lang.Object object,
                                           int columnIndex)

  This implements `ITableItemLabelProvider.getColumnImage` by delegating to `(ITableItemLabelProvider)``decoratedItemProvider`.

### getText

    public java.lang.String getText(java.lang.Object object)

  This implements `IItemLabelProvider.getText` by delegating to `(IItemLabelProvider)``decoratedItemProvider`.

### getFont

    public java.lang.Object getFont(java.lang.Object object)

  This implements `IItemFontProvider.getFont` by delegating to `(IItemFontProvider)``decoratedItemProvider`.

### getFont

    public java.lang.Object getFont(java.lang.Object object,
                                    int columnIndex)

  This implements `ITableItemFontProvider.getFont` by delegating to `(IItemFontProvider)``decoratedItemProvider`.

### getForeground

    public java.lang.Object getForeground(java.lang.Object object)

  This implements `IItemColorProvider.getForeground` by delegating to `(IItemColorProvider)``decoratedItemProvider`.

### getForeground

    public java.lang.Object getForeground(java.lang.Object object,
                                          int columnIndex)

  This implements `ITableItemColorProvider.getForeground` by delegating to `(ITableItemColorProvider)``decoratedItemProvider`.

### getBackground

    public java.lang.Object getBackground(java.lang.Object object)

  This implements `IItemColorProvider.getBackground` by delegating to `(IItemColorProvider)``decoratedItemProvider`.

### getBackground

    public java.lang.Object getBackground(java.lang.Object object,
                                          int columnIndex)

  This implements `ITableItemColorProvider.getBackground` by delegating to `(ITableItemColorProvider)``decoratedItemProvider`.

### getColumnText

    public java.lang.String getColumnText(java.lang.Object object,
                                          int columnIndex)

  This implements `ITableItemLabelProvider.getColumnText` by delegating to `(ITableItemLabelProvider)``decoratedItemProvider`.

### getUpdateableText

    public java.lang.String getUpdateableText(java.lang.Object object)

  This implements `IUpdateableItemText.getUpdateableText` by delegating to `(IUpdateableItemText)``decoratedItemProvider`.

### getNewChildDescriptors

    public java.util.Collection<?> getNewChildDescriptors(java.lang.Object object,
                                                          EditingDomain editingDomain,
                                                          java.lang.Object sibling)

  This implements `IEditingDomainItemProvider.getNewChildDescriptors` by delegating to `(IEditingDomainItemProvider)``decoratedItemProvider`.

### createCommand

    public Command createCommand(java.lang.Object object,
                                 EditingDomain domain,
                                 java.lang.Class<? extends Command> commandClass,
                                 CommandParameter commandParameter)

  This implements `IEditingDomainItemProvider.createCommand` by delegating to `(IEditingDomainItemProvider)``decoratedItemProvider`.

### notifyChanged

    public void notifyChanged(Notification notification)

  This will be called by the `decoratedItemProvider` when it normally fires a notification to it's adapter factory. This listener method is hooked up in `setDecoratedItemProvider(org.eclipse.emf.edit.provider.IChangeNotifier)`.

  Specified by:
    `notifyChanged` in interface `INotifyChangedListener`

### dispose

    public void dispose()

  Description copied from interface: `IDisposable`
  This is called to dispose the object.

  Specified by:
    `dispose` in interface `IDisposable`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

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