Class DurationConstraintView

  • All Implemented Interfaces:
    BaseElement, com.nomagic.magicdraw.uml.CompartmentSupport, MDElement, ModelElementProvider, com.nomagic.magicdraw.uml.symbols.LabelOwner, com.nomagic.magicdraw.uml.symbols.LineJumpDrawer, StereotypesDisplayModeOwner, com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider, NameOwner, java.beans.PropertyChangeListener, java.lang.Cloneable, java.lang.Comparable, java.util.EventListener

    @OpenApi
    public class DurationConstraintView
    extends com.nomagic.magicdraw.uml.symbols.paths.LinkWithStereotype
    • Constructor Detail

      • DurationConstraintView

        public DurationConstraintView()
      • DurationConstraintView

        public DurationConstraintView​(@CheckForNull
                                      PresentationElement parent)
    • Method Detail

      • accept

        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 com.nomagic.magicdraw.uml.symbols.paths.LinkWithStereotype
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • getSupplierConnectionType

        public int getSupplierConnectionType()
        Overrides:
        getSupplierConnectionType in class com.nomagic.magicdraw.uml.symbols.paths.ContainerLinkView
      • getDefaultParentForData

        @CheckForNull
        public Element getDefaultParentForData()
        Description copied from class: PathElement
        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
      • canBeDeleted

        public boolean canBeDeleted()
        Description copied from interface: BaseElement
        Checks if element can be deleted from project. Element cannot be deleted if it is not isEditable(), parent is not set or parent does not allow to remove this element.
        Specified by:
        canBeDeleted in interface BaseElement
        Overrides:
        canBeDeleted in class com.nomagic.magicdraw.uml.MDElementImpl
        Returns:
        true, if element can be deleted from project.
        See Also:
        BaseElement.isEditable()
      • getConnectionPoint

        private java.awt.Point getConnectionPoint​(java.awt.Point point,
                                                  PresentationElement pe,
                                                  java.awt.Point break1,
                                                  java.awt.Point break2)
      • draw

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

        protected void createSmartListenerConfig​(java.util.List<SmartListenerConfig> configurations)
        Overrides:
        createSmartListenerConfig in class com.nomagic.magicdraw.uml.symbols.paths.LinkWithStereotype
      • internalUpdatePresentationElement

        protected void internalUpdatePresentationElement()
        Description copied from class: PresentationElement
        Internal symbol update method for subclassing. It is called from update as part of full update action.
        Overrides:
        internalUpdatePresentationElement in class com.nomagic.magicdraw.uml.symbols.paths.ContainerLinkView
        See Also:
        PresentationElement.update()
      • getRecalculatedConnectionPoint

        private java.awt.Point getRecalculatedConnectionPoint​(PresentationElement pe,
                                                              java.awt.Point defaultPoint)
      • recalculateBreakPoints

        private void recalculateBreakPoints​(java.util.List<java.awt.Point> breakPoints,
                                            int breakPointIndex,
                                            int oppositeBreakPointIndex,
                                            PresentationElement pe)
      • containsBreakpoint

        private static boolean containsBreakpoint​(java.awt.Point break1,
                                                  java.awt.Rectangle clientPEBounds)
      • getEndPoint

        public java.awt.Point getEndPoint​(boolean forSupplier)
        Returns client or supplier point of the end element
        Parameters:
        forSupplier - true if point is calculated for supplier end of this link
        Returns:
        nearest end
      • getSeqBaseMessageNearestEnd

        private java.awt.Point getSeqBaseMessageNearestEnd​(com.nomagic.magicdraw.uml.symbols.paths.SeqBaseMessageView message,
                                                           boolean forSupplier)
      • getMessageIntersectionPoint

        public java.awt.Point getMessageIntersectionPoint​(PresentationElement end,
                                                          int x)
        Returns point, where message link intersects straight line described by x
        Parameters:
        end - end
        x - coordinate
        Returns:
        point
      • getSeqBaseMessageIntersectionPoint

        @Nonnull
        private java.awt.Point getSeqBaseMessageIntersectionPoint​(PresentationElement message,
                                                                  int x)
      • updateNameBox

        public void updateNameBox()
        Overrides:
        updateNameBox in class com.nomagic.magicdraw.uml.symbols.paths.ContainerLinkView
      • resetToDefaultPosition

        public void resetToDefaultPosition()
        Reset constraint view to the default position
      • rectanglesOverlapsByX

        private static boolean rectanglesOverlapsByX​(java.awt.Rectangle rClient,
                                                     java.awt.Rectangle rSupplier)
      • shouldDurationConstraintBeOnTheLeft

        private boolean shouldDurationConstraintBeOnTheLeft​(PresentationElement target)
      • getGapByConnectedMessage

        private static int getGapByConnectedMessage​(PresentationElement target)
        method to determine if duration should be drawn to the left or right, when the client and supplier for the duration is the same target symbol
      • getSupplierConnectionPoint

        private java.awt.Point getSupplierConnectionPoint​(PresentationElement view)
      • getClientConnectionPoint

        private java.awt.Point getClientConnectionPoint​(PresentationElement view)
      • getShapeConnectionPoint

        private java.awt.Point getShapeConnectionPoint​(PresentationElement view,
                                                       boolean forSupplier)
      • getMiddlePoint

        public java.awt.Point getMiddlePoint()
        Description copied from class: PathElement
        Calculates and returns middle point of link. For this link it is average between supplier's and client's points.
        Returns:
        middle point.
      • getElement

        public DurationConstraint getElement()
        Description copied from class: PresentationElement
        Returns model element of this presentation element. Some presentation elements (for example TextBoxes) do not have model elements.
        Specified by:
        getElement in interface com.nomagic.magicdraw.uml.symbols.LabelOwner
        Specified by:
        getElement in interface ModelElementProvider
        Overrides:
        getElement in class PresentationElement
        Returns:
        model element of this presentation element.
      • canChangeLineStyle

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

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