public abstract class AbstractLocator extends java.lang.Object implements Locator
Constructor and Description |
---|
AbstractLocator()
Creates a new AbstractLocator.
|
Modifier and Type | Method and Description |
---|---|
int |
getGap()
Returns the number of pixels to leave between the figure being located
and the reference point.
|
protected Rectangle |
getNewBounds(Dimension size,
Point center)
Recalculate the location of the figure according to its desired position
relative to the center point.
|
protected abstract Point |
getReferencePoint()
Returns the reference point in absolute coordinates used to calculate the
location.
|
int |
getRelativePosition()
Returns the position of the figure with respect to the center point.
|
void |
relocate(IFigure target)
Recalculates the position of the figure and returns the updated bounds.
|
void |
setGap(int i)
Sets the gap between the reference point and the figure being placed.
|
void |
setRelativePosition(int pos)
Sets the position of the figure with respect to the center point.
|
public int getGap()
getRelativePosition()
returns something other than PositionConstants.CENTER
.protected abstract Point getReferencePoint()
protected Rectangle getNewBounds(Dimension size, Point center)
size
- The size of the figurecenter
- The center pointpublic int getRelativePosition()
PositionConstants
and include
CENTER, NORTH, SOUTH, EAST, WEST, NORTH_EAST, NORTH_WEST, SOUTH_EAST, or
SOUTH_WEST.public void relocate(IFigure target)
public void setGap(int i)
PositionConstants.CENTER
.i
- The gappublic void setRelativePosition(int pos)
PositionConstants
and include
CENTER, NORTH, SOUTH, EAST, WEST, NORTH_EAST, NORTH_WEST, SOUTH_EAST, or
SOUTH_WEST.pos
- The relative positionCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.