Package org.eclipse.draw2d
Class RelativeLocator
java.lang.Object
org.eclipse.draw2d.RelativeLocator
- All Implemented Interfaces:
- 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 SummaryConstructorsConstructorDescriptionNull 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 SummaryModifier and TypeMethodDescriptionprotected RectangleReturns the Reference Box in the Reference Figure's coordinate system.protected IFigureReturns the Figure this locator is relative to.voidRelocates the target using the relative offset locations.voidsetReferenceFigure(IFigure reference) Sets the reference figure this locator uses to place the target figure.
- 
Constructor Details- 
RelativeLocatorpublic RelativeLocator()Null constructor. The reference figure must be set before use. The relative locations will default to (0.0, 0.0).- Since:
- 2.0
 
- 
RelativeLocatorConstructs a RelativeLocator with the given reference figure and relative location. The location is a constant fromPositionConstantsused 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
 
- 
RelativeLocatorConstructs 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 Details- 
getReferenceBoxReturns 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
 
- 
getReferenceFigureReturns the Figure this locator is relative to.- Returns:
- the reference figure
- Since:
- 2.0
 
- 
relocateRelocates the target using the relative offset locations.
- 
setReferenceFigureSets the reference figure this locator uses to place the target figure.- Parameters:
- reference- the reference figure
- Since:
- 2.0
 
 
-