Class GFPolylineConnection
- All Implemented Interfaces:
org.eclipse.draw2d.AnchorListener,org.eclipse.draw2d.Connection,org.eclipse.draw2d.IFigure,org.eclipse.gef.handles.HandleBounds,IVisualStateChangeListener,IVisualStateHolder
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure
org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch, org.eclipse.draw2d.Figure.ReverseFigureChildrenIteratorNested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure
org.eclipse.draw2d.IFigure.NoInsets -
Field Summary
Fields inherited from class org.eclipse.draw2d.Shape
lineStyle, lineWidthFields inherited from class org.eclipse.draw2d.Figure
bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTipFields inherited from interface org.eclipse.draw2d.Connection
PROPERTY_CONNECTION_ROUTER, PROPERTY_POINTSFields inherited from interface org.eclipse.draw2d.IFigure
MAX_DIMENSION, MIN_DIMENSION, NO_INSETS -
Constructor Summary
ConstructorsConstructorDescriptionGFPolylineConnection(IPictogramElementDelegate pictogramElementDelegate, GraphicsAlgorithm graphicsAlgorithm) Creates a new GFPolylineConnection. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDecoration(org.eclipse.draw2d.IFigure decoration, boolean distanceToStart, double relativeDistance, int absoluteDistance, double rotateDegrees) Adds a decoration to this connection.voidHooks the source and target anchors.voidaddRoutingListener(org.eclipse.draw2d.RoutingListener listener) Appends the given routing listener to the list of listeners.voidanchorMoved(org.eclipse.draw2d.ConnectionAnchor anchor) Called by the anchors of this connection when they have moved, revalidating this polyline connection.protected org.eclipse.draw2d.geometry.PointListgetAdjustedPointList(org.eclipse.draw2d.geometry.PointList points, double zoom, double lw) Returns a new instance of the input point-list, which is adjusted regarding the given zoom-factor and line-width.List<org.eclipse.draw2d.IFigure>Returns a list of all decorations, which are currently added to this connection.protected List<BezierPoint>getBezierPoints(org.eclipse.draw2d.geometry.PointList points, double zoom) Returns a new list of bezier-points, which is calculated from the given point list.org.eclipse.draw2d.geometry.RectangleReturns the bounds which holds all the points in this polyline connection.org.eclipse.draw2d.ConnectionRouterReturns theConnectionRouterused to layout this connection.Returns this connection's routing constraint from its connection router.org.eclipse.draw2d.ConnectionAnchororg.eclipse.draw2d.ConnectionAnchorvoidlayout()Layouts this polyline.voidRemoves all currently added decorations from the connection.voidCalled just before the receiver is being removed from its parent.voidremoveRoutingListener(org.eclipse.draw2d.RoutingListener listener) Removes the first occurence of the given listener.voidvoidsetConnectionRouter(org.eclipse.draw2d.ConnectionRouter cr) Sets the connection router which handles the layout of this polyline.voidsetRoutingConstraint(Object cons) Sets the routing constraint for this connection.voidsetSourceAnchor(org.eclipse.draw2d.ConnectionAnchor anchor) Sets the anchor to be used at the start of this polyline connection.voidsetSpecificBezierDistances(int[] bezierDistances) Sets the specific distances used to calculate the rounding of the bezier-curve.voidsetTargetAnchor(org.eclipse.draw2d.ConnectionAnchor anchor) Sets the anchor to be used at the end of the polyline connection.Methods inherited from class org.eclipse.graphiti.ui.internal.figures.GFPolyline
containsPointInFigure, createPath, fillShape, getAdjustedPointListWithoutZoom, getGeneralBezierDistance, getSpecificBezierDistances, primTranslate, setGeneralBezierDistance, setLineWidth, setMinimumSelectionLineWidth, setSuppressFillingMethods inherited from class org.eclipse.graphiti.ui.internal.figures.GFAbstractPointListShape
addPoint, getEnd, getPoints, getStart, insertPoint, removeAllPoints, removePoint, setEnd, setPoint, setPoints, setStartMethods inherited from class org.eclipse.graphiti.ui.internal.figures.GFAbstractShape
containsPoint, containsPointInArea, fillPath, getClickArea, getConfigurationProvider, getGraphicsAlgorithm, getHandleBounds, getLineWidth, getPictogramElementDelegate, getPreferences, getSelectionBorder, getVisualState, getZoomLevel, outlineShape, paintFigure, paintShape, setClickArea, setSelectionBorder, transformToFillBounds, visualStateChangedMethods inherited from class org.eclipse.draw2d.Shape
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, setXORMethods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getChildren, getChildrenRevIterable, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getListenersIterable, getLocalBackgroundColor, getLocalFont, 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, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, optimizeClip, paint, paintBorder, paintChildren, paintClientArea, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.draw2d.Connection
getPoints, setPointsMethods inherited from interface org.eclipse.draw2d.IFigure
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, 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, 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
-
Constructor Details
-
GFPolylineConnection
public GFPolylineConnection(IPictogramElementDelegate pictogramElementDelegate, GraphicsAlgorithm graphicsAlgorithm) Creates a new GFPolylineConnection.- Parameters:
pictogramElementDelegate- The PictogramElementDelegate which provides the GraphicsAlgorithm.graphicsAlgorithm- The GraphicsAlgorithm which provides the values to paint this Shape.
-
-
Method Details
-
getAdjustedPointList
protected org.eclipse.draw2d.geometry.PointList getAdjustedPointList(org.eclipse.draw2d.geometry.PointList points, double zoom, double lw) Returns a new instance of the input point-list, which is adjusted regarding the given zoom-factor and line-width.The implementation only zooms the points regarding the zoom-factor. It does not translate the points towards the center depending on the line-width. See explanation in the javadoc of this class.
- Overrides:
getAdjustedPointListin classGFPolyline- Parameters:
points- The point-list which to adjust.zoom- The zoom-factor to regard.lw- The line-width to regard.
-
getBounds
public org.eclipse.draw2d.geometry.Rectangle getBounds()Returns the bounds which holds all the points in this polyline connection. Note, that the childrens bounds are also added to the super-class bounds.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.- Specified by:
getBoundsin interfaceorg.eclipse.draw2d.IFigure- Overrides:
getBoundsin classGFPolyline- Returns:
- The bounds which holds all the points in this polyline connection.
-
getBezierPoints
protected List<BezierPoint> getBezierPoints(org.eclipse.draw2d.geometry.PointList points, double zoom) Description copied from class:GFPolylineReturns a new list of bezier-points, which is calculated from the given point list.- Overrides:
getBezierPointsin classGFPolyline- Parameters:
points- The point list, from which to calculate the bezier-points.zoom- The zoom-level used to adjust the bezier distances.- Returns:
- a new list of bezier-points, which is calculated from the given point list.
-
setSpecificBezierDistances
public void setSpecificBezierDistances(int[] bezierDistances) Description copied from class:GFPolylineSets the specific distances used to calculate the rounding of the bezier-curve. This means, that for each point of the polyline the before-distance and the after distance have to be specified. If this attribute is null, then the value of the attribute inGFPolyline.setGeneralBezierDistance(int)will be used. SeeGFFigureUtil.getBezierPath(List, boolean)for a more details.- Overrides:
setSpecificBezierDistancesin classGFPolyline- Parameters:
bezierDistances- The specific distance used to calculate the rounding of the bezier-curve.
-
addNotify
public void addNotify()Hooks the source and target anchors.- Specified by:
addNotifyin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addNotifyin classorg.eclipse.draw2d.Figure- See Also:
-
Figure.addNotify()
-
addRoutingListener
public void addRoutingListener(org.eclipse.draw2d.RoutingListener listener) Appends the given routing listener to the list of listeners.- Parameters:
listener- the routing listener- Since:
- 3.2
-
anchorMoved
public void anchorMoved(org.eclipse.draw2d.ConnectionAnchor anchor) Called by the anchors of this connection when they have moved, revalidating this polyline connection.- Specified by:
anchorMovedin interfaceorg.eclipse.draw2d.AnchorListener- Parameters:
anchor- the anchor that moved
-
getConnectionRouter
public org.eclipse.draw2d.ConnectionRouter getConnectionRouter()Returns theConnectionRouterused to layout this connection. Will not returnnull.- Specified by:
getConnectionRouterin interfaceorg.eclipse.draw2d.Connection- Returns:
- this connection's router
-
getRoutingConstraint
Returns this connection's routing constraint from its connection router. May returnnull.- Specified by:
getRoutingConstraintin interfaceorg.eclipse.draw2d.Connection- Returns:
- the connection's routing constraint
-
getSourceAnchor
public org.eclipse.draw2d.ConnectionAnchor getSourceAnchor()- Specified by:
getSourceAnchorin interfaceorg.eclipse.draw2d.Connection- Returns:
- the anchor at the start of this polyline connection (may be null)
-
getTargetAnchor
public org.eclipse.draw2d.ConnectionAnchor getTargetAnchor()- Specified by:
getTargetAnchorin interfaceorg.eclipse.draw2d.Connection- Returns:
- the anchor at the end of this polyline connection (may be null)
-
layout
public void layout()Layouts this polyline. If the start and end anchors are present, the connection router is used to route this, after which it is laid out. It also fires a moved method.- Overrides:
layoutin classorg.eclipse.draw2d.Figure
-
removeNotify
public void removeNotify()Called just before the receiver is being removed from its parent. Results in removing itself from the connection router.- Specified by:
removeNotifyin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removeNotifyin classorg.eclipse.draw2d.Figure- Since:
- 2.0
-
removeRoutingListener
public void removeRoutingListener(org.eclipse.draw2d.RoutingListener listener) Removes the first occurence of the given listener.- Parameters:
listener- the listener being removed- Since:
- 3.2
-
revalidate
public void revalidate()- Specified by:
revalidatein interfaceorg.eclipse.draw2d.IFigure- Overrides:
revalidatein classorg.eclipse.draw2d.Figure- See Also:
-
IFigure.revalidate()
-
setConnectionRouter
public void setConnectionRouter(org.eclipse.draw2d.ConnectionRouter cr) Sets the connection router which handles the layout of this polyline. Generally set by the parent handling the polyline connection.- Specified by:
setConnectionRouterin interfaceorg.eclipse.draw2d.Connection- Parameters:
cr- the connection router
-
setRoutingConstraint
Sets the routing constraint for this connection.- Specified by:
setRoutingConstraintin interfaceorg.eclipse.draw2d.Connection- Parameters:
cons- the constraint
-
setSourceAnchor
public void setSourceAnchor(org.eclipse.draw2d.ConnectionAnchor anchor) Sets the anchor to be used at the start of this polyline connection.- Specified by:
setSourceAnchorin interfaceorg.eclipse.draw2d.Connection- Parameters:
anchor- the new source anchor
-
addDecoration
public void addDecoration(org.eclipse.draw2d.IFigure decoration, boolean distanceToStart, double relativeDistance, int absoluteDistance, double rotateDegrees) Adds a decoration to this connection. The decoration is located depending on the distance values.- Parameters:
decoration- The decoration to add.distanceToStart- If the distance values refer to the start-point or the end-point. SeeFlexibleRotatableLocator.relativeDistance- The relative distance. SeeFlexibleRotatableLocator.absoluteDistance- The absolute distance. SeeFlexibleRotatableLocator.rotateDegrees- The rotation in degrees. SeeFlexibleRotatableLocator.
-
removeAllDecorations
public void removeAllDecorations()Removes all currently added decorations from the connection.- See Also:
-
getAllDecorations
Returns a list of all decorations, which are currently added to this connection. Can be empty but not null.- Returns:
- A list of all decorations, which are currently added to this connection.
- See Also:
-
#addDecoration(IFigure, boolean, double, int)
-
setTargetAnchor
public void setTargetAnchor(org.eclipse.draw2d.ConnectionAnchor anchor) Sets the anchor to be used at the end of the polyline connection. Removes this listener from the old anchor and adds it to the new anchor.- Specified by:
setTargetAnchorin interfaceorg.eclipse.draw2d.Connection- Parameters:
anchor- the new target anchor
-