Class PortView

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

    @OpenApi
    public class PortView
    extends com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
    implements com.nomagic.magicdraw.uml.symbols.shapes.PortOwner
    • Field Detail

      • updateNestedPorts

        private boolean updateNestedPorts
    • Constructor Detail

      • PortView

        public PortView()
    • Method Detail

      • getElement

        public Port 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.
      • getPort

        public static Port getPort​(PresentationElement symbol)
        Parameters:
        symbol - symbol
        Returns:
        return element of given symbol as Port
      • isPort

        public static boolean isPort​(PresentationElement element)
        Check if given symbol represents Port
        Parameters:
        element - symbol
        Returns:
        true if symbol is PortView or PartView which represents Port
      • createLabels

        protected void createLabels()
        Overrides:
        createLabels in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
      • internalSpecificUpdate

        protected void internalSpecificUpdate()
        Overrides:
        internalSpecificUpdate in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
      • updateNameBox

        public void updateNameBox()
        Overrides:
        updateNameBox in class com.nomagic.magicdraw.uml.symbols.shapes.ShapeWithLabels
      • getRequiredInterfaceLabelWrapper

        public com.nomagic.magicdraw.uml.symbols.shapes.RequiredInterfaceLabelWrapper getRequiredInterfaceLabelWrapper()
      • getProvidedInterfaceLabelWrapper

        public com.nomagic.magicdraw.uml.symbols.shapes.ProvidedInterfaceLabelWrapper getProvidedInterfaceLabelWrapper()
      • getRequiredInterfacesLabelBox

        @CheckForNull
        public com.nomagic.magicdraw.uml.symbols.shapes.TextBoxWithIconView getRequiredInterfacesLabelBox()
      • getProvidedInterfacesLabelBox

        @CheckForNull
        public final com.nomagic.magicdraw.uml.symbols.shapes.TextBoxWithIconView getProvidedInterfacesLabelBox()
      • getBorderOwnerExcludingPort

        public PresentationElement getBorderOwnerExcludingPort()
        Gets owner of the border on which this port lies. Does not take into consideration nested ports.
        Returns:
        symbol on which this port lies, excluding nested ports.
      • isRightOwnerForPort

        private static boolean isRightOwnerForPort​(BaseElement modelOwner,
                                                   @CheckForNull
                                                   Classifier viewOwner)
      • getPort

        @OpenApi
        @Deprecated
        public Port getPort()
        Deprecated.
        use #getElement
        Gets port represented by this port symbol.
      • 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.shapes.TypedElementWithLabels
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • canChangeParent

        public boolean canChangeParent​(java.util.Collection<? extends PresentationElement> movedTogether,
                                       @CheckForNull
                                       BaseElement newParent,
                                       boolean changeElementParent)
        Description copied from class: PresentationElement
        Returns true, if element can change parent.
        Parameters:
        movedTogether - collection of the elements, whose will change the parent together with this.
        newParent - new symbol parent
        changeElementParent - change element parent
        Returns:
        true if parent of symbol can be changed
      • isSnapToGrid

        protected boolean isSnapToGrid()
      • setOnEdge

        public void setOnEdge​(int onEdge)
        Description copied from class: ShapeElement
        Sets on edge property.
        Parameters:
        onEdge - the edge constant
        See Also:
        ShapeElement.getOnEdge()
      • adjustPositionForProvidedInterfacesLabel

        public void adjustPositionForProvidedInterfacesLabel()
      • adjustPositionForRequiredInterfacesLabel

        public void adjustPositionForRequiredInterfacesLabel()
      • internalGetElementToConnectLink

        public Element internalGetElementToConnectLink​(@CheckForNull
                                                       Element path,
                                                       boolean asClient)
        Description copied from class: PresentationElement
        Returns element that should be used for given link connecting. All possible elements are return by method getElementsForLinkConnecting. Usually this method should be overridden together with getElementsForLinkConnecting().
        Returns:
        all possible elements
        See Also:
        PresentationElement.getElementsForLinkConnecting()
      • internalGetElementsForLinkConnecting

        public java.util.Collection<? extends Element> internalGetElementsForLinkConnecting()
        Description copied from class: PresentationElement
        Returns all possible element that can be used for some link connecting. One of these elements are return in method getElementToConnectLink() in specific situation. Usually this method should be overridden together with getElementsForLinkConnecting().
        Returns:
        all possible elements
        See Also:
        PresentationElement.getElementToConnectLink(Element, boolean)
      • createSmartListenerConfig

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

        public Element findParentForData​(PresentationElement newParent,
                                         com.nomagic.uml2.ElementAddContext addContext)
      • isShowRequiredInterfaces

        public boolean isShowRequiredInterfaces()
      • isShowProvidedInterfaces

        public boolean isShowProvidedInterfaces()
      • sSetShowProvidedInterfaces

        public void sSetShowProvidedInterfaces​(boolean show)
      • setShowProvidedInterfaces

        public void setShowProvidedInterfaces​(boolean show)
      • sSetShowRequiredInterfaces

        public void sSetShowRequiredInterfaces​(boolean show)
      • setShowRequiredInterfaces

        public void setShowRequiredInterfaces​(boolean show)
      • isDrawRectangle

        protected boolean isDrawRectangle()
        Overrides:
        isDrawRectangle in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
      • canAddInstance

        public boolean canAddInstance​(PresentationElement obj)
        Description copied from class: PresentationElement
        Object view has no children.
        Overrides:
        canAddInstance in class com.nomagic.magicdraw.uml.symbols.shapes.ShapeWithLabels
      • getProxyPresentationElementsStream

        protected java.util.stream.Stream<PresentationElement> getProxyPresentationElementsStream()
        Overrides:
        getProxyPresentationElementsStream in class com.nomagic.magicdraw.uml.symbols.shapes.AbstractHeaderShapeView
      • getEncapsulatedClassifier

        public EncapsulatedClassifier getEncapsulatedClassifier()
        Specified by:
        getEncapsulatedClassifier in interface com.nomagic.magicdraw.uml.symbols.shapes.PortOwner
      • getIconPositionForProvidedHorizontal

        public com.nomagic.magicdraw.uml.symbols.shapes.Alignment getIconPositionForProvidedHorizontal()
      • getIconPositionForProvidedVertical

        public com.nomagic.magicdraw.uml.symbols.shapes.Alignment getIconPositionForProvidedVertical()
      • getDefaultHorizontalPositionForProvidedLabel

        protected com.nomagic.magicdraw.uml.symbols.shapes.Alignment getDefaultHorizontalPositionForProvidedLabel()
      • getDefaultVerticalPositionForProvidedLabel

        protected com.nomagic.magicdraw.uml.symbols.shapes.Alignment getDefaultVerticalPositionForProvidedLabel()
      • isShowInheritedSign

        public boolean isShowInheritedSign()
        Returns:
        true if inherited sign is shown
      • sSetShowInheritedSign

        public void sSetShowInheritedSign​(boolean showInheritedSign)
        Show inherited sign
        Parameters:
        showInheritedSign - show
      • setShowInheritedSign

        public void setShowInheritedSign​(boolean showInheritedSign)
        Show inherited members sign in compartment
        Parameters:
        showInheritedSign - show
      • isShowMultiplicity

        public boolean isShowMultiplicity()
      • setShowMultiplicity

        public void setShowMultiplicity​(boolean showMultiplicity)
      • sSetShowMultiplicity

        public void sSetShowMultiplicity​(boolean showMultiplicity)
      • internalApplyProperties

        public void internalApplyProperties​(PropertyManager propertyManager)
        Description copied from class: PresentationElement
        Applies properties from given property manager
        Overrides:
        internalApplyProperties in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
        Parameters:
        propertyManager - new properties
      • internalSilentApply

        public void internalSilentApply()
        Description copied from class: PresentationElement
        Silently applies all properties after initialization
        Overrides:
        internalSilentApply in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
      • getPortConnectionPoint

        private java.awt.Point getPortConnectionPoint​(com.nomagic.magicdraw.uml.symbols.shapes.Alignment labelPositionHorizontal,
                                                      com.nomagic.magicdraw.uml.symbols.shapes.Alignment labelPositionVertical)
        Finds connection point on the port by the label position
        Parameters:
        labelPositionHorizontal - horizontal position
        labelPositionVertical - vertical position
        Returns:
        connection point
      • getIconPositionForRequiredHorizontal

        public com.nomagic.magicdraw.uml.symbols.shapes.Alignment getIconPositionForRequiredHorizontal()
      • getIconPositionForRequiredVertical

        public com.nomagic.magicdraw.uml.symbols.shapes.Alignment getIconPositionForRequiredVertical()
      • getDefaultHorizontalPositionForRequiredLabel

        protected com.nomagic.magicdraw.uml.symbols.shapes.Alignment getDefaultHorizontalPositionForRequiredLabel()
        Default position required lollipop. Gives if it is on the right or left according port view or, if lollipop are at the top or bottom regarding to the portView, then gives right or left according PROVIDED lollipop
        Returns:
        position
        See Also:
        Alignment.RIGHT, Alignment.LEFT
      • getDefaultVerticalPositionForRequiredLabel

        protected com.nomagic.magicdraw.uml.symbols.shapes.Alignment getDefaultVerticalPositionForRequiredLabel()
        Default position required lollipop. Gives if it is on the top or bottom according port view or, if lollipop are at the left or right regarding to the portView, then gives right or left according PROVIDED lollipop
        Returns:
        position
        See Also:
        Alignment.TOP, Alignment.BOTTOM
      • adjustPositionFor

        private static void adjustPositionFor​(com.nomagic.magicdraw.uml.symbols.shapes.TextBoxWithIconView view,
                                              com.nomagic.magicdraw.uml.symbols.shapes.Alignment iconPositionHorizontal,
                                              com.nomagic.magicdraw.uml.symbols.shapes.Alignment iconPositionVertical)
      • paintSelf

        public void paintSelf​(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context)
        Overrides:
        paintSelf in class com.nomagic.magicdraw.uml.symbols.shapes.TypedElementWithLabels
      • drawLinesToInterfacesLabels

        public void drawLinesToInterfacesLabels​(java.awt.Graphics2D g)
        Draw lines to interfaces labels.
        Parameters:
        g - graphics
      • drawLineToLabel

        public void drawLineToLabel​(java.awt.Graphics g,
                                    com.nomagic.magicdraw.uml.symbols.shapes.TextBoxWithIconView label,
                                    com.nomagic.magicdraw.uml.symbols.shapes.Alignment labelPositionHorizontal,
                                    com.nomagic.magicdraw.uml.symbols.shapes.Alignment labelPositionVertical)
      • propertyChange

        public void propertyChange​(java.beans.PropertyChangeEvent e)
        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
      • getEncapsulatedClassifierProvider

        public TypedElement getEncapsulatedClassifierProvider()
        Specified by:
        getEncapsulatedClassifierProvider in interface com.nomagic.magicdraw.uml.symbols.shapes.PortOwner
      • isUpdateNestedPorts

        private boolean isUpdateNestedPorts()
      • setUpdateNestedPorts

        private void setUpdateNestedPorts​(boolean updateNestedPorts)