Class DiagramDescriptor

  • All Implemented Interfaces:
    java.lang.Cloneable
    Direct Known Subclasses:
    NonSymbolDiagramDescriptor

    @OpenApi
    public abstract class DiagramDescriptor
    extends java.lang.Object
    implements java.lang.Cloneable
    Descriptor of some extended diagram.
    This descriptor is used to define a new diagram type in the MagicDraw application. New diagram type be extended from some already existing type. New diagram will have separate diagram panel with its own toolbar.
    • Field Detail

      • smallIcon

        @CheckForNull
        private ResizableIcon smallIcon
        The cached small icon.
      • requiredPlugin

        @CheckForNull
        private com.nomagic.magicdraw.plugins.RequiredPluginInfo requiredPlugin
        Plugin which must be loaded to be able create diagram.
      • requiredFeatures

        private java.util.Collection<com.nomagic.magicdraw.core.Feature> requiredFeatures
        Features which should exist in the application to be able create diagram.
      • resourceProviderID

        @CheckForNull
        private java.lang.String resourceProviderID
        Resource provider which translates text read from diagram descriptor.
      • helpID

        @CheckForNull
        private java.lang.String helpID
        Online help page name.
      • banner

        @CheckForNull
        private com.nomagic.ui.banners.Banner banner
        Banner related to this diagram descriptor.
      • category

        @CheckForNull
        private java.lang.String category
        category for diagram grouping
    • Constructor Detail

      • DiagramDescriptor

        public DiagramDescriptor()
    • Method Detail

      • getSuperType

        @OpenApi
        public abstract java.lang.String getSuperType()
        Returns super type of this diagram.
        Returns:
        String the 'super diagram' type of the diagram type. E.g. Interaction Diagram is a 'super diagram' for Collaboration Diagram and Sequence Diagram.
      • isCreatable

        @OpenApi
        public abstract boolean isCreatable()
        Returns creatable flag.
        Returns:
        boolean flag indicating if the diagram will be creatable.
      • isUsedForSymbols

        @OpenApi
        public boolean isUsedForSymbols()
        Check if this diagram is used to draw symbols. Some diagram may be used to display tables, graphs or other components (for example dependency matrix table)
        Returns:
        true if diagram is used to draw symbols
      • storeDiagramProperties

        public boolean storeDiagramProperties()
        Checks if diagram properties for this diagram should be stored.
        Returns:
        true if diagram properties for this diagram should be stored.
      • getDiagramToolbarConfigurator

        @CheckForNull
        @OpenApi
        public abstract AMConfigurator getDiagramToolbarConfigurator()
        Returns:
        AMConfigurator which configures described diagram toolbar.
      • getDiagramShortcutsConfigurator

        @CheckForNull
        @OpenApi
        public abstract AMConfigurator getDiagramShortcutsConfigurator()
        Returns:
        AMConfigurator which configures described diagram shortcuts.
      • getDiagramContextConfigurator

        @CheckForNull
        @OpenApi
        public abstract DiagramContextAMConfigurator getDiagramContextConfigurator()
        Returns:
        AMConfigurator which configures described diagram context menu actions.
      • getDiagramTypeId

        @OpenApi
        public abstract java.lang.String getDiagramTypeId()
        Return diagram type id. Id is used to identify the diagram.
        Returns:
        String used to identify diagram type.
        See Also:
        DiagramTypeConstants
      • getAbbreviation

        @CheckForNull
        public java.lang.String getAbbreviation()
        Returns:
        the abbreviation
      • getSingularDiagramTypeHumanName

        @OpenApi
        public abstract java.lang.String getSingularDiagramTypeHumanName()
        Return diagram human name. Id is used to show the diagram type in the UI.
        Returns:
        human diagram name in singular.
      • getPluralDiagramTypeHumanName

        @OpenApi
        public abstract java.lang.String getPluralDiagramTypeHumanName()
        Return diagram human name. Id is used to show the diagram type in the UI.
        Returns:
        human diagram name in plural.
      • createSymbolFactory

        @CheckForNull
        public com.nomagic.magicdraw.uml.symbols.SymbolFactory createSymbolFactory()
        Returns symbol factory for this diagram.
        Returns:
        a new instance of symbol factory. This implementation always returns null.
      • getSVGIcon

        @CheckForNull
        @OpenApi
        public abstract ResizableIcon getSVGIcon()
        Resizable icon for diagram. svg and wmf format. Used in Content diagram.
        Returns:
        resizable icon in svg or wmf formats.
      • getSmallIconURL

        @CheckForNull
        @OpenApi
        public abstract java.net.URL getSmallIconURL()
        URL of small icon for diagram. Used in browser and menu.
        Returns:
        URL to icon shown diagram in browser and menu items.
      • getResourceProviderID

        @CheckForNull
        public java.lang.String getResourceProviderID()
        Returns:
        resource provider id which is used to translate text read from descriptor file. May be null.
      • setResourceProviderID

        public void setResourceProviderID​(@CheckForNull
                                          java.lang.String resourceProviderID)
        Usual diagrams should provide resource provider id, in other case buttons groups and descriptions will be not translatable.
        Parameters:
        resourceProviderID - provider id which is used to translate text read from descriptor file. May be null.
      • getHelpID

        @CheckForNull
        public java.lang.String getHelpID()
        Returns:
        online help page name
      • setHelpID

        public void setHelpID​(@CheckForNull
                              java.lang.String helpID)
        Parameters:
        helpID - new online page name
      • setSmallIcon

        protected void setSmallIcon​(@CheckForNull
                                    ResizableIcon icon)
      • getSmallIcon

        @CheckForNull
        public ResizableIcon getSmallIcon()
        If descriptor provides URL this method should not overridden.
        Returns:
        icon to show in diagram in browser.and menu items.
      • getMainMenuConfigurator

        @CheckForNull
        public AMConfigurator getMainMenuConfigurator()
        Returns:
        AMConfigurator which configures main menu for adding this diagram specific actions.
      • getMainToolbarConfigurator

        @CheckForNull
        public AMConfigurator getMainToolbarConfigurator()
        Returns:
        AMConfigurator which configures main toolbar for adding this diagram specific actions.
      • profileLoaded

        protected boolean profileLoaded​(Project project)
        Checks if UML Profile for this diagram already loaded in the model.
        Parameters:
        project - project
        Returns:
        true, if profile already loaded. Here returns true.
      • isProfileLoaded

        public boolean isProfileLoaded​(Project project)
        Parameters:
        project - project
        Returns:
        true if required profile is loaded.
      • getProfiles

        protected java.util.Collection<?> getProfiles()
        Returns path for profile of this diagram. If path is not null, profile will be loaded during diagram creation.
        Returns:
        some path to xml file of profile or null if profile does not exists for this type of the diagram.
      • getRequiredProfiles

        @CheckReturnValue
        @Nonnull
        private java.util.Collection<java.lang.String> getRequiredProfiles()
        Returns:
        required profiles, in string format. In case required profile is local, its filename is return. In case it is teamwork its qualified name is return.
      • getDiagramWrapper

        public com.nomagic.magicdraw.uml.DiagramDescriptor.DiagramWrapper getDiagramWrapper()
      • importProfile

        public boolean importProfile​(Project project,
                                     boolean ui)
        Import profile for this diagram into a given project.
        Parameters:
        project - project
        ui - show ui messages in case of some problems
        Returns:
        true if required profiles are attached to project
      • getDiagramActions

        @OpenApi
        @CheckForNull
        public MDActionsManager getDiagramActions()
        Returns manager of actions used in the diagram. Later these actions must be configured for toolbar or shortcuts. Only one instance of action must be used in the configurators. If this rule is not applied, some problems may occur(for example changed by user keyboard shortcuts for action may not be saved).
        Returns:
        manager of actions.
      • clone

        protected DiagramDescriptor clone()
        Overrides:
        clone in class java.lang.Object
      • getStereotypes

        public java.util.List<java.lang.String> getStereotypes​(Project project)
        Parameters:
        project - project
        Returns:
        list of stereotypes ids, these stereotypes will be assigned to the diagram element.
      • getSmartManipulatorsConfigurator

        @CheckForNull
        public com.nomagic.magicdraw.actions.SmartManipulatorsAMConfigurator getSmartManipulatorsConfigurator()
      • getSmartManipulatorsActions

        public ActionsManager getSmartManipulatorsActions​(boolean superType)
      • getTargetsManipulatorsActions

        public ActionsManager getTargetsManipulatorsActions​(boolean superType)
      • getRequiredPlugin

        @CheckForNull
        public final com.nomagic.magicdraw.plugins.RequiredPluginInfo getRequiredPlugin()
        Required plugin for this diagram
        Returns:
        required plugin for this diagram. If plugin is not available diagram will be not loaded. If returns null no plugin is required.
      • setRequiredPlugin

        public void setRequiredPlugin​(@CheckForNull
                                      com.nomagic.magicdraw.plugins.RequiredPluginInfo plugin)
        Sets required plugin for this diagram. If required plugin is not available diagram should not be loaded.
        Parameters:
        plugin - new required feature. Can be null.
      • getRequiredFeatures

        public java.util.Collection<com.nomagic.magicdraw.core.Feature> getRequiredFeatures()
        Gets required features which are needed by this diagram descriptor.
        Returns:
        required features which are needed by this diagram descriptor.
      • setRequiredFeatures

        public void setRequiredFeatures​(java.util.Collection<com.nomagic.magicdraw.core.Feature> requiredFeatures)
        Sets required features which are needed by this diagram descriptor.
        Parameters:
        requiredFeatures - required features which are needed by this diagram descriptor.
      • isSupported

        public boolean isSupported()
        Indicates if all necessary prerequisites are available to support this type of diagram. It can be required plugin or required feature.
        Returns:
        true if diagram is supported, false otherwise.
      • isSupported

        public static boolean isSupported​(@CheckForNull
                                          DiagramDescriptor diagramDescriptor)
      • getCategory

        @CheckForNull
        @OpenApi
        public java.lang.String getCategory()
        Diagram category name.
        Returns:
        diagram category
      • getKind

        public java.lang.String getKind()
        Returns a diagram kind used for grouping diagrams by their nature - symbolic diagram, table and etc.
        Returns:
        diagram kind
      • setCategory

        @OpenApi
        public void setCategory​(@CheckForNull
                                java.lang.String category)
        Set diagram category name.
        Parameters:
        category - category diagram category name
      • getRequiredFeature

        @CheckForNull
        public com.nomagic.magicdraw.uml.symbols.RequiredFeature getRequiredFeature()
        Gets required feature by this diagram descriptor.
        Returns:
        required feature by this diagram descriptor.
      • getBanner

        @CheckForNull
        public com.nomagic.ui.banners.Banner getBanner()
        Gets banner for this diagram descriptor.
        Returns:
        banner for this diagram descriptor.
      • setBanner

        public void setBanner​(@CheckForNull
                              com.nomagic.ui.banners.Banner banner)
        Sets banner for this diagram descriptor.
        Parameters:
        banner - banner to set.
      • configureNewDiagram

        public void configureNewDiagram​(Diagram diagram,
                                        @CheckForNull
                                        Namespace parent)
        Configure new created diagram
        Parameters:
        diagram - diagram
        parent - parent
      • hasContent

        public boolean hasContent()
        Does diagram has content. e.g. does diagram has content for locking/unlocking
        Returns:
        does diagram has content