Class PathElement

  • All Implemented Interfaces:
    BaseElement, MDElement, ModelElementProvider, com.nomagic.magicdraw.uml.symbols.LineJumpDrawer, com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider, NameOwner, java.beans.PropertyChangeListener, java.lang.Cloneable, java.lang.Comparable, java.util.EventListener
    Direct Known Subclasses:
    com.nomagic.magicdraw.uml.symbols.paths.ContainerLinkView, ContainmentLinkView, LinkAttributeView, NoteAnchorView

    @OpenApi
    public abstract class PathElement
    extends PathConnector
    implements com.nomagic.magicdraw.uml.symbols.LineJumpDrawer, com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
    Base class for all paths. Path is representation element which connects two other elements.
    • Field Detail

      • RECTILINEAR

        @OpenApi
        public static final java.lang.String RECTILINEAR
        Path line style with rectilinear (90 degrees) breakpoint corners.
        See Also:
        Constant Field Values
      • OBLIQUE

        @OpenApi
        public static final java.lang.String OBLIQUE
        Polyline path line style.
        See Also:
        Constant Field Values
      • BEZIER

        @OpenApi
        public static final java.lang.String BEZIER
        Bezier path line style.
        See Also:
        Constant Field Values
      • LINE_STYLE

        @OpenApi
        public static final java.util.List<java.lang.String> LINE_STYLE
        All possible path line styles.
      • SMART_LAYOUT_TOLERANCE

        private static final int SMART_LAYOUT_TOLERANCE
        Controls when smart layout should be applied to rectilinear path breakpoints.
        See Also:
        Constant Field Values
      • supplierPoint

        private java.awt.Point supplierPoint
        Connection point of link and supplier.
      • clientPoint

        private java.awt.Point clientPoint
        Connection point of link and client.
      • customSupplierPoint

        private java.awt.Point customSupplierPoint
        Custom supplier point for drawing relation ends. It used when need to change supplier point for intersection counting.
      • customClientPoint

        private java.awt.Point customClientPoint
        Custom client point for drawing relation ends. It used when need to change client point for intersection counting.
      • breakable

        private boolean breakable
        indicates whether link is breakable.
      • bounds

        @CheckForNull
        private java.awt.Rectangle bounds
        Calculated bounds of the path.
      • breakPoints

        private java.util.List<java.awt.Point> breakPoints
        Vector of break points
      • smartLayoutNeeded

        private boolean smartLayoutNeeded
        Indicates if smart path layout is needed for this path element.
      • lineJumps

        @CheckForNull
        private java.util.Map<java.awt.Point,​java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo>> lineJumps
        Contains information about line jumps.
      • lineJumpStartAngle

        @CheckForNull
        private java.util.Map<java.awt.Point,​java.lang.Double> lineJumpStartAngle
        Map of link points and start angle of the line jump.
      • lineJumpPlace

        @CheckForNull
        private com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace
        Place of the line jump.
      • cachedActualSupplierDrawPoint

        @CheckForNull
        private java.awt.Point cachedActualSupplierDrawPoint
      • cachedActualClientDrawPoint

        @CheckForNull
        private java.awt.Point cachedActualClientDrawPoint
      • cacheSupplierDrawPoint

        @CheckForNull
        private java.awt.Point cacheSupplierDrawPoint
      • cacheClientDrawPoint

        @CheckForNull
        private java.awt.Point cacheClientDrawPoint
      • cacheBreakPoints

        @CheckForNull
        private java.util.List<java.awt.Point> cacheBreakPoints
      • pathPainter

        private com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter
    • Constructor Detail

      • PathElement

        public PathElement()
    • Method Detail

      • clearSupplierTranslation

        public void clearSupplierTranslation()
        Clears client translated flag.
      • clearClientTranslation

        public void clearClientTranslation()
        Clears client translated flag.
      • translateSupplierPoint

        public final java.awt.Point translateSupplierPoint​(java.awt.Rectangle old,
                                                           java.awt.Rectangle newR)
      • translateClientPoint

        public final java.awt.Point translateClientPoint​(java.awt.Rectangle old,
                                                         java.awt.Rectangle newR)
      • getNewPointByTheLink

        @CheckForNull
        public java.awt.Point getNewPointByTheLink​(java.util.List<java.awt.Point> oldBreaks,
                                                   java.util.List<java.awt.Point> newBreaks,
                                                   java.awt.Point oldLocation)
      • hasSharedData

        public boolean hasSharedData()
        Description copied from class: PresentationElement
        Returns true if data of this object can be shared. If data is not shared data can be deleted with del key. Or it must be deleted with CRL+D
        Returns:
        true, if link has shared data.
      • askDeleteDataConfirmation

        public boolean askDeleteDataConfirmation()
        Return true, because while deleting link view user must be prompt about deleting data
        Returns:
        confirmation status -- true if asking is necessary, false otherwise
      • getPoint

        private static java.awt.Point getPoint​(java.awt.Point p1,
                                               java.awt.Point p2,
                                               double away)
        Gets point by the line. Method calculates location of the point that should be away from the specified line.
        Parameters:
        p1 - first end of the vector.
        p2 - second end of the vector.
        away - distance from the line.
        Returns:
        point
      • setBreakable

        public void setBreakable​(boolean value)
        Sets breakable flag on/ off. If flag is not set, link can not be broken. However link can have break points and be non breakable. This means that link has fixed points that can not be moved.
        Parameters:
        value - flag value
      • sSetBreakable

        public void sSetBreakable​(boolean value)
        Sets breakable flag on/ off. If flag is not set, link can not be broken. However link can have break points and be non breakable. This means that link has fixed points that can not be moved.
        Parameters:
        value - flag value
      • isBreakable

        public boolean isBreakable()
        shows whether link is breakable.
        Returns:
        true if link can be broken
      • isFixed

        public boolean isFixed()
        Returns if path element tied to it's supplier and client (cannot be reconnected)
        Returns:
        true if can be reconnected, else false
      • concatPoints

        private java.util.List<java.awt.Point> concatPoints​(java.awt.Point supplierPoint,
                                                            java.awt.Point clientPoint,
                                                            java.util.Collection<java.awt.Point> breakPoints)
      • setBreakPoints

        public final void setBreakPoints​(java.util.List<java.awt.Point> vct)
        Sets break point vector.
        Parameters:
        vct - new break point vector.
      • sClearBreakPoints

        public final void sClearBreakPoints()
        Clear break points list.
      • sSetBreakPoints

        public final void sSetBreakPoints​(java.util.List<java.awt.Point> vct)
        Only sets break point vector.
        Parameters:
        vct - new break point vector.
      • sAddBreakPoint

        public final void sAddBreakPoint​(java.awt.Point pt)
        Adds new break point.
        Parameters:
        pt - point to be added.
      • sSetBreakPoint

        public final void sSetBreakPoint​(java.awt.Point pt,
                                         int pos)
        Sets break point at the given position.
        Parameters:
        pt - point to be set
        pos - position where it must be set
      • needsToMoveOtherEnd

        public boolean needsToMoveOtherEnd()
        Returns:
        true if one end of links changed bounds and move link must be called for both ends.
      • getBreakPoint

        public java.awt.Point getBreakPoint​(int pos)
        Returns break point with given index.
        Parameters:
        pos - position where point resides.
        Returns:
        point at position pos.
      • getBreakPointCount

        public int getBreakPointCount()
        returns size of break point vector
        Returns:
        break point count
      • setBounds

        public void setBounds​(java.awt.Rectangle r)
        Moves link to new location.
        Parameters:
        r - new location of link.
      • simpleSetBounds

        public void simpleSetBounds​(java.awt.Rectangle r)
        calls break point vector changed method.
        Parameters:
        r - new bounding rectangle.
      • isToSelf

        public boolean isToSelf()
        Returns:
        true if link is link to self
      • isAlwaysToSelf

        public boolean isAlwaysToSelf()
      • sSetBounds

        public void sSetBounds​(java.awt.Rectangle r)
        Moves link to new location.
        Parameters:
        r - new location of link.
      • removeUnnecessaryBreakPoints

        public void removeUnnecessaryBreakPoints()
        Removes unnecessary points from break point vector. Checks if break point vector has useless points (covered by shape or invisible). Does not do anything if link can not be breakable. if it has removes them.
      • getPathIcon

        @CheckForNull
        public com.nomagic.magicdraw.ui.pathicon.PathIcon getPathIcon()
      • dynamicPathIcon

        @CheckForNull
        public com.nomagic.magicdraw.ui.pathicon.PathIcon dynamicPathIcon()
      • dynamicPathIcon

        public com.nomagic.magicdraw.ui.pathicon.PathIcon dynamicPathIcon​(@CheckForNull
                                                                          com.nomagic.magicdraw.ui.pathicon.PathIcon pathIcon)
      • getCustomStereotypeIcon

        @CheckForNull
        public static com.nomagic.magicdraw.ui.pathicon.PathIcon getCustomStereotypeIcon​(@CheckForNull
                                                                                         Element element)
      • draw

        public void draw​(java.awt.Graphics2D g,
                         java.awt.Point supplierPoint,
                         java.awt.Point clientPoint,
                         java.util.List<java.awt.Point> breakPoints)
        Draws link from given point pt1 through break points to given point pt2.
        Parameters:
        g - graphics
        supplierPoint - first point
        clientPoint - second point
        breakPoints - points between supplier and client points, in that order
      • internalGetBoundsShape

        @CheckForNull
        public java.awt.Shape internalGetBoundsShape​(ConverterToShape converterToShape)
      • getBoundsPath

        private java.awt.geom.GeneralPath getBoundsPath​(java.util.List<java.awt.Point> points)
      • setLineJumpPlace

        public void setLineJumpPlace​(@CheckForNull
                                     com.nomagic.magicdraw.uml.symbols.LineJumpPlace lineJumpPlace)
        Sets line jump place of the path element.
        NOTE: Only LineJumpManager can set jump place of the link. Since LineJumpManager will reset line jump place on every repaint of a diagram then other invocations of the method will not have an effect.
        Specified by:
        setLineJumpPlace in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
        Parameters:
        lineJumpPlace - new line jump place.
      • registerLineJumpInfos

        public void registerLineJumpInfos​(int pathIndex,
                                          java.awt.Point segmentStartPoint,
                                          @CheckForNull
                                          java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> lineJumps)
        Specified by:
        registerLineJumpInfos in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
      • clearRegisteredLineJumpInfos

        public void clearRegisteredLineJumpInfos()
        Specified by:
        clearRegisteredLineJumpInfos in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
      • registerLineJumpStartAngle

        public void registerLineJumpStartAngle​(int pathIndex,
                                               java.awt.Point point,
                                               double lineJumpStartAngle)
        Specified by:
        registerLineJumpStartAngle in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
      • getLineJumpStartAngle

        public double getLineJumpStartAngle​(java.awt.Point point)
      • getRoundedPath

        private java.awt.geom.GeneralPath getRoundedPath​(java.util.List<java.awt.Point> breakpoints)
        Calculates path from breakpoints for rounded link drawing.
        Parameters:
        breakpoints - path breakpoints.
        Returns:
        constructed path.
      • getPath

        private java.awt.geom.GeneralPath getPath​(java.util.List<java.awt.Point> points)
        Returns a path for normal link drawing.
        Parameters:
        points - list of break points of the path.
        Returns:
        constructed path object.
      • getLineJumpInfos

        @CheckForNull
        private java.util.List<com.nomagic.magicdraw.uml.symbols.LineJumpInfo> getLineJumpInfos​(java.awt.Point segmentStartPoint)
        Returns list of line jump info objects for the specified start point of the link segment.
        Parameters:
        segmentStartPoint - start point of the link start segment.
        Returns:
        line jump information.
      • addLineJumps

        public void addLineJumps​(java.awt.geom.GeneralPath path,
                                 java.awt.Point segmentStartPoint,
                                 java.awt.Point startPoint,
                                 @CheckForNull
                                 java.awt.Point endPoint)
        Adds line jumps to the specified path.
        Specified by:
        addLineJumps in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
        Parameters:
        path - a path object.
        segmentStartPoint - segment start point.
        startPoint - start point from which to start adding the line jumps.
        endPoint - point until which line jumps should be added.
      • isDrawLineJumps

        public boolean isDrawLineJumps()
        Returns true if the path element wants to draw line jumps.
        Specified by:
        isDrawLineJumps in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
        Returns:
        true if line jumps should be drawn for the path element.
      • getPaths

        public java.util.List<java.util.List<java.awt.Point>> getPaths()
        Returns only one path which consist of actual supplier draw point, break points of the path element and actual client draw point.
        Specified by:
        getPaths in interface com.nomagic.magicdraw.uml.symbols.LineJumpDrawer
        Returns:
        paths.
      • removeBreakPoints

        private boolean removeBreakPoints​(java.awt.Rectangle rct,
                                          int n)
        Removes break points from this link if they covered given rectangle. does not do anything if link can not be broken.
        Parameters:
        rct - rectangle which could cover link
        n - which end must remove break points ( 0- supplier, 1 - client )
        Returns:
        true, if at least one break point was removed
      • setSupplierPoint

        public void setSupplierPoint​(java.awt.Point pt)
        Sets 1st point. Sets new location for text boxes ( if point is changed, text boxes must be moved too ).
        Parameters:
        pt - new 1st point.
      • sSetSupplierPoint

        public void sSetSupplierPoint​(java.awt.Point pt)
        Sets supplier connection point.
        Parameters:
        pt - new supplier point.
      • sSetClientPoint

        public void sSetClientPoint​(java.awt.Point pt)
        Sets client connection Point.
        Parameters:
        pt - new client point.
      • setClientPoint

        public void setClientPoint​(java.awt.Point pt)
        Sets client point.
        Parameters:
        pt - new client point.
      • breakPointsChanged

        public final void breakPointsChanged​(java.util.List<java.awt.Point> oldPoints,
                                             java.util.List<java.awt.Point> newPoints)
        Moves all connection point for the links that are attached to this link middle point.
        Parameters:
        oldPoints - old breakpoint vector.
        newPoints - new breakpoint vector.
      • notifyRepaintManager

        public void notifyRepaintManager​(boolean boundsChanged)
        Description copied from class: PresentationElement
        Notifies the repaint manager about changes in bounds.
      • notifyRepaintManager

        protected final void notifyRepaintManager​(java.util.List<java.awt.Point> oldBreakpoints,
                                                  java.util.List<java.awt.Point> newBreakpoints)
      • notifyBreakPointsChanged

        public void notifyBreakPointsChanged​(java.util.List<java.awt.Point> oldPoints,
                                             java.util.List<java.awt.Point> newPoints)
        Notifies about break point vector changes
        Parameters:
        oldPoints - old points
        newPoints - new points
      • getNearestLinkPart

        public final Line getNearestLinkPart​(int x,
                                             int y)
        Returns nearest link part to specified point.
        Parameters:
        x - x of point
        y - y of point
        Returns:
        line
      • removeBreakPoints

        public boolean removeBreakPoints()
      • getSupplierPoint

        @OpenApi
        public final java.awt.Point getSupplierPoint()
        Returns point where path connects supplier end's element.
        Returns:
        supplier connection point. This method returns not cloned point, so do not modify it directly.
      • getClientPoint

        @OpenApi
        public final java.awt.Point getClientPoint()
        Returns point where path connects client end's element.
        Returns:
        client point. This method returns not cloned point, so do not modify it directly.
      • getClientDrawPoint

        public java.awt.Point getClientDrawPoint()
        Returns point where path drawing should start
        Returns:
        point
      • getActualClientDrawPoint

        public java.awt.Point getActualClientDrawPoint()
        Returns actual client side draw point.
        Returns:
        actual client draw point.
      • getActualSupplierDrawPoint

        public java.awt.Point getActualSupplierDrawPoint()
        Returns actual supplier side draw point.
        Returns:
        actual supplier draw point.
      • getSupplierDrawPoint

        public java.awt.Point getSupplierDrawPoint()
        Returns point where path drawing should start
        Returns:
        point
      • getNextPoint

        public final java.awt.Point getNextPoint​(java.awt.Point pt)
        Returns next point to a given one. If given point does not belong to the link, returns parameter point.
        Parameters:
        pt - point for which next point is necessary
        Returns:
        next point(not cloned)
      • getPreviousPoint

        public final java.awt.Point getPreviousPoint​(java.awt.Point pt)
        Returns previous point to given one. If given point does not belong to the link, returns parameter point.
        Parameters:
        pt - point for which previous point is necessary
        Returns:
        previous point(not cloned)
      • getNearestPoint

        public final java.awt.Point getNearestPoint​(java.awt.Point pt)
        Returns first break point or client point if arg is supplier point. Or returns last break point or client point if arg is client point.
        Parameters:
        pt - given point
        Returns:
        nearest point(not cloned)
      • sSetClient

        public void sSetClient​(@CheckForNull
                               PresentationElement obj)
        Sets client for this link.
        Parameters:
        obj - new client.
      • sSetSupplier

        public void sSetSupplier​(@CheckForNull
                                 PresentationElement obj)
        Sets supplier for this link.
        Parameters:
        obj - new supplier.
      • setSupplier

        public void setSupplier​(PresentationElement shape)
        Sets supplier end for link. Removes this link from old shape. Inserts this link to new shape. Method also sets supplier point to the middle point of shape.
        Parameters:
        shape - new supplier.
      • getClient

        @OpenApi
        public PresentationElement getClient()
        Returns client of the path.
        Returns:
        client element.
      • getSupplier

        @OpenApi
        public PresentationElement getSupplier()
        Returns supplier of the path.
        Returns:
        supplier end element.
      • getNextEnd

        public PresentationElement getNextEnd​(PresentationElement obj)
        Returns other than given end. If given end if supplier method returns client of this link. If given end is not supplier method returns supplier of this link.
        Parameters:
        obj - given end
        Returns:
        other opposite end
      • movePathElement

        protected void movePathElement​(PathElement link,
                                       @CheckForNull
                                       PathConnector requestor)
        Moves link. Link can connect more links ( such as note anchors in UML class diagrams ). After link was moved positions of connected links must be updated. Method checks if moving link supplier is this link recalculates supplier point moving link, otherwise it calculates client point of moving link. Point is calculated to middle point of this link.
        Parameters:
        link - link to move.
        requestor - requestor
      • optimizeLoops

        public void optimizeLoops()
        Removes loops from paths for example: path | ----------+ | | ------

        will be changed to | -----

      • coversPoint

        public boolean coversPoint​(int x,
                                   int y)
        Checks if object covers provided point
        Returns:
        true if object covers this point
      • intersects

        public final boolean intersects​(int x,
                                        int y,
                                        int width,
                                        int height)
        Check if any line between breakpoints intersect with given points of rectangle
        Returns:
        true if object and rectangle intersects
      • intersectsInternal

        public boolean intersectsInternal​(int x,
                                          int y,
                                          int width,
                                          int height)
        Check intersection with given rectangle. Intersection is counted by getting index of segment in path.
        Parameters:
        x - top left x point.
        y - top left y point.
        width - width of rectangle.
        height - height of rectangle.
        Returns:
        true if rectangle intersect with any line of path.
      • isBezierIntersects

        public boolean isBezierIntersects​(int x,
                                          int y,
                                          int width,
                                          int height)
        Check if it is bezier path intersection with rectangle.
        Parameters:
        x - top left x point of rectangle.
        y - top left y point of rectangle.
        width - width of rectangle.
        height - height of rectangle.
        Returns:
        true if bezier path intersects with rectangle.
      • getIndexOfCoveredPathInternal

        public int getIndexOfCoveredPathInternal​(int x,
                                                 int y,
                                                 int width,
                                                 int height)
        This method is used to get segment of path with witch given rectangle has intersection. It will be returned index starting from 1 of segment. This segment is counted using all breakpoints (including client and supplier point). If anybody needs end points of segments, you must take all breakpoints and take point of return index minus 1 and point of segment's index. If there is no intersection, this method return -1. For example: this method returns value 2. segmentIndex = 2; Point start and end point of this segment will be: Point startPoint = getAllBreakPoints().get(segmentIndex-1); Point endPoint = getAllBreakPoints().get(segmentIndex);
        Parameters:
        x - top left x point of rectangle.
        y - top left y point of rectangle.
        width - width of rectangle.
        height - height of rectangle.
        Returns:
        index of segment in path with witch intersect given rectangle.
      • getIndexOfCoveredPath

        public final int getIndexOfCoveredPath​(int x,
                                               int y)
        This method is used to get segment of path with witch given point has intersection. It will be returned index starting from 1 of segment. This segment is counted using all breakpoints (including client and supplier point). If anybody needs end points of segments, you must take all breakpoints and take point of return index minus 1 and point of segment's index. If there is no intersection, this method return -1. If renderer is set for path element, intersection will be counted depending on this renderer. For example: this method returns value 2. segmentIndex = 2; Point start and end point of this segment will be: Point startPoint = getAllBreakPoints().get(segmentIndex-1); Point endPoint = getAllBreakPoints().get(segmentIndex);
        Parameters:
        x - point x value.
        y - point y value.
        Returns:
        index of segment of path which intersects with the given point.
      • getNewBreakPointIndex

        public int getNewBreakPointIndex​(java.awt.Point point,
                                         java.util.List<java.awt.Point> brk)
        Find the nearest breakpoints for new one and calculate the position of the new breakpoint in breakpoint vector. Used for new breakpoint calculation for bezier curve.
        Parameters:
        point - the new point.
        brk - the breakpoint Vector.
        Returns:
        position in that the new point must be inserted in a breakpoint vector.
      • isConnectable

        @OpenApi
        public final boolean isConnectable​(@CheckForNull
                                           PresentationElement supplier,
                                           @CheckForNull
                                           PresentationElement client)
        Checks if this path can connect given two elements.
        Parameters:
        supplier - candidate for path's supplier.
        client - candidate for path's client.
        Returns:
        true, if path can connect given elements.
      • isConnectable

        public final boolean isConnectable​(@CheckForNull
                                           PresentationElement supplier,
                                           @CheckForNull
                                           PresentationElement client,
                                           @CheckForNull
                                           java.util.Map<java.lang.Object,​java.lang.Object> options)
        Checks if this path can connect given two elements.
        Parameters:
        supplier - candidate for path's supplier.
        client - candidate for path's client.
        options - options
        Returns:
        true, if path can connect given elements.
      • getMiddlePoint

        public java.awt.Point getMiddlePoint()
        Calculates and returns middle point of link. For this link it is average between supplier's and client's points.
        Overrides:
        getMiddlePoint in class PresentationElement
        Returns:
        middle point.
      • getPointOnPath

        @OpenApi
        public java.awt.Point getPointOnPath​(java.awt.Point supplierPoint,
                                             java.awt.Point clientPoint,
                                             java.util.List<java.awt.Point> breakpoints,
                                             double coefficient)
        Parameters:
        supplierPoint - supplier end point
        clientPoint - client end point
        breakpoints - list of breakpoints between supplier and client in that order
        coefficient - ratio between 0 and 1 describing position relative to the paths length. Provide 0.5 for middle point.
        Returns:
        point on path
      • getPointsList

        private java.util.List<java.awt.Point> getPointsList​(java.awt.Point supplierPoint,
                                                             java.awt.Point clientPoint,
                                                             java.util.List<java.awt.Point> breakpoints)
      • getPointOnBezierAtIndex

        private static java.awt.Point getPointOnBezierAtIndex​(java.awt.Point supplierPoint,
                                                              java.util.List<java.awt.Point> pointList,
                                                              int index)
      • getBezierLinePoints

        private java.util.List<java.awt.Point> getBezierLinePoints​(java.awt.Point supplierPoint,
                                                                   java.awt.Point clientPoint,
                                                                   java.util.Collection<java.awt.Point> breakpoints)
      • getBezierLinePoints

        private java.util.List<java.awt.Point> getBezierLinePoints()
      • getBezierLinePoints

        private java.util.List<java.awt.Point> getBezierLinePoints​(java.util.List<java.awt.Point> allBreakPoints)
      • dispose

        public void dispose()
        Disconnect this link from shapes.
        Specified by:
        dispose in interface BaseElement
      • atInsert

        public void atInsert()
        Inserts ends of link into shapes.
        Specified by:
        atInsert in interface BaseElement
      • addConnectedPathElement

        public boolean addConnectedPathElement​(PathElement link)
        Method to add sub link to this link. If link is note anchor it will be added to this link. If link is not note anchor, it will be added to generalization tree.
        Parameters:
        link - link to be added.
        Returns:
        true if element was added
      • getNotCopyBounds

        public final java.awt.Rectangle getNotCopyBounds()
        Description copied from class: PresentationElement
        get not copy bounds of object throws NoRectangleDefinedException
        Returns:
        rectangle of bounds
      • setCachedPathBounds

        protected void setCachedPathBounds​(@CheckForNull
                                           java.awt.Rectangle r)
      • calculatePathBounds

        public java.awt.Rectangle calculatePathBounds​(java.awt.Point supplier,
                                                      java.awt.Point client,
                                                      java.util.List<java.awt.Point> breaks)
      • accept

        @OpenApi
        public void accept​(Visitor visitor)
                    throws java.lang.Exception
        Description copied from interface: MDElement
        Method accepts visitor, and calls method visit<class name>(this) of visitor . See Visitor pattern for more details.
        Specified by:
        accept in interface MDElement
        Overrides:
        accept in class PathConnector
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • setRectilinear

        public void setRectilinear()
        Sets link rectilinear property value.
      • isRectilinearized

        private static boolean isRectilinearized​(java.util.List<java.awt.Point> vct)
        Checks whether points in specified vector make up rectilinear polyline.
        Parameters:
        vct - - vector of points.
        Returns:
        true if points in specified vector make up rectilinear polyline otherwise false.
      • isRectilinear

        public boolean isRectilinear()
        Returns:
        true if link path style is rectilinear.
      • isOblique

        public boolean isOblique()
        Returns:
        true if link path style is oblique.
      • makeRectilinear

        public void makeRectilinear()
        Makes link rectilinear.
      • makeRectilinear

        public void makeRectilinear​(boolean notify)
        Makes link rectilinear.
        Parameters:
        notify - notify about this change
      • moveConnectedElements

        private void moveConnectedElements()
      • smartRemoveRedundantBreakpoints

        private static boolean smartRemoveRedundantBreakpoints​(java.util.List<java.awt.Point> breakpoints)
        Gets rid of small rectangular polyline corners on the path.
        Parameters:
        breakpoints - - a list of breakpoints to fix.
        Returns:
        true if breakpoints have been changed, false otherwise.
      • removeRedundantBreakPoints

        public void removeRedundantBreakPoints​(java.util.List<java.awt.Point> vct)
        Removes redundant break points from link. Removes breaks only from rectilinear link.
        Parameters:
        vct - points
      • doRectilinear

        private boolean doRectilinear​(java.util.List<java.awt.Point> points)
        Makes rectilinear polyline from specified points.
        Parameters:
        points - vector of points.
        Returns:
        vector of points. Points in the vector make up rectilinear polyline.
      • makeSmartFlowLayoutPath

        private boolean makeSmartFlowLayoutPath​(java.util.List<java.awt.Point> breakpoints)
        Adjusts breakpoints according smart flow layout rules.
        Parameters:
        breakpoints - - a list of current break points.
        Returns:
        true if breakpoints have been adjusted.
      • isVertical

        public boolean isVertical()
        Indicates if path element is drawn in the diagram which has vertical orientation.
        Returns:
        true if diagram is vertical, false otherwise.
      • removeBreaks

        public void removeBreaks​(java.util.List<java.awt.Point> points)
        Removes all break points if they are covered by client or client bounds.
        Parameters:
        points - points
      • swapEnds

        public void swapEnds()
        Swaps ends of the link
      • setClient

        public void setClient​(PresentationElement shape)
        Sets client for this link. Changes parent object to the parent of client. Client's parent will always contain incoming links.
        Parameters:
        shape - shape to check
      • moveLinkToClientParent

        public void moveLinkToClientParent​(boolean simpleAdd)
      • internalSnapToGrid

        protected void internalSnapToGrid​(float step)
      • isSnapToGrid

        protected boolean isSnapToGrid()
      • canChangeSupplier

        public boolean canChangeSupplier()
        Returns:
        true, if view can change supplier.
      • canChangeClient

        public boolean canChangeClient()
        Returns:
        true, if view can change client
      • isElementEditableOrNoElement

        private boolean isElementEditableOrNoElement()
      • canClearBreakPoints

        public boolean canClearBreakPoints()
        Returns:
        true if link can be modified (all break points can be removed):
      • canChangeLineStyle

        public boolean canChangeLineStyle()
        Returns:
        true if this link can change line style.
      • internalApplyProperties

        public void internalApplyProperties​(PropertyManager man)
        Applies properties
        Parameters:
        man - new properties
      • draw

        public void draw​(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
        abstract method for drawing ViewObject object used to draw object on graphics
        Parameters:
        context - Graphics on which object should be drawn
      • getIntersection

        public java.awt.Point getIntersection​(int x,
                                              int y,
                                              @CheckForNull
                                              PathElement path)
      • findOtherExistingElement

        @CheckForNull
        public Element findOtherExistingElement()
        Finds and returns model element which meaning is the same as this link model element. This method should be used for Generalization and (maybe)other links. Default behavior is to return model element of this link. This method should be overridden in generalization and (maybe) other links. Make sure that ends are set before calling this method.
        Returns:
        element
      • getBezierPath

        public java.awt.geom.GeneralPath getBezierPath()
        Calculates path for bezier curve drawing.
        Returns:
        bezier path
      • isBezier

        public boolean isBezier()
        Returns:
        true if LINK_LINE_STYLE property value equals to BEZIER.
      • getLinkLineStyle

        public java.lang.String getLinkLineStyle()
        Returns:
        LINK_LINE_STYLE property value
      • sSetLinkLineStyle

        public void sSetLinkLineStyle​(java.lang.String style)
        Change value of LINK_LINE_STYLE property.
        Parameters:
        style - the line style.
      • setLinkLineStyle

        public void setLinkLineStyle​(java.lang.String style)
        sets LINK_LINE_STYLE property value.
        Parameters:
        style - the line style.
      • internalSilentApply

        public void internalSilentApply()
        Description copied from class: PresentationElement
        Silently applies all properties after initialization
      • handleRemoveBreaksAction

        public com.nomagic.magicdraw.commands.Command handleRemoveBreaksAction()
      • nextStyle

        public java.lang.String nextStyle()
        Returns:
        link style for TOGGLE LINK STYLE command.
      • getBezierPath

        public java.awt.geom.GeneralPath getBezierPath​(java.util.List<java.awt.Point> points)
        Calculates path from breakpoints for bezier curve drawing.
        Parameters:
        points - points
        Returns:
        path
      • recalculateArc

        private static int recalculateArc​(int arc,
                                          java.awt.Point p1,
                                          java.awt.Point p2)
      • prepareForLineDrawing

        public boolean prepareForLineDrawing​(java.awt.Graphics2D g,
                                             boolean line)
        Prepares graphics for line drawing. Calls super prepareForLineDrawing and sets stroke.
        Parameters:
        g - graphics
        line - true if for line, false if for adornments also
        Returns:
        stroke
      • applyStrokeForLineDrawing

        public static void applyStrokeForLineDrawing​(PresentationElement pathElement,
                                                     java.awt.Graphics2D g,
                                                     boolean line,
                                                     java.awt.BasicStroke stroke)
      • internalGetPresentationElementStroke

        public java.awt.BasicStroke internalGetPresentationElementStroke​(boolean line,
                                                                         int width)
        This method must be overridden, if you need to use DASHED_STROKE or another one.
        Parameters:
        line - true if for line, false if for adornments also
        width - width
        Returns:
        the stroke for line drawing ( by default SOLID_STROKE).
      • internalGetPresentationElementStroke

        protected java.awt.BasicStroke internalGetPresentationElementStroke​(boolean line,
                                                                            int lineStyle,
                                                                            int width)
      • changeParentForTree

        private void changeParentForTree​(PresentationElement parent)
        Move tree to other parent if all classes of this tree is in this new parent
        Parameters:
        parent - parent
      • prepareForFillDrawing

        public boolean prepareForFillDrawing​(java.awt.Graphics2D g,
                                             int x1,
                                             int y1,
                                             int x2,
                                             int y2)
        Description copied from class: PresentationElement
        Prepares graphics for fill drawing. Sets fill color if useFill property is set. Sets gradient if useGradientForFill() method returns true.
        Parameters:
        g - the given graphics
        x1 - gradient first point x
        y1 - gradient first point y
        x2 - gradient second point x
        y2 - gradient second point y
        Returns:
        true, if symbol can be filled
        See Also:
        PresentationElement.isUseGradientForFill(), PresentationElement.isUseFillColor()
      • internalGetPresentationElementStroke

        public java.awt.BasicStroke internalGetPresentationElementStroke​(int width)
        Description copied from class: PresentationElement
        Return a stroke used to paint symbol's main part
        Parameters:
        width - a custom stroke width. Other stroke parameters will be specific to symbol
        Returns:
        a stroke used to paint symbol's main part
      • paintSelf

        public void paintSelf​(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
      • getPathPainter

        public com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter<PathElement> getPathPainter()
      • setPathPainter

        protected final void setPathPainter​(com.nomagic.magicdraw.uml.symbols.paths.painters.PathPainter pathPainter)
      • getSupplierConnectionType

        public int getSupplierConnectionType()
      • getClientConnectionType

        public int getClientConnectionType()
      • getDefaultParentForData

        @CheckForNull
        public Element getDefaultParentForData()
        Presentation element could suggest parent, which would be more acceptable, than adding to the client If returning null, general mechanism will work
        Returns:
        parent for data
      • hasClientPoint

        protected boolean hasClientPoint()
        Check if client point is already not null
        Returns:
        true if client point is set
      • hasSupplierPoint

        protected boolean hasSupplierPoint()
        Check if supplier point is already not null
        Returns:
        true if supplier point is set
      • isRounded

        public boolean isRounded()
        Returns value of the "Is Rounded" path symbol property.
        Returns:
        value of the "Is Rounded" property.
      • setRounded

        public void setRounded​(boolean rounded)
        Sets value of the "Is Rounded" path symbol property.
        Parameters:
        rounded - - value of the "Is Rounded" property.
      • sSetRounded

        public void sSetRounded​(boolean rounded)
        Sets value of the "Is Rounded" path symbol property.
        Parameters:
        rounded - - value of the "Is Rounded" property.
      • isUseFlowLayoutLogic

        public boolean isUseFlowLayoutLogic()
        Indicates if smart path/shape edit should be used in this diagram.
        Returns:
        true if smart symbol editing should be used, false otherwise.
      • isSmartLayoutNeeded

        public boolean isSmartLayoutNeeded()
        Returns smart layout needed flag.
        Returns:
        value of smart layout needed flag.
      • setSmartLayoutNeeded

        public void setSmartLayoutNeeded​(boolean smartLayoutNeeded)
        Sets smart layout needed flag.
        Parameters:
        smartLayoutNeeded - - smart layout needed flag value.
      • resetCache

        protected void resetCache()
      • cacheValues

        protected void cacheValues​(java.awt.Point cachedActualSupplierDrawPoint,
                                   java.awt.Point cachedActualClientDrawPoint,
                                   java.awt.Point cacheSupplierDrawPoint,
                                   java.awt.Point cacheClientDrawPoint,
                                   java.util.List<java.awt.Point> cacheBreakPoints)
      • cacheActualDrawPoints

        protected void cacheActualDrawPoints​(java.awt.Point supplierDrawPoint,
                                             java.awt.Point clientDrawPoint,
                                             java.util.List<java.awt.Point> breakPoints)
      • getCachedActualClientDrawPoint

        public java.awt.Point getCachedActualClientDrawPoint()
      • getCachedActualSupplierDrawPoint

        public java.awt.Point getCachedActualSupplierDrawPoint()
      • validateActualDrawPointsCache

        private void validateActualDrawPointsCache()
      • resizeParent

        public void resizeParent()
        Do nothing, because path does not affect parent size
      • getCustomSupplierPoint

        public java.awt.Point getCustomSupplierPoint()
      • setCustomSupplierPoint

        public void setCustomSupplierPoint​(java.awt.Point point)
      • getCustomClientPoint

        public java.awt.Point getCustomClientPoint()
      • setCustomClientPoint

        public void setCustomClientPoint​(java.awt.Point point)
      • preDisposeOnUpdate

        protected boolean preDisposeOnUpdate()
        Description copied from class: PresentationElement
        Validate symbol against model and try to fix it before actual symbol update. If symbol is not valid and can not be fixed, request symbol dispose by returning true. Check if symbol should be disposed, because model does not correspond to symbol. This may happen for example if path supplier or client in model is changed, but path still is connected to symbols of old ends.

        Method also can fix symbol if possible - for example reconnect path to other symbols in diagram and etc.

        Returns:
        true if symbol must be disposed
      • createSmartListenerConfig

        protected void createSmartListenerConfig​(java.util.List<SmartListenerConfig> configurations)
      • internalMovedAsToSelf

        public void internalMovedAsToSelf​(int dx,
                                          int dy)
        This is an internal method to notify link that it was moved by connecting shape as link "to self"
        Parameters:
        dx - delta x
        dy - delta y
      • hasManipulator

        public boolean hasManipulator()
        Description copied from class: PresentationElement
        Returns true, if view has manipulator (is selectable)
      • getSuspendShapeAutoResizeMode

        public java.lang.String getSuspendShapeAutoResizeMode()
        Specified by:
        getSuspendShapeAutoResizeMode in interface com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
      • sSetSuspendShapeAutoResizeMode

        public void sSetSuspendShapeAutoResizeMode​(java.lang.String mode)
      • setSuspendShapeAutoResizeMode

        public void setSuspendShapeAutoResizeMode​(java.lang.String mode)