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 Summary
FieldsModifier 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 Summary
ConstructorsConstructorDescriptionConnectionLocator(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 Summary
Modifier 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.AbstractLocator
getGap, getNewBounds, getRelativePosition, relocate, setGap, setRelativePosition
-
Field Details
-
START
public static final int STARTDeprecated.UseSOURCE- See Also:
-
SOURCE
public static final int SOURCEThe start (or source) of the Connection- See Also:
-
END
public static final int ENDDeprecated.UseTARGET- See Also:
-
TARGET
public static final int TARGETThe end (or target) of the Connection- See Also:
-
MIDPOINT
public static final int MIDPOINTDeprecated.UseMIDDLEinstead, since the location is not the midpoint of a line-segment, but the middle of a polyline.- See Also:
-
MIDDLE
public static final int MIDDLEThe middle of the Connection- See Also:
-
-
Constructor Details
-
ConnectionLocator
Constructs a ConnectionLocator with the passed connection andMIDDLEalignment.- Parameters:
connection- The Connection- Since:
- 2.0
-
ConnectionLocator
Constructs a ConnectionLocator with the passed Connection and alignment. Valid values for the alignment are integer constantsSOURCE,MIDDLE, andTARGET.- Parameters:
connection- The Connectionalign- The alignment- Since:
- 2.0
-
-
Method Details
-
getAlignment
public int getAlignment()Returns the alignment of ConnectionLocator.- Returns:
- The alignment
- Since:
- 2.0
-
getConnection
Returns connection associated with ConnectionLocator.- Returns:
- The Connection
- Since:
- 2.0
-
getReferencePoint
Returns ConnectionLocator's reference point in absolute coordinates.- Specified by:
getReferencePointin classAbstractLocator- Returns:
- The reference point
- Since:
- 2.0
-
getLocation
Returns 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
-
setAlignment
protected void setAlignment(int align) - Parameters:
align- The alignment- Since:
- 2.0
-
setConnection
Sets the Connection to be associated with this ConnectionLocator.- Parameters:
connection- The Connection- Since:
- 2.0
-
TARGET