Package com.nomagic.magicdraw.uml
Class RepresentationTextCreator
java.lang.Object
com.nomagic.magicdraw.uml.DeprecatedRepresentationTextCreator
com.nomagic.magicdraw.uml.RepresentationTextCreator
Class for creating text of BaseElements represented in various UI components (tree nodes, text labels and etc).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Registers a given representation text provider.static String
createDefaultRepresentationText
(BaseElement element, RepresentationTextParams textParams) Gets default (not extended) representation text.static Comparator<BaseElement>
static String
getAbsoluteUMLPathToRoot
(Element element) Method returns string representing path from root element to the given element.static boolean
getFullName
(Element element, StringBuffer path, String separator, boolean checkTopStereotype) Get Element full name.static boolean
getFullName
(Element element, StringBuffer path, String separator, boolean checkTopStereotype, boolean checkTopModelElement) Get Element full name.static String
getFullUMLName
(Element element) Method returns full UML name of element given elementstatic String
getFullUMLName
(Element element, boolean doNotAddTopLevels) Get full UML Name of the given elementstatic RepresentationTextCreator
static String
getModelElementNameWithParentPath
(NamedElement element, boolean addColor) Get element name with parent path.static String
getModelElementParentPath
(Element element, boolean addBrackets) Get element name with parent path.static String
getPathToRoot
(Element element) Get path of the given element to the root of element.static String
getPathToRoot
(Element element, boolean checkTop) Get path of the given element to the root of element.static String
getPathToRoot
(Element element, boolean relativeToLibrary, boolean compactMode) Calculates qualified name.static String
getPathToRoot
(Element element, boolean relativeToLibrary, boolean relativeToModel, boolean compactMode) Calculates qualified name.static String
getPathToRoot
(Element element, boolean toModelLibrary, boolean toModel, String separator) Get path to root.static String
getPathToRoot
(Element element, boolean checkTop, String separator) Get path to root.getProviderFor
(BaseElement element) Looks for a provider for a given element.getRelationshipFromToPart
(Element relationship, Element clientModelElement, Element supplierModelElement, RepresentationTextParams textParams) getRelationshipFromToPart
(Relationship relationship, RepresentationTextParams textParams) static String
getRepresentedText
(BaseElement element) Returns representation text for the provided elementstatic String
getRepresentedText
(BaseElement element, RepresentationTextParams textParams) Returns representation text for the provided elementstatic String
getRepresentedText
(BaseElement element, RepresentationTextParams textParams, boolean noCache) Returns representation text for the provided elementboolean
static void
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
-
Constructor Details
-
RepresentationTextCreator
public RepresentationTextCreator()
-
-
Method Details
-
getInstance
- Returns:
- thread local specific instance
-
getRepresentedText
Returns representation text for the provided element- Parameters:
element
- element which representation text will be created.- Returns:
- representation text for the given element.
-
getRepresentedText
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 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 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
Get element name with parent path.- Parameters:
element
- the given name elementaddBrackets
- true for add brackets to the string- Returns:
- parent path
-
getModelElementNameWithParentPath
Get element name with parent path.- Parameters:
element
- the given name elementaddColor
- add color flag- Returns:
- element name with parent path
-
getFullUMLName
Method returns full UML name of element given element- Parameters:
element
- element- Returns:
- full element name with path to root
-
getFullUMLName
Get full UML Name of the given element- Parameters:
element
- the given elementdoNotAddTopLevels
- do not add to top level- Returns:
- full UML Name
-
getAbsoluteUMLPathToRoot
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
Get path of the given element to the root of element.- Parameters:
element
- the given element- Returns:
- the path to root element element
-
getPathToRoot
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
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 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
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 String getPathToRoot(Element element, boolean toModelLibrary, boolean toModel, 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, StringBuffer path, 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, 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
Registers a given representation text provider.- Parameters:
provider
- provider
-
removeProvider
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
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)
-