Eclipse Draw2d
2.1

org.eclipse.draw2d
Class RelativeLocator

java.lang.Object
  |
  +--org.eclipse.draw2d.RelativeLocator
All Implemented Interfaces:
Locator

public class RelativeLocator
extends Object
implements Locator

A locator that specfies a point that is relative to the bounds of a Figure. There are two double values that determine where the target Figure will be placed. These amounts represent the percentage of the reference Figure's bounds the target Figure should be displaced from the reference Figure's top-left corner. The values 0.0 and 0.0 will result in the target Figure being located at the reference Figure's top-left corner. The values 1.0 and 1.0 will result in the target Figure being located at the reference Figure's bottom-right corner.


Constructor Summary
RelativeLocator()
          Creates a new RelativeLocator which will locate its target Figure in the top-left corner of the reference Figure (which must be set separately).
RelativeLocator(IFigure reference, double _relativeX, double _relativeY)
          Creates a new RelativeLocator with the given reference Figure that locates its target Figure based on _relativeX and _relativeY.
RelativeLocator(IFigure reference, int location)
          Creates a new RelativeLocator with the given reference Figure, that will locate its target figure based on location, which is one of the compass directions defined in PositionConstants.
 
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 given IFigure.
 void setReferenceFigure(IFigure reference)
          Sets the Figure this locator should be relative to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelativeLocator

public RelativeLocator()
Creates a new RelativeLocator which will locate its target Figure in the top-left corner of the reference Figure (which must be set separately).

Since:
2.0

RelativeLocator

public RelativeLocator(IFigure reference,
                       int location)
Creates a new RelativeLocator with the given reference Figure, that will locate its target figure based on location, which is one of the compass directions defined in PositionConstants.

Since:
2.0

RelativeLocator

public RelativeLocator(IFigure reference,
                       double _relativeX,
                       double _relativeY)
Creates a new RelativeLocator with the given reference Figure that locates its target Figure based on _relativeX and _relativeY.

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.

Since:
2.0

getReferenceFigure

protected IFigure getReferenceFigure()
Returns the Figure this locator is relative to.

Since:
2.0

relocate

public void relocate(IFigure target)
Description copied from interface: Locator
Relocates the given IFigure.

Specified by:
relocate in interface Locator
Parameters:
target - The figure to relocate

setReferenceFigure

public void setReferenceFigure(IFigure reference)
Sets the Figure this locator should be relative to.

Since:
2.0

Eclipse Draw2d
2.1

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