Class AbstractDiagramPresentationElement

  • All Implemented Interfaces:
    com.nomagic.magicdraw.core.diagram.DiagramPresentationImplementer, BaseElement, MDElement, ModelElementProvider, NameOwner, java.beans.PropertyChangeListener, java.lang.Cloneable, java.lang.Comparable, java.util.EventListener
    Direct Known Subclasses:
    DiagramPresentationElement

    @OpenApi
    public abstract class AbstractDiagramPresentationElement
    extends PresentationElement
    implements com.nomagic.magicdraw.core.diagram.DiagramPresentationImplementer
    • Method Detail

      • collectShowingManipulatedElementsRecursively

        @OpenApi
        public java.util.Collection<PresentationElement> collectShowingManipulatedElementsRecursively()
        Collects all visible manipulated elements in this diagram recursively.
        Returns:
        manipulated elements in this diagram
      • collectShowingPresentationElementsRecursively

        @OpenApi
        public java.util.Collection<PresentationElement> collectShowingPresentationElementsRecursively()
        Collects all visible elements in this diagram recursively.
        Returns:
        visible elements in this diagram
      • collectPresentationElementsRecursively

        @OpenApi
        public java.util.Collection<PresentationElement> collectPresentationElementsRecursively()
        Collects all elements in this diagram recursively.
        Returns:
        elements in this diagram
      • addContentPropertyChangeListener

        @OpenApi
        public boolean addContentPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Registers the listener for changes in all symbols contained in the diagram.
        Parameters:
        listener - the PropertyChangeListener to be added
        Returns:
        true if listener was added - it wasn't there yet, otherwise false
      • removeContentPropertyChangeListener

        @OpenApi
        public boolean removeContentPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Unregister the given listener from the diagram.
        Parameters:
        listener - the PropertyChangeListener to be removed
        Returns:
        true if listener was removed
      • isSymbolDiagram

        @OpenApi
        public boolean isSymbolDiagram()
        Checks if diagram displays symbols as its contents. Other type of diagrams may be tables, matrices.
        Returns:
        true if diagram displays symbols
      • 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 com.nomagic.magicdraw.uml.MDElementImpl
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • isLoaded

        @OpenApi
        public boolean isLoaded()
        Check if diagram is loaded.
        Returns:
        true if diagram contents is loaded
      • ensureLoaded

        @OpenApi
        public void ensureLoaded()
        Ensures that diagram is loaded. If diagram is not loaded, loads it. Make sure the project is active before invoking this method. Otherwise, diagram may not be loaded.
      • layout

        @OpenApi
        public boolean layout​(boolean useCommands)
        Layout the diagram using default layouter.

        Make sure before doing layout:

        Only selected symbols in diagram are layouted. All symbols are layouted if selection is empty. Use PresentationElement.setSelected(java.util.List) ()} to selects symbols in the diagram.
        Parameters:
        useCommands - true to create commands. If true, this command will be available in project's command history.
        Returns:
        true if layout was performed.
      • layout

        @OpenApi
        public boolean layout​(boolean useCommands,
                              DiagramLayouter layouter)
        Layouts the diagram with the specified layouter.

        Make sure before doing layout:

        Only selected symbols in diagram are layouted. All symbols are layouted if selection is empty. Use PresentationElement.setSelected(java.util.List) ()} to selects symbols in the diagram.
        Parameters:
        useCommands - true to create commands. If true, this command will be available in project's command history
        layouter - layouter to be used for layouting
        Returns:
        true if layout was performed.
      • layout

        @OpenApi
        public boolean layout​(boolean useCommands,
                              DiagramLayouter diagramLayouter,
                              AbstractDiagramLayouterOptionsGroup options)
        Layout the diagram.

        Make sure before doing layout:

        Only selected symbols in diagram are layouted. All symbols are layouted if selection is empty. Use PresentationElement.setSelected(java.util.List) ()} to selects symbols in the diagram.
        Parameters:
        useCommands - true to create commands. If true, this command will be available in project's command history
        diagramLayouter - layouter to use
        options - layout options
        Returns:
        true if layout was performed
      • findPresentationElement

        @OpenApi
        @CheckForNull
        public final PresentationElement findPresentationElement​(@CheckForNull
                                                                 Element element,
                                                                 @CheckForNull
                                                                 java.lang.Class presentationElementClass)
        Finds presentation element for given model element of given symbol type in this diagram. Does recursive search in the diagram.
        Parameters:
        element - the given ModelElement.
        presentationElementClass - the class of presentation element or null if any.
        Returns:
        found presentation element or null if given ModelElement does not have presentation element in this diagram.
      • findPresentationElement

        @OpenApi
        @CheckForNull
        public final PresentationElement findPresentationElement​(@CheckForNull
                                                                 com.dassault_systemes.modeler.foundation.model.ModelElement element,
                                                                 @CheckForNull
                                                                 java.lang.Class presentationElementClass)
        Finds presentation element for given model element of given symbol type in this diagram. Does recursive search in the diagram.
        Parameters:
        element - the given ModelElement.
        presentationElementClass - the class of presentation element or null if any.
        Returns:
        found presentation element or null if given ModelElement does not have presentation element in this diagram.
      • findPresentationElementForPathConnecting

        @CheckForNull
        @OpenApi
        public final PresentationElement findPresentationElementForPathConnecting​(BaseElement element,
                                                                                  java.lang.Class presentationElementClass)
        Finds presentation element to connect some PathElement for given model element of given type in this diagram. Does recursive search. For example if TemplateSignature will be passes as element, Class owning that signature will be found.
        Parameters:
        element - the given ModelElement
        presentationElementClass - the class of presentation element or null if any.
        Returns:
        found presentation element or null if given ModelElement does not have presentation element in this diagram.
      • findPresentationElementsForPathConnecting

        @OpenApi
        public final java.util.stream.Stream<PresentationElement> findPresentationElementsForPathConnecting​(Element element,
                                                                                                            java.lang.Class presentationElementClass)
        Finds presentations element to connect some PathElement for given model element of given type in this diagram. Does recursive search. For example if TemplateSignature will be passes as element, Class owning that signature will be found.
        Parameters:
        element - the given ModelElement
        presentationElementClass - the class of presentation element or null if any.
        Returns:
        a stream of presentation elements
      • open

        @OpenApi
        public void open()
        Open the diagram
      • open

        @OpenApi
        public void open​(boolean showProgress)
        Open the diagram in a new diagram tab, or activates diagram tab if this diagram is already open
        Parameters:
        showProgress - show progress dialog
      • openInActiveTab

        @OpenApi
        public void openInActiveTab​(boolean showProgress)
        Open diagram in currently active diagram tab If no other diagram is opened yet, creates a new tab If this diagram is already opened, simply activates that tab
        Parameters:
        showProgress - show progress dialog
      • close

        @OpenApi
        public final void close()
        Closes diagram window.