Class ContentShape

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

    @OpenApi
    public class ContentShape
    extends com.nomagic.magicdraw.uml.symbols.shapes.TextShapeView
    Shape for displaying content of some package.
    • Field Detail

      • diagramsByType

        private java.util.Map<java.lang.String,​java.util.List<Diagram>> diagramsByType
      • packageElement

        private com.nomagic.magicdraw.uml.ElementReference<Element> packageElement
      • END_BLOCK_DIAGRAM_TEXT

        private static final java.lang.String END_BLOCK_DIAGRAM_TEXT
        See Also:
        Constant Field Values
      • START_BLOCK_DIAGRAM_TEXT

        private static final java.lang.String START_BLOCK_DIAGRAM_TEXT
        See Also:
        Constant Field Values
      • END_BLOCK_PACKAGE_TEXT

        private static final java.lang.String END_BLOCK_PACKAGE_TEXT
        See Also:
        Constant Field Values
      • START_BLOCK_PACKAGE_TEXT

        private static final java.lang.String START_BLOCK_PACKAGE_TEXT
        See Also:
        Constant Field Values
      • START_BLOCK_DIAGRAMS_TEXT

        private static final java.lang.String START_BLOCK_DIAGRAMS_TEXT
        See Also:
        Constant Field Values
      • END_BLOCK_DIAGRAMS_TEXT

        private static final java.lang.String END_BLOCK_DIAGRAMS_TEXT
        See Also:
        Constant Field Values
    • Constructor Detail

      • ContentShape

        public ContentShape()
    • Method Detail

      • canDisplayHTMLText

        public boolean canDisplayHTMLText()
        Overrides:
        canDisplayHTMLText in class com.nomagic.magicdraw.uml.symbols.shapes.TextShapeView
      • isHTMLText

        public boolean isHTMLText()
        Specified by:
        isHTMLText in interface com.nomagic.magicdraw.uml.symbols.shapes.PlainTextOrHTMLChangeable
        Overrides:
        isHTMLText in class com.nomagic.magicdraw.uml.symbols.shapes.TextShapeView
      • getDiagramsIdsFromHTMLSource

        public java.util.List<java.lang.String> getDiagramsIdsFromHTMLSource()
      • internalSpecificUpdate

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

        @CheckForNull
        private static java.lang.String getDiagramTypeFromText​(java.lang.String text,
                                                               java.lang.String diagramBlock)
      • removeUnavailableDiagrams

        private java.lang.String removeUnavailableDiagrams​(java.lang.String text)
      • getAvailableDiagramIDs

        private java.util.Collection<java.lang.String> getAvailableDiagramIDs()
      • getAvailableDiagrams

        private java.util.List<Diagram> getAvailableDiagrams()
      • appendDiagramsFromAdditionalContent

        private static void appendDiagramsFromAdditionalContent​(Element element,
                                                                java.util.Collection<Diagram> diagrams)
      • sortDiagrams

        private void sortDiagrams​(java.lang.String text,
                                  java.util.List<Diagram> diagrams)
      • sortDiagramsByType

        private void sortDiagramsByType​(java.util.List<Diagram> diagrams)
      • clearDiagramsMap

        public void clearDiagramsMap()
      • getAllDisplayedDiagrams

        private java.util.Collection<Diagram> getAllDisplayedDiagrams()
      • updateHeader

        private java.lang.String updateHeader​(java.lang.String text)
      • removeHeaderPackageName

        private static java.lang.String removeHeaderPackageName​(java.lang.String text)
      • getHeaderText

        @CheckForNull
        private static java.lang.String getHeaderText​(java.lang.String text)
      • 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
      • removeDiagramBlock

        private java.lang.String removeDiagramBlock​(java.lang.String text,
                                                    Diagram diagram,
                                                    java.lang.String diagramType)
      • removeDiagramBlock

        private java.lang.String removeDiagramBlock​(java.lang.String text,
                                                    Diagram diagram)
      • removeDiagramBlock

        private static java.lang.String removeDiagramBlock​(java.lang.String text,
                                                           java.lang.String id)
      • removeLastNewLineSymbol

        private static java.lang.String removeLastNewLineSymbol​(java.lang.String text)
      • getDiagramTypeFromMap

        private java.lang.String getDiagramTypeFromMap​(Diagram diagram)
      • constructHeader

        private java.lang.String constructHeader()
      • constructPackageHeaderText

        private java.lang.String constructPackageHeaderText()
      • constructPackageNameText

        private static java.lang.String constructPackageNameText​(@CheckForNull
                                                                 Element pack)
      • constructText

        private java.lang.String constructText()
      • registerListener

        private void registerListener​(Element modelElement)
      • unregisterListener

        private void unregisterListener​(Element modelElement)
      • insertBlockByOrder

        private java.lang.String insertBlockByOrder​(java.lang.String text,
                                                    java.lang.String block,
                                                    Diagram diagram)
      • getDiagramType

        private java.lang.String getDiagramType​(Diagram diagram)
      • insertBlockAtEnd

        private static java.lang.String insertBlockAtEnd​(java.lang.String text,
                                                         java.lang.String block)
      • constructDiagramsBlock

        private static java.lang.String constructDiagramsBlock​(java.lang.String diagramType,
                                                               java.lang.String body)
      • wrapDiagramsBlock

        public static java.lang.String wrapDiagramsBlock​(java.lang.String diagramType,
                                                         java.lang.String body)
        Wraps given body inside diagram blog tags
        Parameters:
        diagramType - type
        body - body
        Returns:
        text
      • constructIconTag

        private static java.lang.String constructIconTag​(Element element)
      • constructHyperLinkTag

        private static java.lang.String constructHyperLinkTag​(Element element)
      • constructEndBlockMark

        private static java.lang.String constructEndBlockMark​(java.lang.String id)
      • constructStartBlockMark

        private static java.lang.String constructStartBlockMark​(java.lang.String id)
      • constructEndBlockPackageMark

        private static java.lang.String constructEndBlockPackageMark()
      • constructStartBlockPackageMark

        private static java.lang.String constructStartBlockPackageMark​(java.lang.String id)
      • constructHTMLBlockForDiagram

        private static java.lang.String constructHTMLBlockForDiagram​(NamedElement element)
      • replaceString

        public static java.lang.String replaceString​(java.lang.String text,
                                                     java.lang.String oldString,
                                                     java.lang.String newString)
      • updateDiagramName

        private static java.lang.String updateDiagramName​(java.lang.String block,
                                                          NamedElement namedElement)
      • findDiagramElementBlock

        private static java.lang.String findDiagramElementBlock​(java.lang.String text,
                                                                java.lang.String id)
      • replaceIconPath

        private static java.lang.String replaceIconPath​(java.lang.String block,
                                                        Element element)
      • 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.TextShapeView
        Parameters:
        visitor - which visits this element.
        Throws:
        java.lang.Exception
      • paintSelf

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

        @CheckForNull
        public Element getPackage()
      • setPackage

        public void setPackage​(Element aPackage)
      • addPackageListener

        private void addPackageListener()
      • removePackageListener

        private void removePackageListener()
      • clone

        public ContentShape clone()
        Description copied from class: ElementImpl
        Returns a copy of the Element.
        Specified by:
        clone in interface BaseElement
        Overrides:
        clone in class com.nomagic.magicdraw.uml.symbols.shapes.TextShapeView
        Returns:
        the cloned object
      • fixSpacesInHeader

        public void fixSpacesInHeader()