Package org.eclipse.draw2d
Class AbstractLocator
java.lang.Object
org.eclipse.draw2d.AbstractLocator
- All Implemented Interfaces:
- Locator
- Direct Known Subclasses:
- ConnectionLocator
Places a figure relative to a point determined by the subclass. The figure
 may be placed in some location relative to the point with a configurable
 amount of spacing.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintgetGap()Returns the number of pixels to leave between the figure being located and the reference point.protected RectanglegetNewBounds(Dimension size, Point center) Recalculate the location of the figure according to its desired position relative to the center point.protected abstract PointReturns the reference point in absolute coordinates used to calculate the location.intReturns the position of the figure with respect to the center point.voidRecalculates the position of the figure and returns the updated bounds.voidsetGap(int i) Sets the gap between the reference point and the figure being placed.voidsetRelativePosition(int pos) Sets the position of the figure with respect to the center point.
- 
Constructor Details- 
AbstractLocatorpublic AbstractLocator()Creates a new AbstractLocator.
 
- 
- 
Method Details- 
getGappublic int getGap()Returns the number of pixels to leave between the figure being located and the reference point. Only used ifgetRelativePosition()returns something other thanPositionConstants.CENTER.- Returns:
- The gap
- Since:
- 2.0
 
- 
getReferencePointReturns the reference point in absolute coordinates used to calculate the location.- Returns:
- The reference point in absolute coordinates
- Since:
- 2.0
 
- 
getNewBoundsRecalculate the location of the figure according to its desired position relative to the center point.- Parameters:
- size- The size of the figure
- center- The center point
- Returns:
- The new bounds
- Since:
- 2.0
 
- 
getRelativePositionpublic int getRelativePosition()Returns the position of the figure with respect to the center point. Possible values can be found inPositionConstantsand include CENTER, NORTH, SOUTH, EAST, WEST, NORTH_EAST, NORTH_WEST, SOUTH_EAST, or SOUTH_WEST.- Returns:
- An int constant representing the relative position
- Since:
- 2.0
 
- 
relocateRecalculates the position of the figure and returns the updated bounds.
- 
setGappublic void setGap(int i) Sets the gap between the reference point and the figure being placed. Only used if getRelativePosition() returns something other thanPositionConstants.CENTER.- Parameters:
- i- The gap
- Since:
- 2.0
 
- 
setRelativePositionpublic void setRelativePosition(int pos) Sets the position of the figure with respect to the center point. Possible values can be found inPositionConstantsand include CENTER, NORTH, SOUTH, EAST, WEST, NORTH_EAST, NORTH_WEST, SOUTH_EAST, or SOUTH_WEST.- Parameters:
- pos- The relative position
- Since:
- 2.0
 
 
-