public class RelativeLocator extends java.lang.Object implements Locator
Constants such as NORTH
and
SOUTH
can be used to set the placement.
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public RelativeLocator()
public RelativeLocator(IFigure reference, int location)
PositionConstants
used
as a convenient and readable way to set both the relativeX and relativeY
values.reference
- the reference figurelocation
- one of NORTH, NORTH_EAST, etc.public RelativeLocator(IFigure reference, double relativeX, double relativeY)
reference
- the reference figurerelativeX
- the relative X offsetrelativeY
- the relative Y offsetprotected Rectangle getReferenceBox()
protected IFigure getReferenceFigure()
public void relocate(IFigure target)
relocate
in interface Locator
target
- The figure to relocateLocator.relocate(org.eclipse.draw2d.IFigure)
public void setReferenceFigure(IFigure reference)
reference
- the reference figureCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.