Package com.nomagic.magicdraw.uml
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).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RepresentationTextCreator.RepresentationTextProvider
Representation text provider extension point.
-
Field Summary
-
Fields inherited from class com.nomagic.magicdraw.uml.DeprecatedRepresentationTextCreator
COLOR_POSTFIX, COLOR_PREFIX, EMPTY_NAME_NOTATION, GRAY_COLOR_STRING
-
-
Constructor Summary
Constructors Constructor Description RepresentationTextCreator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
addProvider(RepresentationTextCreator.RepresentationTextProvider provider)
Registers a given representation text provider.static java.lang.String
createDefaultRepresentationText(BaseElement element, RepresentationTextParams textParams)
Gets default (not extended) representation text.static java.util.Comparator<BaseElement>
createRepresentationTextComparator(RepresentationTextParams params)
static java.lang.String
getAbsoluteUMLPathToRoot(Element element)
Method returns string representing path from root element to the given element.static boolean
getFullName(Element element, java.lang.StringBuffer path, java.lang.String separator, boolean checkTopStereotype)
Get Element full name.static boolean
getFullName(Element element, java.lang.StringBuffer path, java.lang.String separator, boolean checkTopStereotype, boolean checkTopModelElement)
Get Element full name.static java.lang.String
getFullUMLName(Element element)
Method returns full UML name of element given elementstatic java.lang.String
getFullUMLName(Element element, boolean doNotAddTopLevels)
Get full UML Name of the given elementstatic RepresentationTextCreator
getInstance()
static java.lang.String
getModelElementNameWithParentPath(NamedElement element, boolean addColor)
Get element name with parent path.static java.lang.String
getModelElementParentPath(Element element, boolean addBrackets)
Get element name with parent path.static java.lang.String
getPathToRoot(Element element)
Get path of the given element to the root of element.static java.lang.String
getPathToRoot(Element element, boolean checkTop)
Get path of the given element to the root of element.static java.lang.String
getPathToRoot(Element element, boolean relativeToLibrary, boolean compactMode)
Calculates qualified name.static java.lang.String
getPathToRoot(Element element, boolean relativeToLibrary, boolean relativeToModel, boolean compactMode)
Calculates qualified name.static java.lang.String
getPathToRoot(Element element, boolean toModelLibrary, boolean toModel, java.lang.String separator)
Get path to root.static java.lang.String
getPathToRoot(Element element, boolean checkTop, java.lang.String separator)
Get path to root.static RepresentationTextCreator.RepresentationTextProvider
getProviderFor(BaseElement element)
Looks for a provider for a given element.java.lang.String
getRelationshipFromToPart(Element relationship, Element clientModelElement, Element supplierModelElement, RepresentationTextParams textParams)
java.lang.String
getRelationshipFromToPart(Relationship relationship, RepresentationTextParams textParams)
static java.lang.String
getRepresentedText(BaseElement element)
Returns representation text for the provided elementstatic java.lang.String
getRepresentedText(BaseElement element, RepresentationTextParams textParams)
Returns representation text for the provided elementstatic java.lang.String
getRepresentedText(BaseElement element, RepresentationTextParams textParams, boolean noCache)
Returns representation text for the provided elementboolean
isCreateBoundElementName()
static void
removeProvider(RepresentationTextCreator.RepresentationTextProvider provider)
Unregisters a given representation text provider.void
resetAutoIdRepresentations(Project project)
Clear the text cache for all elements that are part of the given project and have element numbersvoid
setCreateBoundElementName(boolean createBoundElementName)
-
Methods inherited from class com.nomagic.magicdraw.uml.DeprecatedRepresentationTextCreator
appendColor, appendColor, appendGrayColor, appendGrayColor, constructActivityEdgeText, constructCombinedFragmentOperatorText, createActivityParameterNodeText, createAssociationText, createBehaviorText, createBehaviorText, createBehaviorText, createBehaviorText, createClassifierName, createClassifiersRepresentation, createConstraintsText, createConstraintsText, createConstraintsText, createDefaultRepresentationText, createDefaultRepresentationText, createDefaultRepresentationText, createElementNameText, createEnumerationLiteralText, createEnumerationLiteralText, createEnumerationLiteralText, createEnumerationLiteralText, createEventText, createEventText, createGuardText, createId, createInstanceSpecificationText, createInstanceSpecificationText, createInteractionUseText, createInteractionUseText, createMultiplicityRangeText, createMultiplicityText, createMultiplicityText, createMultiplicityText, createMultiplicityText, createNamedElementListText, createOperandGuardText, createOperationText, createOperationText, createOperationText, createOperationText, createParameterDirectionText, createParametersText, createParametersText, createParameterText, createParameterText, createParameterText, createPinText, createPortText, createPortText, createPortText, createPropertyPropertyStringText, createPropertyPropertyStringText, createPropertyText, createPropertyText, createPropertyText, createPropertyText, createPropertyText, createProtocolTransitionText, createProtocolTransitionText, createProtocolTransitionText, createPureSlotsString, createReceptionText, createReceptionText, createReceptionText, createRepresentationTextComparator, createSlotsText, createSlotText, createSlotText, createSlotText, createSlotText, createStateText, createStereotypesText, createStereotypesText, createStereotypesText, createStereotypesText, createStereotypeText, createStereotypeText, createStereotypeText, createTemplateBindingText, createTemplateBindingText, createTemplateParametersText, createTemplateParameterSubstitutionText, createTemplateParameterText, createTransitionText, createTransitionText, createTransitionText, createTriggersText, createTriggersText, createTriggersText, createTriggerText, createTriggerText, createTriggerText, createTypedElementText, createTypeName, createValueSpecificationText, createVisibilityText, endColorHtmlTag, endColorHtmlTag, getLocationInTool, getPureTextFromColoredText, getRelationshipFromToRepresentation, getRepresentedText, getRepresentedText, getRepresentedText, getRepresentedText, getRepresentedText, isAddColor, isShowFullType, resetColor, resetColor, setAddColor, setLocationInTool, setShowFullType, startColorHtmlTag, startColorHtmlTag
-
-
-
-
Method Detail
-
getInstance
public static RepresentationTextCreator getInstance()
- Returns:
- thread local specific instance
-
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 includenoCache
- 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 aRepresentationTextCreator.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 elementaddBrackets
- 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 elementaddColor
- 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 elementdoNotAddTopLevels
- 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 elementcheckTop
- 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 seegetPathToRoot(Element, boolean, boolean, boolean)
- Parameters:
element
- model element used to calculate qualified namerelativeToLibrary
- 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 namerelativeToLibrary
- 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 seegetPathToRoot(Element, boolean, boolean, String)
- Parameters:
element
- the given elementcheckTop
- true for check the rootseparator
- 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 elementtoModelLibrary
- if true, stops at model librarytoModel
- if true, stops at mode elementseparator
- 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 seegetFullName(Element, StringBuffer, String, boolean, boolean)
.- Parameters:
element
- the given elementpath
- Path of elementseparator
- the separatorcheckTopStereotype
- 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.
-
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 java.lang.String getRelationshipFromToPart(Relationship relationship, RepresentationTextParams textParams)
-
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
-
createRepresentationTextComparator
public static java.util.Comparator<BaseElement> createRepresentationTextComparator(RepresentationTextParams params)
-
-