Class RepresentationTextCreator


  • @OpenApiAll
    public class RepresentationTextCreator
    extends DeprecatedRepresentationTextCreator
    Class for creating text of BaseElements represented in various UI components (tree nodes, text labels and etc).
    • Constructor Detail

      • RepresentationTextCreator

        public RepresentationTextCreator()
    • Method Detail

      • getRepresentedText

        public static java.lang.String getRepresentedText​(BaseElement element)
        Returns representation text for the provided element
        Parameters:
        element - element which representation text will be created.
        Returns:
        representation text for the given element.
      • getRepresentedText

        public static java.lang.String getRepresentedText​(BaseElement element,
                                                          RepresentationTextParams textParams)
        Returns representation text for the provided element
        Parameters:
        element - element which representation text will be created.
        textParams - parameters describing how to construct the text, what to include
        Returns:
        representation text for the given element.
      • getRepresentedText

        public static java.lang.String getRepresentedText​(BaseElement element,
                                                          RepresentationTextParams textParams,
                                                          boolean noCache)
        Returns representation text for the provided element
        Parameters:
        element - element which representation text will be created.
        textParams - parameters describing how to construct the text, what to include
        noCache - if false, cached text value (that was calculated earlier) can be returned if true, cache will not be used and representation text will be constructed
        Returns:
        representation text for the given element.
      • createDefaultRepresentationText

        public static java.lang.String createDefaultRepresentationText​(BaseElement element,
                                                                       RepresentationTextParams textParams)
        Gets default (not extended) representation text. Representation text can be extended by adding a RepresentationTextCreator.RepresentationTextProvider
        Parameters:
        element - element for which to retrieve representation text.
        textParams - parameters describing how to construct the text, what to include
      • getModelElementParentPath

        public static java.lang.String getModelElementParentPath​(Element element,
                                                                 boolean addBrackets)
        Get element name with parent path.
        Parameters:
        element - the given name element
        addBrackets - true for add brackets to the string
        Returns:
        parent path
      • getModelElementNameWithParentPath

        public static java.lang.String getModelElementNameWithParentPath​(NamedElement element,
                                                                         boolean addColor)
        Get element name with parent path.
        Parameters:
        element - the given name element
        addColor - add color flag
        Returns:
        element name with parent path
      • getFullUMLName

        public static java.lang.String getFullUMLName​(Element element)
        Method returns full UML name of element given element
        Parameters:
        element - element
        Returns:
        full element name with path to root
      • getFullUMLName

        public static java.lang.String getFullUMLName​(Element element,
                                                      boolean doNotAddTopLevels)
        Get full UML Name of the given element
        Parameters:
        element - the given element
        doNotAddTopLevels - do not add to top level
        Returns:
        full UML Name
      • getAbsoluteUMLPathToRoot

        public static java.lang.String getAbsoluteUMLPathToRoot​(Element element)
        Method returns string representing path from root element to the given element.
        Parameters:
        element - element
        Returns:
        path from the the root element to the given one
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element)
        Get path of the given element to the root of element.
        Parameters:
        element - the given element
        Returns:
        the path to root element element
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element,
                                                     boolean checkTop)
        Get path of the given element to the root of element.
        Parameters:
        element - the given element
        checkTop - true for check the root
        Returns:
        the path to root element element
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element,
                                                     boolean relativeToLibrary,
                                                     boolean compactMode)
        Calculates qualified name. It can generate string using standard UML notation (using double colon for separator) or in the old MagicDraw style (surrounded with parentheses). For more options see getPathToRoot(Element, boolean, boolean, boolean)
        Parameters:
        element - model element used to calculate qualified name
        relativeToLibrary - if true, then qualified name is calculated from "model library" element, otherwise qualified name is calculated from root.
        compactMode - if true, then old MagicDraw notation is used, otherwise uses standard UML notation
        Returns:
        string containing "name space" qualified name part.
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element,
                                                     boolean relativeToLibrary,
                                                     boolean relativeToModel,
                                                     boolean compactMode)
        Calculates qualified name. It can generate string using standard UML notation (using double colon for separator) or in the old MagicDraw style (surrounded with parentheses).
        Parameters:
        element - model element used to calculate qualified name
        relativeToLibrary - if true, then qualified name is calculated from "model library" element, otherwise qualified name is calculated from root.
        relativeToModel - if true, then qualified name is calculated from nearest "model" element, otherwise qualified name is calculated from root.
        compactMode - if true, then old MagicDraw notation is used, otherwise uses standard UML notation
        Returns:
        string containing "name space" qualified name part.
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element,
                                                     boolean checkTop,
                                                     java.lang.String separator)
        Get path to root. For More options see getPathToRoot(Element, boolean, boolean, String)
        Parameters:
        element - the given element
        checkTop - true for check the root
        separator - separator to use to create a path
        Returns:
        string
      • getPathToRoot

        public static java.lang.String getPathToRoot​(Element element,
                                                     boolean toModelLibrary,
                                                     boolean toModel,
                                                     java.lang.String separator)
        Get path to root.
        Parameters:
        element - the given element
        toModelLibrary - if true, stops at model library
        toModel - if true, stops at mode element
        separator - separator to use to create a path
        Returns:
        string
      • getFullName

        public static boolean getFullName​(Element element,
                                          java.lang.StringBuffer path,
                                          java.lang.String separator,
                                          boolean checkTopStereotype)
        Get Element full name. For more options see getFullName(Element, StringBuffer, String, boolean, boolean).
        Parameters:
        element - the given element
        path - Path of element
        separator - the separator
        checkTopStereotype - is check top stereotype
        Returns:
        true if element is NamedElement, otherwise false.
      • getFullName

        public static boolean getFullName​(Element element,
                                          java.lang.StringBuffer path,
                                          java.lang.String separator,
                                          boolean checkTopStereotype,
                                          boolean checkTopModelElement)
        Get Element full name.
        Parameters:
        element - The NameElement.
        path - Path of NameElement.
        separator - The separator.
        checkTopStereotype - Is check to stereotype?
        checkTopModelElement - indicates Model model element check
        Returns:
        true if element is NamedElement, otherwise false.
      • getRelationshipFromToPart

        public java.lang.String getRelationshipFromToPart​(Element relationship,
                                                          @CheckForNull
                                                          Element clientModelElement,
                                                          @CheckForNull
                                                          Element supplierModelElement,
                                                          RepresentationTextParams textParams)
      • isCreateBoundElementName

        public boolean isCreateBoundElementName()
      • setCreateBoundElementName

        public void setCreateBoundElementName​(boolean createBoundElementName)
      • resetAutoIdRepresentations

        public void resetAutoIdRepresentations​(Project project)
        Clear the text cache for all elements that are part of the given project and have element numbers
        Parameters:
        project - project