public class GFPolylineConnection extends GFPolyline implements org.eclipse.draw2d.Connection, org.eclipse.draw2d.AnchorListener
Important difference: The super-class denotes a polyline-shape. There the points are translated towards the center depending on the line-width, so that the bounds of the polyline-shape are only dependent on the points of the polyline but not on the current line-width. Otherwise it would be difficult to align its positions/sizes with the neighbor-shapes or parent-shapes. This class on the other hand denotes a polyline-connection. Here the points are not translated towards the center, because the polyline must always go directly through the given points.
Constructor and Description |
---|
GFPolylineConnection(IPictogramElementDelegate pictogramElementDelegate,
GraphicsAlgorithm graphicsAlgorithm)
Creates a new GFPolylineConnection.
|
Modifier and Type | Method and Description |
---|---|
void |
addDecoration(org.eclipse.draw2d.IFigure decoration,
boolean distanceToStart,
double relativeDistance,
int absoluteDistance,
double rotateDegrees)
Adds a decoration to this connection.
|
void |
addNotify()
Hooks the source and target anchors.
|
void |
addRoutingListener(org.eclipse.draw2d.RoutingListener listener)
Appends the given routing listener to the list of listeners.
|
void |
anchorMoved(org.eclipse.draw2d.ConnectionAnchor anchor)
Called by the anchors of this connection when they have moved,
revalidating this polyline connection.
|
java.util.List<org.eclipse.draw2d.IFigure> |
getAllDecorations()
Returns a list of all decorations, which are currently added to this
connection.
|
org.eclipse.draw2d.geometry.Rectangle |
getBounds()
Returns the bounds which holds all the points in this polyline
connection.
|
org.eclipse.draw2d.ConnectionRouter |
getConnectionRouter()
Returns the
ConnectionRouter used to layout this connection. |
java.lang.Object |
getRoutingConstraint()
Returns this connection's routing constraint from its connection router.
|
org.eclipse.draw2d.ConnectionAnchor |
getSourceAnchor() |
org.eclipse.draw2d.ConnectionAnchor |
getTargetAnchor() |
void |
layout()
Layouts this polyline.
|
void |
removeAllDecorations()
Removes all currently added decorations from the connection.
|
void |
removeNotify()
Called just before the receiver is being removed from its parent.
|
void |
removeRoutingListener(org.eclipse.draw2d.RoutingListener listener)
Removes the first occurence of the given listener.
|
void |
revalidate() |
void |
setConnectionRouter(org.eclipse.draw2d.ConnectionRouter cr)
Sets the connection router which handles the layout of this polyline.
|
void |
setRoutingConstraint(java.lang.Object cons)
Sets the routing constraint for this connection.
|
void |
setSourceAnchor(org.eclipse.draw2d.ConnectionAnchor anchor)
Sets the anchor to be used at the start of this polyline connection.
|
void |
setSpecificBezierDistances(int[] bezierDistances)
Sets the specific distances used to calculate the rounding of the
bezier-curve.
|
void |
setTargetAnchor(org.eclipse.draw2d.ConnectionAnchor anchor)
Sets the anchor to be used at the end of the polyline connection.
|
containsPointInFigure, primTranslate, setGeneralBezierDistance, setLineWidth, setMinimumSelectionLineWidth, setSuppressFilling
addPoint, getEnd, getPoints, getStart, insertPoint, removeAllPoints, removePoint, setEnd, setPoint, setPoints, setStart
containsPoint, getHandleBounds, getVisualState, paintFigure, setClickArea, setSelectionBorder, visualStateChanged
getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineMiterLimit, getLineStyle, getLineWidth, getLineWidthFloat, setAlpha, setAlpha, setAntialias, setAntialias, setFill, setFillXOR, setLineAttributes, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineMiterLimit, setLineStyle, setLineWidthFloat, setOutline, setOutlineXOR, setXOR
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isOpaque, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
public GFPolylineConnection(IPictogramElementDelegate pictogramElementDelegate, GraphicsAlgorithm graphicsAlgorithm)
pictogramElementDelegate
- The PictogramElementDelegate which provides the
GraphicsAlgorithm.graphicsAlgorithm
- The GraphicsAlgorithm which provides the values to paint this
Shape.public org.eclipse.draw2d.geometry.Rectangle getBounds()
The implementation adds the half line-width to the bounds of the
super-class, because the points are not translated towards the center
(see getAdjustedPointList(PointList, double, double)
), so that
bounds must expand depending on the line-width.
getBounds
in interface org.eclipse.draw2d.IFigure
getBounds
in class GFPolyline
public void setSpecificBezierDistances(int[] bezierDistances)
GFPolyline
GFPolyline.setGeneralBezierDistance(int)
will be used. See
GFFigureUtil.getBezierPath(List, boolean)
for a more details.setSpecificBezierDistances
in class GFPolyline
bezierDistances
- The specific distance used to calculate the rounding of the
bezier-curve.public void addNotify()
addNotify
in interface org.eclipse.draw2d.IFigure
addNotify
in class org.eclipse.draw2d.Figure
Figure.addNotify()
public void addRoutingListener(org.eclipse.draw2d.RoutingListener listener)
listener
- the routing listenerpublic void anchorMoved(org.eclipse.draw2d.ConnectionAnchor anchor)
anchorMoved
in interface org.eclipse.draw2d.AnchorListener
anchor
- the anchor that movedpublic org.eclipse.draw2d.ConnectionRouter getConnectionRouter()
ConnectionRouter
used to layout this connection.
Will not return null
.getConnectionRouter
in interface org.eclipse.draw2d.Connection
public java.lang.Object getRoutingConstraint()
null
.getRoutingConstraint
in interface org.eclipse.draw2d.Connection
public org.eclipse.draw2d.ConnectionAnchor getSourceAnchor()
getSourceAnchor
in interface org.eclipse.draw2d.Connection
public org.eclipse.draw2d.ConnectionAnchor getTargetAnchor()
getTargetAnchor
in interface org.eclipse.draw2d.Connection
public void layout()
layout
in class org.eclipse.draw2d.Figure
public void removeNotify()
removeNotify
in interface org.eclipse.draw2d.IFigure
removeNotify
in class org.eclipse.draw2d.Figure
public void removeRoutingListener(org.eclipse.draw2d.RoutingListener listener)
listener
- the listener being removedpublic void revalidate()
revalidate
in interface org.eclipse.draw2d.IFigure
revalidate
in class org.eclipse.draw2d.Figure
IFigure.revalidate()
public void setConnectionRouter(org.eclipse.draw2d.ConnectionRouter cr)
setConnectionRouter
in interface org.eclipse.draw2d.Connection
cr
- the connection routerpublic void setRoutingConstraint(java.lang.Object cons)
setRoutingConstraint
in interface org.eclipse.draw2d.Connection
cons
- the constraintpublic void setSourceAnchor(org.eclipse.draw2d.ConnectionAnchor anchor)
setSourceAnchor
in interface org.eclipse.draw2d.Connection
anchor
- the new source anchorpublic void addDecoration(org.eclipse.draw2d.IFigure decoration, boolean distanceToStart, double relativeDistance, int absoluteDistance, double rotateDegrees)
decoration
- The decoration to add.distanceToStart
- If the distance values refer to the start-point or the
end-point. See FlexibleRotatableLocator
.relativeDistance
- The relative distance. See FlexibleRotatableLocator
.absoluteDistance
- The absolute distance. See FlexibleRotatableLocator
.rotateDegrees
- The rotation in degrees. See FlexibleRotatableLocator
.public void removeAllDecorations()
getAllDecorations()
public java.util.List<org.eclipse.draw2d.IFigure> getAllDecorations()
#addDecoration(IFigure, boolean, double, int)
public void setTargetAnchor(org.eclipse.draw2d.ConnectionAnchor anchor)
setTargetAnchor
in interface org.eclipse.draw2d.Connection
anchor
- the new target anchor