Package com.nomagic.magicdraw.uml
Class DiagramType
- java.lang.Object
-
- com.nomagic.magicdraw.uml.DiagramType
-
- All Implemented Interfaces:
DiagramTypeConstants,DiagramTypes,java.lang.Cloneable
@OpenApi public class DiagramType extends java.lang.Object implements java.lang.Cloneable, DiagramTypeConstants
TheDiagramTypeclass represents the diagram type
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.String>DIAGRAMS_WITHOUT_AUTOMATIC_CONTEXT_SETprivate static java.util.HashMap<java.lang.String,java.lang.String[]>diagramTypeHumanNameprivate static java.util.List<java.lang.String>mAllDiagramTypesThe list of all diagramsprivate static java.util.List<com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator>mContextTypesConfiguratorsOwner types configuratorsprivate static java.util.List<java.lang.String>mCreatableDiagramTypesThe list of available to create diagram types.private static java.util.HashMap<java.lang.String,com.nomagic.magicdraw.uml.DiagramActualElementTypeResolver>mDiagramActualElementTypeResolversprivate static java.util.Map<java.lang.String,java.util.Collection<java.lang.Class>>mDiagramOwnerTypesKey is diagram type, and value -> collections of class types of possible parents from UMLprivate static java.util.HashMap<java.lang.String,java.lang.String>mDiagramSuperTypeprivate static java.util.Map<java.lang.String,java.lang.Boolean>mIgnoredDiagramTypesMap of ignored diagrams types.private java.lang.StringmTypeThe type of diagram-
Fields inherited from interface com.nomagic.magicdraw.uml.DiagramTypeConstants
STANDARD_CREATABLE_TYPES, STANDARD_NON_CREATABLE_TYPES, STANDARD_TYPES
-
Fields inherited from interface com.nomagic.uml2.diagram.DiagramTypes
CONTENT_DIAGRAM, DEPENDENCY_MATRIX, GENERIC_TABLE, GLOSSARY_TABLE, RELATION_MAP_DIAGRAM, UML_ACTIVITY_DIAGRAM, UML_ANY_DIAGRAM, UML_BEHAVIOR_DIAGRAM, UML_CLASS_DIAGRAM, UML_COMMUNICATION_DIAGRAM, UML_COMPONENT_DIAGRAM, UML_COMPOSITE_STRUCTURE_DIAGRAM, UML_DEPLOYMENT_DIAGRAM, UML_INTERACTION_DIAGRAM, UML_INTERACTION_OVERVIEW_DIAGRAM, UML_OBJECT_DIAGRAM, UML_PACKAGE_DIAGRAM, UML_PROFILE_DIAGRAM, UML_PROTOCOL_STATE_MACHINE_DIAGRAM, UML_SEQUENCE_DIAGRAM, UML_STATECHART_DIAGRAM, UML_STATIC_DIAGRAM, UML_USECASE_DIAGRAM, USER_INTERFACE_MODELING_DIAGRAM
-
-
Constructor Summary
Constructors Constructor Description DiagramType(java.lang.String type)Constructs diagram type according given diagram type string representation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddIgnoredDiagramType(java.lang.String diagramType)Add diagram type, which will be ignored if descriptor for this diagram type not registered.static voidaddIgnoredDiagramType(java.lang.String diagramType, boolean symbolDiagram)Add diagram type, which will be ignored if descriptor for this diagram type not registered.static voidaddIgnoredDiagramType(java.util.List<java.lang.String> diagramTypes)Add diagram types, which will be ignored if descriptor for this diagram type not registered.static voidaddIgnoredDiagramTypes(java.util.Collection<java.lang.String> diagramTypes, boolean symbolDiagram)Add diagram types, which will be ignored if descriptor for this diagram type not registered.java.lang.Objectclone()static java.util.List<?>configureContextTypeByDiagramType(Project project, java.lang.String diagramType, java.util.List<java.lang.Class> contextTypes)Configure owner types.static DiagramTypecreateDiagramType(java.lang.String type)Creates diagram type of given type string representation.static voidfilterByHiddenSuggestedDSLDiagramTypes(java.lang.String diagramType, java.util.Collection<?> contextTypes)Filters hidden suggested DSL diagram context types.static java.lang.StringgetAbbreviatedType(java.lang.String diagramType)Returns abbreviated type for given normal diagram type.static java.util.List<java.lang.String>getAllDiagramTypes()Returns list of all diagram types.static java.util.List<java.lang.String>getAllSubtypes(java.lang.String root, boolean creatable)collect all subtypes of the given root diagram type.static java.util.List<java.lang.String>getCreatableDiagramTypes()Returns list of available to create (creatable) diagram types.static java.lang.ClassgetDiagramActualElementType(java.lang.String diagramType, Element owner)static DiagramTypegetDiagramType(Diagram diagram)Return diagram type for a given diagramstatic java.util.Set<java.lang.String>getIgnoredDiagramTypes()Types of diagrams must be ignored.private static java.util.Collection<java.lang.Class>getOwnerTypes(java.lang.String diagramType)Gives possible owner types for given diagram typestatic java.lang.StringgetPluralHumanName(java.lang.String type)Returns plural human name of the given type.static java.util.Collection<java.lang.Class>getPossibleDiagramOwnerTypes(java.lang.String type)static java.util.Collection<java.lang.Class>getPossibleDiagramOwnerTypes(java.lang.String type, boolean includeSuperTypeOwners)java.lang.StringgetRootType()Returns root type of this diagram type.static java.lang.StringgetRootType(java.lang.String diagramType)Returns root type of given diagram type.static java.lang.StringgetRootUMLType(java.lang.String diagramType)Returns root type of the UML type diagram.static java.lang.StringgetShortType(java.lang.String diagramType)Returns short type for given normal diagram type.static java.lang.StringgetSingularHumanName(java.lang.String type)Returns singular human name of the given type.java.lang.StringgetSuperType()Returns registered super type for diagram type.static java.lang.StringgetSuperType(java.lang.String derivedType)Returns registered super type for given diagram type.java.lang.StringgetType()Returns the diagram type string representationjava.lang.StringgetUMLDiagramType()Returns UML diagram type.static booleanisCreatableDiagramType(java.lang.String type)Check, whether diagram type is creatable.booleanisEqualType(DiagramType type)Checks if diagram type is equal to given diagram type.booleanisEqualType(java.lang.String type)Checks if diagram type is equal to given diagram type.static booleanisIgnoredSymbolDiagram(DiagramPresentationElement diagramPresentationElement)Checks if diagram is ignored symbol diagrambooleanisTypeOf(DiagramType type)Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)booleanisTypeOf(java.lang.String type)Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)static booleanisTypeOf(java.lang.String unknown, java.lang.String types)static booleanisTypeOf(java.lang.String unknown, java.util.List<java.lang.String> types)booleanisTypeOf(java.util.List<java.lang.String> types)Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)static voidregisterContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)Registers a new context type by diagram type configuratorstatic voidregisterDiagramType(java.lang.String newType, java.lang.String superType, boolean creatable)Adds and registers new diagram type.static voidregisterHumanNames(java.lang.String newType, java.lang.String singularName, java.lang.String pluralName)private static voidregisterStandardDiagramType(java.lang.String diagramType, java.lang.String superDiagramType, com.nomagic.magicdraw.uml.DiagramActualElementTypeResolver diagramActualElementTypeResolver)voidsetType(java.lang.String type)Sets the diagram type, according given diagram type string representationstatic voidunregisterContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)Unregisters a new context type by diagram type configuratorstatic voidunregisterDiagramType(java.lang.String type)Unregisters diagram type.
-
-
-
Field Detail
-
mAllDiagramTypes
private static final java.util.List<java.lang.String> mAllDiagramTypes
The list of all diagrams
-
mCreatableDiagramTypes
private static final java.util.List<java.lang.String> mCreatableDiagramTypes
The list of available to create diagram types.
-
mIgnoredDiagramTypes
private static final java.util.Map<java.lang.String,java.lang.Boolean> mIgnoredDiagramTypes
Map of ignored diagrams types. Map value defines if diagram is symbolic diagram When diagrams of these types are loaded - do not show warnings about descriptors.
-
mDiagramSuperType
private static final java.util.HashMap<java.lang.String,java.lang.String> mDiagramSuperType
-
diagramTypeHumanName
private static final java.util.HashMap<java.lang.String,java.lang.String[]> diagramTypeHumanName
-
mDiagramActualElementTypeResolvers
private static final java.util.HashMap<java.lang.String,com.nomagic.magicdraw.uml.DiagramActualElementTypeResolver> mDiagramActualElementTypeResolvers
-
DIAGRAMS_WITHOUT_AUTOMATIC_CONTEXT_SET
public static final java.util.List<java.lang.String> DIAGRAMS_WITHOUT_AUTOMATIC_CONTEXT_SET
-
mContextTypesConfigurators
private static final java.util.List<com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator> mContextTypesConfigurators
Owner types configurators
-
mDiagramOwnerTypes
private static java.util.Map<java.lang.String,java.util.Collection<java.lang.Class>> mDiagramOwnerTypes
Key is diagram type, and value -> collections of class types of possible parents from UML- See Also:
getOwnerTypes(String)
-
mType
private java.lang.String mType
The type of diagram
-
-
Constructor Detail
-
DiagramType
@OpenApi public DiagramType(java.lang.String type)
Constructs diagram type according given diagram type string representation.- Parameters:
type- diagram type string representation- See Also:
createDiagramType(String),DiagramTypeConstants,getAllDiagramTypes(),getCreatableDiagramTypes()
-
-
Method Detail
-
getShortType
public static java.lang.String getShortType(java.lang.String diagramType)
Returns short type for given normal diagram type. For example "Activity Diagram" will be "activity".- Parameters:
diagramType- type- Returns:
- short type
-
getAbbreviatedType
public static java.lang.String getAbbreviatedType(java.lang.String diagramType)
Returns abbreviated type for given normal diagram type. For example "Activity Diagram" will be "act".- Parameters:
diagramType- type- Returns:
- abbreviated type
-
getDiagramType
@OpenApi public static DiagramType getDiagramType(Diagram diagram)
Return diagram type for a given diagram- Parameters:
diagram- diagram- Returns:
- diagram type
-
setType
@OpenApi public void setType(java.lang.String type)
Sets the diagram type, according given diagram type string representation- Parameters:
type- diagram type string representation- See Also:
DiagramTypeConstants,getAllDiagramTypes(),getCreatableDiagramTypes()
-
getType
@OpenApi public java.lang.String getType()
Returns the diagram type string representation- Returns:
- diagram type string representation
- See Also:
DiagramTypeConstants,getAllDiagramTypes()
-
isEqualType
@OpenApi public boolean isEqualType(DiagramType type)
Checks if diagram type is equal to given diagram type.- Parameters:
type- diagram type- Returns:
trueif this diagram type is equal to given diagram type; otherwise -false.- See Also:
isTypeOf(DiagramType)
-
isEqualType
@OpenApi public boolean isEqualType(java.lang.String type)
Checks if diagram type is equal to given diagram type.- Parameters:
type- diagram type string representation- Returns:
trueif this diagram type is equal to given diagram type; otherwise -false.- See Also:
DiagramTypeConstants,getAllDiagramTypes(),isTypeOf(String)
-
isTypeOf
@OpenApi public boolean isTypeOf(DiagramType type)
Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)- Parameters:
type- diagram type.- Returns:
trueif this diagram type is a 'subtype' of given diagram type or equal to given diagram type; otherwise -false.- See Also:
isTypeOf(String)
-
isTypeOf
@OpenApi public boolean isTypeOf(java.util.List<java.lang.String> types)
Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)- Parameters:
types- the list of diagram type string representation.- Returns:
trueif this diagram type is a 'subtype' of at least one given diagram type or equal to at least one given diagram type; othwerwise -false.- See Also:
DiagramTypeConstants,getAllDiagramTypes(),isTypeOf(DiagramType)
-
isTypeOf
@OpenApi public boolean isTypeOf(java.lang.String type)
Checks if diagram type is of given diagram type (analogy ofinstanceofoperator)- Parameters:
type- diagram type string representation.- Returns:
trueif this diagram type is a 'subtype' of given diagram type or equal to given diagram type; otherwise -false.- See Also:
DiagramTypeConstants,getAllDiagramTypes(),isTypeOf(DiagramType)
-
getRootType
@OpenApi public java.lang.String getRootType()
Returns root type of this diagram type.- Returns:
- root type.
-
clone
@OpenApi public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
getAllDiagramTypes
@OpenApi public static java.util.List<java.lang.String> getAllDiagramTypes()
Returns list of all diagram types.- Returns:
- list of all diagram types.
- See Also:
getCreatableDiagramTypes()
-
getCreatableDiagramTypes
@OpenApi public static java.util.List<java.lang.String> getCreatableDiagramTypes()
Returns list of available to create (creatable) diagram types.- Returns:
- list of available to create (creatable) diagram types.
- See Also:
getAllDiagramTypes()
-
addIgnoredDiagramType
public static void addIgnoredDiagramType(java.lang.String diagramType)
Add diagram type, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.- Parameters:
diagramType- type of diagram.
-
addIgnoredDiagramType
public static void addIgnoredDiagramType(java.lang.String diagramType, boolean symbolDiagram)Add diagram type, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.- Parameters:
diagramType- type of diagram.symbolDiagram- true if diagram is symbolic
-
addIgnoredDiagramType
public static void addIgnoredDiagramType(java.util.List<java.lang.String> diagramTypes)
Add diagram types, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.- Parameters:
diagramTypes- type of diagram.
-
addIgnoredDiagramTypes
public static void addIgnoredDiagramTypes(java.util.Collection<java.lang.String> diagramTypes, boolean symbolDiagram)Add diagram types, which will be ignored if descriptor for this diagram type not registered. Ignored means that it will not show messages about not loaded diagrams when is loading diagram.- Parameters:
diagramTypes- type of diagram.symbolDiagram- true if diagram is symbolic
-
getIgnoredDiagramTypes
public static java.util.Set<java.lang.String> getIgnoredDiagramTypes()
Types of diagrams must be ignored.- Returns:
- list of diagrams types which are ignored to show warnings about missing resources.
-
isIgnoredSymbolDiagram
public static boolean isIgnoredSymbolDiagram(DiagramPresentationElement diagramPresentationElement)
Checks if diagram is ignored symbol diagram- Parameters:
diagramPresentationElement- diagram- Returns:
- true if diagram is ignored symbol diagram
-
createDiagramType
@OpenApi public static DiagramType createDiagramType(java.lang.String type)
Creates diagram type of given type string representation.- Parameters:
type- diagram type string representation- Returns:
- created diagram type.
- See Also:
DiagramTypeConstants
-
isCreatableDiagramType
@OpenApi public static boolean isCreatableDiagramType(java.lang.String type)
Check, whether diagram type is creatable.- Parameters:
type- diagram type string representation- Returns:
- true, if type is creatable.
- See Also:
DiagramTypeConstants
-
getSuperType
public static java.lang.String getSuperType(java.lang.String derivedType)
Returns registered super type for given diagram type.- Parameters:
derivedType- the given derived type.- Returns:
- the super diagram type or null.
-
getSuperType
@CheckForNull public java.lang.String getSuperType()
Returns registered super type for diagram type.- Returns:
- the super diagram type or null.
-
registerDiagramType
public static void registerDiagramType(java.lang.String newType, java.lang.String superType, boolean creatable)Adds and registers new diagram type.- Parameters:
newType- the new diagram type.superType- the 'super diagram' type of the new diagram type. E.g.Interaction Diagramis a 'super diagram' forCollaboration DiagramandSequence Diagram.creatable- flag indicating if the registering type diagrams will be creatable.
-
unregisterDiagramType
public static void unregisterDiagramType(java.lang.String type)
Unregisters diagram type.- Parameters:
type- the diagram type.
-
registerHumanNames
public static void registerHumanNames(java.lang.String newType, java.lang.String singularName, java.lang.String pluralName)
-
getSingularHumanName
public static java.lang.String getSingularHumanName(java.lang.String type)
Returns singular human name of the given type.- Parameters:
type- the given type.- Returns:
- singular name.
-
getPluralHumanName
public static java.lang.String getPluralHumanName(java.lang.String type)
Returns plural human name of the given type.- Parameters:
type- the given type.- Returns:
- plural name.
-
getUMLDiagramType
public java.lang.String getUMLDiagramType()
Returns UML diagram type.- Returns:
- UML diagram type.
-
getDiagramActualElementType
public static java.lang.Class getDiagramActualElementType(java.lang.String diagramType, Element owner)
-
registerStandardDiagramType
private static void registerStandardDiagramType(java.lang.String diagramType, @CheckForNull java.lang.String superDiagramType, @CheckForNull com.nomagic.magicdraw.uml.DiagramActualElementTypeResolver diagramActualElementTypeResolver)
-
isTypeOf
public static boolean isTypeOf(java.lang.String unknown, java.lang.String types)- Returns:
-
isTypeOf
public static boolean isTypeOf(java.lang.String unknown, java.util.List<java.lang.String> types)
-
getPossibleDiagramOwnerTypes
public static java.util.Collection<java.lang.Class> getPossibleDiagramOwnerTypes(@CheckForNull java.lang.String type)
-
getPossibleDiagramOwnerTypes
public static java.util.Collection<java.lang.Class> getPossibleDiagramOwnerTypes(@CheckForNull java.lang.String type, boolean includeSuperTypeOwners)- Parameters:
type- diagram typeincludeSuperTypeOwners- should possible owners of provided diagram type's super-type's be included- Returns:
- collection of class types
-
getOwnerTypes
private static java.util.Collection<java.lang.Class> getOwnerTypes(java.lang.String diagramType)
Gives possible owner types for given diagram type- Parameters:
diagramType- diagram type- Returns:
- collection of class types
-
getAllSubtypes
public static java.util.List<java.lang.String> getAllSubtypes(java.lang.String root, boolean creatable)collect all subtypes of the given root diagram type.rootis inclusive in results- Parameters:
root- rot diagram type of the returned resultcreatable- if true, than only creatable types are returned- Returns:
- subtypes of given rood diagram type.
rootis inclusive in results
-
getRootType
public static java.lang.String getRootType(java.lang.String diagramType)
Returns root type of given diagram type.- Returns:
- root type.
-
getRootUMLType
public static java.lang.String getRootUMLType(java.lang.String diagramType)
Returns root type of the UML type diagram.- Returns:
- root type one of the UML diagram type.
-
configureContextTypeByDiagramType
public static java.util.List<?> configureContextTypeByDiagramType(Project project, java.lang.String diagramType, java.util.List<java.lang.Class> contextTypes)
Configure owner types. Appends allowed DSLed context types (Stereotypes), may remove passed metaclasses.- Parameters:
project- projectdiagramType- diagram typecontextTypes- collection of java.lang.Class or Stereotype (for DSL) objects- Returns:
- types
-
filterByHiddenSuggestedDSLDiagramTypes
public static void filterByHiddenSuggestedDSLDiagramTypes(java.lang.String diagramType, java.util.Collection<?> contextTypes)Filters hidden suggested DSL diagram context types.- Parameters:
diagramType- type of the diagram.contextTypes- diagram context types.
-
unregisterContextTypeByDiagramTypeConfigurator
public static void unregisterContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)
Unregisters a new context type by diagram type configurator- Parameters:
configurator- configurator
-
registerContextTypeByDiagramTypeConfigurator
public static void registerContextTypeByDiagramTypeConfigurator(com.nomagic.magicdraw.uml.DiagramType.ContextTypesConfigurator configurator)
Registers a new context type by diagram type configurator- Parameters:
configurator- configurator
-
-