Package org.eclipse.draw2d
Class ConnectionLocator
java.lang.Object
org.eclipse.draw2d.AbstractLocator
org.eclipse.draw2d.ConnectionLocator
- All Implemented Interfaces:
- Locator
- Direct Known Subclasses:
- ArrowLocator,- BendpointLocator,- MidpointLocator
Repositions a 
Figure attached to a Connection when the
 Connection is moved. Provides for alignment at the start (source), middle, or
 end (target) of the Connection.- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intThe middle of the Connectionstatic final intDeprecated.UseMIDDLEinstead, since the location is not the midpoint of a line-segment, but the middle of a polyline.static final intThe start (or source) of the Connectionstatic final intDeprecated.UseSOURCEstatic final intThe end (or target) of the Connection
- 
Constructor SummaryConstructorsConstructorDescriptionConnectionLocator(Connection connection) Constructs a ConnectionLocator with the passed connection andMIDDLEalignment.ConnectionLocator(Connection connection, int align) Constructs a ConnectionLocator with the passed Connection and alignment.
- 
Method SummaryModifier and TypeMethodDescriptionintReturns the alignment of ConnectionLocator.protected ConnectionReturns connection associated with ConnectionLocator.protected PointgetLocation(PointList points) Returns a point from the passed PointList, dependent on ConnectionLocator's alignment.protected PointReturns ConnectionLocator's reference point in absolute coordinates.protected voidsetAlignment(int align) Sets the alignment.protected voidsetConnection(Connection connection) Sets the Connection to be associated with this ConnectionLocator.Methods inherited from class org.eclipse.draw2d.AbstractLocatorgetGap, getNewBounds, getRelativePosition, relocate, setGap, setRelativePosition
- 
Field Details- 
STARTpublic static final int STARTDeprecated.UseSOURCE- See Also:
 
- 
SOURCEpublic static final int SOURCEThe start (or source) of the Connection- See Also:
 
- 
ENDpublic static final int ENDDeprecated.UseTARGET- See Also:
 
- 
TARGETpublic static final int TARGETThe end (or target) of the Connection- See Also:
 
- 
MIDPOINTpublic static final int MIDPOINTDeprecated.UseMIDDLEinstead, since the location is not the midpoint of a line-segment, but the middle of a polyline.- See Also:
 
- 
MIDDLEpublic static final int MIDDLEThe middle of the Connection- See Also:
 
 
- 
- 
Constructor Details- 
ConnectionLocatorConstructs a ConnectionLocator with the passed connection andMIDDLEalignment.- Parameters:
- connection- The Connection
- Since:
- 2.0
 
- 
ConnectionLocatorConstructs a ConnectionLocator with the passed Connection and alignment. Valid values for the alignment are integer constantsSOURCE,MIDDLE, andTARGET.- Parameters:
- connection- The Connection
- align- The alignment
- Since:
- 2.0
 
 
- 
- 
Method Details- 
getAlignmentpublic int getAlignment()Returns the alignment of ConnectionLocator.- Returns:
- The alignment
- Since:
- 2.0
 
- 
getConnectionReturns connection associated with ConnectionLocator.- Returns:
- The Connection
- Since:
- 2.0
 
- 
getReferencePointReturns ConnectionLocator's reference point in absolute coordinates.- Specified by:
- getReferencePointin class- AbstractLocator
- Returns:
- The reference point
- Since:
- 2.0
 
- 
getLocationReturns a point from the passed PointList, dependent on ConnectionLocator's alignment. If the alignment isSOURCE, it returns the first point in points. IfTARGET, it returns the last point in points. IfMIDDLE, it returns the middle of line represented by points.- Parameters:
- points- The points in the Connection
- Returns:
- The location
- Since:
- 2.0
 
- 
setAlignmentprotected void setAlignment(int align) - Parameters:
- align- The alignment
- Since:
- 2.0
 
- 
setConnectionSets the Connection to be associated with this ConnectionLocator.- Parameters:
- connection- The Connection
- Since:
- 2.0
 
 
- 
TARGET