Eclipse Draw2d 3.2

## org.eclipse.draw2d
Class RelativeLocator

    java.lang.Object
      org.eclipse.draw2d.RelativeLocator

All Implemented Interfaces:
  Locator

public class RelativeLocator
extends Object
implements Locator

Places a handle relative to a figure's bounds. The placement is determined by indicating the figure to which the placement is relative, and two floating-point value indicating the horizontal and vertical offset from that figure's top-left corner. The values (0.0, 0.0) would indicate the figure's top-left corner, while the values (1.0, 1.0) would indicate the figure's bottom-right corner.

Constants such as `NORTH` and `SOUTH` can be used to set the placement.

Constructor Summary
`RelativeLocator()` Null constructor.
`RelativeLocator(IFigure reference, double relativeX, double relativeY)` Constructs a RelativeLocator with the given reference Figure and offset ratios.
`RelativeLocator(IFigure reference, int location)` Constructs a RelativeLocator with the given reference figure and relative location.

Method Summary
`protected Rectangle` `getReferenceBox()` Returns the Reference Box in the Reference Figure's coordinate system.
`protected IFigure` `getReferenceFigure()` Returns the Figure this locator is relative to.
`void` `relocate(IFigure target)` Relocates the target using the relative offset locations.
`void` `setReferenceFigure(IFigure reference)` Sets the reference figure this locator uses to place the target figure.

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

Constructor Detail

### RelativeLocator

    public RelativeLocator()

  Null constructor. The reference figure must be set before use. The relative locations will default to (0.0, 0.0).

Since:
  2.0

### RelativeLocator

    public RelativeLocator(IFigure reference,
                           int location)

  Constructs a RelativeLocator with the given reference figure and relative location. The location is a constant from `PositionConstants` used as a convenient and readable way to set both the relativeX and relativeY values.

Parameters:
  `reference` - the reference figure
  `location` - one of NORTH, NORTH_EAST, etc.
Since:
  2.0

### RelativeLocator

    public RelativeLocator(IFigure reference,
                           double relativeX,
                           double relativeY)

  Constructs a RelativeLocator with the given reference Figure and offset ratios.

Parameters:
  `reference` - the reference figure
  `relativeX` - the relative X offset
  `relativeY` - the relative Y offset
Since:
  2.0

Method Detail

### getReferenceBox

    protected Rectangle getReferenceBox()

  Returns the Reference Box in the Reference Figure's coordinate system. The returned Rectangle may be by reference, and should not be modified.

  Returns:
    the reference box
  Since:
    2.0

### getReferenceFigure

    protected IFigure getReferenceFigure()

  Returns the Figure this locator is relative to.

  Returns:
    the reference figure
  Since:
    2.0

### relocate

    public void relocate(IFigure target)

  Relocates the target using the relative offset locations.

  Specified by:
    `relocate` in interface `Locator`
  Parameters:
    `target` - The figure to relocate
  See Also:
    `Locator.relocate(org.eclipse.draw2d.IFigure)`

### setReferenceFigure

    public void setReferenceFigure(IFigure reference)

  Sets the reference figure this locator uses to place the target figure.

  Parameters:
    `reference` - the reference figure
  Since:
    2.0

Eclipse Draw2d 3.2

Copyright (c) IBM Corp. and others 2000, 2006. All Rights Reserved.