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 int
Deprecated.static final int
The middle of the Connectionstatic final int
Deprecated.UseMIDDLE
instead, since the location is not the midpoint of a line-segment, but the middle of a polyline.static final int
The start (or source) of the Connectionstatic final int
Deprecated.UseSOURCE
static final int
The end (or target) of the Connection -
Constructor Summary
ConstructorsConstructorDescriptionConnectionLocator
(Connection connection) Constructs a ConnectionLocator with the passed connection andMIDDLE
alignment.ConnectionLocator
(Connection connection, int align) Constructs a ConnectionLocator with the passed Connection and alignment. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the alignment of ConnectionLocator.protected Connection
Returns connection associated with ConnectionLocator.protected Point
getLocation
(PointList points) Returns a point from the passed PointList, dependent on ConnectionLocator's alignment.protected Point
Returns ConnectionLocator's reference point in absolute coordinates.protected void
setAlignment
(int align) Sets the alignment.protected void
setConnection
(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.UseMIDDLE
instead, 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 andMIDDLE
alignment.- 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:
getReferencePoint
in 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