Class RepresentationTextCreator

java.lang.Object
com.nomagic.magicdraw.uml.DeprecatedRepresentationTextCreator
com.nomagic.magicdraw.uml.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 Details

    • RepresentationTextCreator

      public RepresentationTextCreator()
  • Method Details

    • getInstance

      public static RepresentationTextCreator getInstance()
      Returns:
      thread local specific instance
    • getRepresentedText

      public static 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 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 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 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 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 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 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 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 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 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 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 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 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 String getPathToRoot(Element element, boolean checkTop, 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 String getPathToRoot(Element element, boolean toModelLibrary, boolean toModel, 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, StringBuffer path, 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, StringBuffer path, 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.
    • addProvider

      public static void addProvider(RepresentationTextCreator.RepresentationTextProvider provider)
      Registers a given representation text provider.
      Parameters:
      provider - provider
    • removeProvider

      public static void removeProvider(RepresentationTextCreator.RepresentationTextProvider provider)
      Unregisters a given representation text provider.
      Parameters:
      provider - provider
    • getProviderFor

      @CheckForNull public static RepresentationTextCreator.RepresentationTextProvider getProviderFor(BaseElement element)
      Looks for a provider for a given element.
      Parameters:
      element - given element
      Returns:
      found provider or null
    • getRelationshipFromToPart

      public String getRelationshipFromToPart(Relationship relationship, RepresentationTextParams textParams)
    • getRelationshipFromToPart

      public 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
    • createRepresentationTextComparator

      public static Comparator<BaseElement> createRepresentationTextComparator(RepresentationTextParams params)