Runtime

## org.eclipse.gmf.runtime.diagram.ui.editpolicies
Class DecorationEditPolicy.DecoratorTarget

    java.lang.Object
      org.eclipse.gmf.runtime.diagram.ui.editpolicies.DecorationEditPolicy.DecoratorTarget

All Implemented Interfaces:
  IAdaptable, IDecoratorTarget

Enclosing class:
  DecorationEditPolicy

public class DecorationEditPolicy.DecoratorTarget
extends java.lang.Object
implements IDecoratorTarget

The decoratorTarget object to be passed to the service. This serves as a wrapper around this editpolicy.

Nested Class Summary

Nested classes inherited from class org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget
`IDecoratorTarget.Direction`

Constructor Summary
`DecorationEditPolicy.DecoratorTarget()`

Method Summary
`IDecoration` `addConnectionDecoration(IFigure figure, int percentageFromSource, boolean isVolatile)` Adds a figure as a decoration on a connection.
`IDecoration` `addConnectionDecoration(Image image, int percentageFromSource, boolean isVolatile)` Adds an image as a decoration on a connection.
`IDecoration` `addDecoration(IFigure figure, Locator locator, boolean isVolatile)` Adds a figure as a decoration on a shape or connection.
`IDecoration` `addShapeDecoration(IFigure figure, IDecoratorTarget.Direction direction, int margin, boolean isVolatile)` Adds a figure as a decoration on a shape.
`IDecoration` `addShapeDecoration(Image image, IDecoratorTarget.Direction direction, int margin, boolean isVolatile)` Adds an image as a decoration on a shape.
`java.lang.Object` `getAdapter(java.lang.Class adapter)`
`void` `installDecorator(java.lang.Object key, IDecorator decorator)` Installs a decorator on this decorator target using a key (a String identifier).
`void` `removeDecoration(IDecoration decoration)` Removes the decoration from the shape or connection it has been added to.

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

Constructor Detail

### DecorationEditPolicy.DecoratorTarget

    public DecorationEditPolicy.DecoratorTarget()

Method Detail

### installDecorator

    public void installDecorator(java.lang.Object key,
                                 IDecorator decorator)

  Description copied from interface: `IDecoratorTarget`
  Installs a decorator on this decorator target using a key (a String identifier). If another decorator is installed on the same target with the same key then it will override the previous one installed.

  Specified by:
    `installDecorator` in interface `IDecoratorTarget`
  Parameters:
    `key` - the key for the decorator, used to override a decorator previously installed on this decoratorTarget object
    `decorator` - the decorator to install

### getAdapter

    public java.lang.Object getAdapter(java.lang.Class adapter)

  Specified by:
    `getAdapter` in interface `IAdaptable`

### addShapeDecoration

    public IDecoration addShapeDecoration(Image image,
                                          IDecoratorTarget.Direction direction,
                                          int margin,
                                          boolean isVolatile)

  Description copied from interface: `IDecoratorTarget`
  Adds an image as a decoration on a shape.

  Specified by:
    `addShapeDecoration` in interface `IDecoratorTarget`
  Parameters:
    `image` - The image to be used as the decoration.
    `direction` - The direction relative to the shape to place the decoration.
    `margin` - The margin is the space, in himetric units, between the shape's edge and the decoration. A positive margin will place the figure outside the shape, a negative margin will place the decoration inside the shape.
    `isVolatile` - True if this decoration is volatile (i.e. not to be included in the printed output of a diagram); false otherwise.
  Returns:
    The decoration object, which will be needed to remove the decoration from the shape.

### addConnectionDecoration

    public IDecoration addConnectionDecoration(Image image,
                                               int percentageFromSource,
                                               boolean isVolatile)

  Description copied from interface: `IDecoratorTarget`
  Adds an image as a decoration on a connection.

  Specified by:
    `addConnectionDecoration` in interface `IDecoratorTarget`
  Parameters:
    `image` - The image to be used as the decoration.
    `percentageFromSource` - The percentage of the connection length away from the source end (range is from 0 to 100) where the decoration should be positioned.
    `isVolatile` - True if this decoration is volatile (i.e. not to be included in the printed output of a diagram); false otherwise.
  Returns:
    The decoration object, which will be needed to remove the decoration from the connection.

### removeDecoration

    public void removeDecoration(IDecoration decoration)

  Description copied from interface: `IDecoratorTarget`
  Removes the decoration from the shape or connection it has been added to.

  Specified by:
    `removeDecoration` in interface `IDecoratorTarget`
  Parameters:
    `decoration` - The decoration to be removed.

### addShapeDecoration

    public IDecoration addShapeDecoration(IFigure figure,
                                          IDecoratorTarget.Direction direction,
                                          int margin,
                                          boolean isVolatile)

  Description copied from interface: `IDecoratorTarget`
  Adds a figure as a decoration on a shape.

  Specified by:
    `addShapeDecoration` in interface `IDecoratorTarget`
  Parameters:
    `figure` - the figure to be used as the decoration
    `direction` - The direction relative to the shape to place the decoration.
    `margin` - The margin is the space, in himetric units, between the shape's edge and the decoration. A positive margin will place the figure outside the shape, a negative margin will place the decoration inside the shape.
    `isVolatile` - True if this decoration is volatile (i.e. not to be included in the printed output of a diagram); false otherwise.
  Returns:
    The decoration object, which is needed to later remove the decoration.

### addConnectionDecoration

    public IDecoration addConnectionDecoration(IFigure figure,
                                               int percentageFromSource,
                                               boolean isVolatile)

  Description copied from interface: `IDecoratorTarget`
  Adds a figure as a decoration on a connection.

  Specified by:
    `addConnectionDecoration` in interface `IDecoratorTarget`
  Parameters:
    `figure` - the figure to be used as the decoration
    `percentageFromSource` - The percentage of the connection length away from the source end (range is from 0 to 100) where the decoration should be positioned.
    `isVolatile` - True if this decoration is volatile (i.e. not to be included in the printed output of a diagram); false otherwise.
  Returns:
    The decoration object, which is needed to later remove the decoration.

### addDecoration

    public IDecoration addDecoration(IFigure figure,
                                     Locator locator,
                                     boolean isVolatile)

  Description copied from interface: `IDecoratorTarget`
  Adds a figure as a decoration on a shape or connection.

  Specified by:
    `addDecoration` in interface `IDecoratorTarget`
  Parameters:
    `figure` - the figure to be used as the decoration
    `locator` - The locator to be used to position the decoration
    `isVolatile` - True if this decoration is volatile (i.e. not to be included in the printed output of a diagram); false otherwise.
  Returns:
    The decoration object, which is needed to later remove the decoration.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.