Class ContainmentLinkView

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

    @OpenApi
    public class ContainmentLinkView
    extends PathElement
    implements com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
    Containment relationship symbol
    • Field Detail

      • simple

        private boolean simple
      • childElement

        private NamedElement childElement
        Child element of this containment link - client model element. We need to keep additional reference to this element in order to have it available for calculations if client for link itself changes.
    • Constructor Detail

      • ContainmentLinkView

        public ContainmentLinkView​(@CheckForNull
                                   PresentationElement parent)
      • ContainmentLinkView

        public ContainmentLinkView()
    • Method Detail

      • paintChildren

        public void paintChildren​(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
      • getActualClientDrawPoint

        public java.awt.Point getActualClientDrawPoint()
        Description copied from class: PathElement
        Returns actual client side draw point.
        Returns:
        actual client draw point.
      • getActualSupplierDrawPoint

        public java.awt.Point getActualSupplierDrawPoint()
        Description copied from class: PathElement
        Returns actual supplier side draw point.
        Returns:
        actual supplier draw point.
      • drawAnchor

        public java.awt.Point drawAnchor​(java.awt.Graphics2D g,
                                         int ix1,
                                         int iy1,
                                         int ix2,
                                         int iy2,
                                         int size,
                                         boolean fill,
                                         java.awt.Color fillColor)
        Specified by:
        drawAnchor in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • accept

        public void accept​(Visitor visitor)
                    throws java.lang.Exception
        accept method for Visitor
        Specified by:
        accept in interface MDElement
        Overrides:
        accept in class PathElement
        Parameters:
        visitor - - the Visitor
        Throws:
        java.lang.Exception
      • setSupplier

        public void setSupplier​(PresentationElement shape)
        Description copied from class: PathElement
        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.
      • setClient

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

        private void changeSecondEndElementParent()
        Move second end model element into first end model element.
      • containsAddObjectViewCommand

        private static boolean containsAddObjectViewCommand​(java.util.Collection<com.nomagic.magicdraw.commands.Command> commands)
        Indicates if a list of commands contains an AddObjectViewCommon macro command.
        Parameters:
        commands - list of commands in which to check.
        Returns:
        true if list contains AddObjectViewCommon command, false otherwise.
      • setChildElement

        public void setChildElement​(@CheckForNull
                                    NamedElement newChild)
        Change child element of this containment link. Registers listener to a new child (removes listener from the old one)
        Parameters:
        newChild - child
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent evt)
        Description copied from class: PresentationElement
        Listens for property change it can be: data was edited text box was edited
        Specified by:
        propertyChange in interface java.beans.PropertyChangeListener
      • 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
      • isRectilinear

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

        public void setSimple​(boolean simple)
        Specified by:
        setSimple in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • sSetSimple

        public void sSetSimple​(boolean simple)
        Specified by:
        sSetSimple in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • isSimple

        public boolean isSimple()
        Specified by:
        isSimple in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • setTreeView

        public void setTreeView​(TreeView tree)
        Sets new tree view.
        Specified by:
        setTreeView in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
        Parameters:
        tree - new tree of this link.
      • sSetTreeView

        public void sSetTreeView​(TreeView tree)
        Sets new tree view.
        Specified by:
        sSetTreeView in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
        Parameters:
        tree - new tree of this link.
      • getTreeView

        @CheckForNull
        public TreeView getTreeView()
        Specified by:
        getTreeView in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • dispose

        public void dispose()
        Description copied from class: PathElement
        Disconnect this link from shapes.
        Specified by:
        dispose in interface BaseElement
      • retrieveDataFromTreeView

        public void retrieveDataFromTreeView​(TreeView tree)
        Specified by:
        retrieveDataFromTreeView in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector
      • internalGetPresentationElementStroke

        public java.awt.BasicStroke internalGetPresentationElementStroke​(boolean line,
                                                                         int width)
        Description copied from class: PathElement
        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).
      • getInternalStroke

        public java.awt.BasicStroke getInternalStroke​(boolean line,
                                                      int width)
        Specified by:
        getInternalStroke in interface com.nomagic.magicdraw.uml.symbols.paths.TreeViewConnector