Class DiagramType

  • All Implemented Interfaces:
    DiagramTypeConstants, java.lang.Cloneable

    @OpenApi
    public class DiagramType
    extends java.lang.Object
    implements java.lang.Cloneable, DiagramTypeConstants
    The DiagramType class represents the 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.List<java.lang.String> mIgnoredDiagramTypes
        List of diagrams types. 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
    • 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
      • isEqualType

        @OpenApi
        public boolean isEqualType​(DiagramType type)
        Checks if diagram type is equal to given diagram type.
        Parameters:
        type - diagram type
        Returns:
        true if 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:
        true if 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 of instanceof operator)
        Parameters:
        type - diagram type.
        Returns:
        true if 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 of instanceof operator)
        Parameters:
        types - the list of diagram type string representation.
        Returns:
        true if 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 of instanceof operator)
        Parameters:
        type - diagram type string representation.
        Returns:
        true if 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:
        clone in class java.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.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.
      • getIgnoredDiagramTypes

        public static java.util.List<java.lang.String> getIgnoredDiagramTypes()
        Types of diagrams must be ignored.
        Returns:
        list of diagrams types which are ignored to show warnings about missing resources.
      • 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 Diagram is a 'super diagram' for Collaboration Diagram and Sequence 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.util.List<java.lang.String> types)
      • isTypeOf

        public static boolean isTypeOf​(java.lang.String unknown,
                                       java.lang.String standard)
      • 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 type
        includeSuperTypeOwners - 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. root is inclusive in results
        Parameters:
        root - rot diagram type of the returned result
        creatable - if true, than only creatable types are returned
        Returns:
        subtypes of given rood diagram type. root is 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 - project
        diagramType - diagram type
        contextTypes - 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