Class AbstractNotification

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    Notification

    @OpenApi
    public abstract class AbstractNotification
    extends java.lang.Object
    implements java.io.Serializable
    Base MagicDraw notification composed of title, message text and list HRefRunnable actions
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractNotification()  
      AbstractNotification​(java.lang.String id, java.lang.String text)
      Defines notification constructor with unique id, text and empty title.
      AbstractNotification​(java.lang.String id, java.lang.String title, java.lang.String text)
      Defines notification constructor with unique id, title and text.
      AbstractNotification​(java.lang.String id, java.lang.String title, java.lang.String text, HRefRunnable[] actions)
      Defines notification constructor with unique id, title, text and list of href actions.
      AbstractNotification​(java.lang.String id, java.lang.String title, java.lang.String text, java.lang.String longText)
      Defines notification constructor with unique id, title, short and long description.
      AbstractNotification​(java.lang.String id, java.lang.String title, java.lang.String text, java.lang.String longText, HRefRunnable[] actions)
      Defines notification constructor with unique id, title, text and list of href actions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAllHRefActions​(HRefRunnable[] hrefActions)
      Adds array of href actions to already existing list of actions.
      void addHRefAction​(HRefRunnable r)
      Adds href action to list of already existing list of actions.
      boolean canDisable()
      Indicates if notification message can be disabled and will not be displayed anymore.
      protected void clearAllHRefActions()
      Removes all href actions from notification.
      HRefRunnable[] getAllHRefActions()
      Returns array of all href actions.
      HRefRunnable getHRefAction​(java.lang.String href)
      Gets href action with a given href.
      java.lang.String getID()
      Returns notification id.
      java.lang.String getLongText()
      Returns long notification text
      java.lang.String getText()
      Returns notification message text.
      java.lang.String getTitle()
      Returns notification title.
      void removeHRefAction​(HRefRunnable r)
      Removes given href action.
      void removeHRefAction​(java.lang.String href)
      Removes given href action with specified href id.
      void setCanDisable​(boolean canDisable)
      Sets notification ability to be disabled permanently by user.
      void setCanDisable​(boolean canDisable, com.nomagic.magicdraw.ui.notification.HideNotificationRunnable actionOnDisable)
      Sets notification ability to be disabled permanently by user.
      void setLongText​(java.lang.String longText)
      Sets notification long text
      void setText​(java.lang.String text)
      Sets notification message text.
      void setTitle​(java.lang.String title)
      Sets notification title.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mRunnable

        private final transient java.util.Map<java.lang.String,​HRefRunnable> mRunnable
      • mID

        private java.lang.String mID
      • mTitle

        @CheckForNull
        private java.lang.String mTitle
      • mText

        @CheckForNull
        private java.lang.String mText
      • mLongText

        @CheckForNull
        private java.lang.String mLongText
      • canDisable

        private boolean canDisable
    • Constructor Detail

      • AbstractNotification

        public AbstractNotification()
      • AbstractNotification

        public AbstractNotification​(java.lang.String id,
                                    java.lang.String text)
        Defines notification constructor with unique id, text and empty title.
        Parameters:
        id - notification unique id
        text - notification message text
      • AbstractNotification

        public AbstractNotification​(java.lang.String id,
                                    java.lang.String title,
                                    java.lang.String text)
        Defines notification constructor with unique id, title and text.
        Parameters:
        id - notification unique id
        title - notification title
        text - notification message text
      • AbstractNotification

        public AbstractNotification​(java.lang.String id,
                                    java.lang.String title,
                                    java.lang.String text,
                                    java.lang.String longText)
        Defines notification constructor with unique id, title, short and long description.
        Parameters:
        id - notification unique id
        title - notification title
        text - notification short message text
        longText - notification long message text
      • AbstractNotification

        public AbstractNotification​(java.lang.String id,
                                    java.lang.String title,
                                    java.lang.String text,
                                    @CheckForNull
                                    HRefRunnable[] actions)
        Defines notification constructor with unique id, title, text and list of href actions.
        Parameters:
        id - notification unique id
        title - notification title
        text - notification message text
        actions - list of href controls
      • AbstractNotification

        public AbstractNotification​(java.lang.String id,
                                    @CheckForNull
                                    java.lang.String title,
                                    @CheckForNull
                                    java.lang.String text,
                                    @CheckForNull
                                    java.lang.String longText,
                                    @CheckForNull
                                    HRefRunnable[] actions)
        Defines notification constructor with unique id, title, text and list of href actions.
        Parameters:
        id - notification unique id
        title - notification title
        text - notification message text
        longText - notification long text
        actions - list of href controls
    • Method Detail

      • getID

        @OpenApi
        public java.lang.String getID()
        Returns notification id.
        Returns:
        notification id
      • getTitle

        @OpenApi
        @CheckForNull
        public java.lang.String getTitle()
        Returns notification title.
        Returns:
        notification title
      • setTitle

        @OpenApi
        public void setTitle​(java.lang.String title)
        Sets notification title.
        Parameters:
        title - notification title
      • getText

        @OpenApi
        @CheckForNull
        public java.lang.String getText()
        Returns notification message text.
        Returns:
        notification text
      • setText

        @OpenApi
        public void setText​(java.lang.String text)
        Sets notification message text.
        Parameters:
        text - notification text
      • getLongText

        @OpenApi
        @CheckForNull
        public java.lang.String getLongText()
        Returns long notification text
        Returns:
        long notification text
      • setLongText

        @OpenApi
        public void setLongText​(@CheckForNull
                                java.lang.String longText)
        Sets notification long text
        Parameters:
        longText - notification long text
      • addHRefAction

        @OpenApi
        public void addHRefAction​(HRefRunnable r)
        Adds href action to list of already existing list of actions.
        Parameters:
        r - given href action
      • addAllHRefActions

        public final void addAllHRefActions​(@CheckForNull
                                            HRefRunnable[] hrefActions)
        Adds array of href actions to already existing list of actions.
        Parameters:
        hrefActions - array of href actions to add
      • getAllHRefActions

        public HRefRunnable[] getAllHRefActions()
        Returns array of all href actions.
        Returns:
        array of href actions
      • removeHRefAction

        @OpenApi
        public void removeHRefAction​(HRefRunnable r)
        Removes given href action.
        Parameters:
        r - href action to remove
      • removeHRefAction

        @OpenApi
        public void removeHRefAction​(java.lang.String href)
        Removes given href action with specified href id.
        Parameters:
        href - href id to remove from href list
      • getHRefAction

        @OpenApi
        @CheckForNull
        public HRefRunnable getHRefAction​(java.lang.String href)
        Gets href action with a given href. If action does not exist, null is returned.
        Parameters:
        href - action href
        Returns:
        href action if found, null otherwise
      • clearAllHRefActions

        protected void clearAllHRefActions()
        Removes all href actions from notification.
      • canDisable

        public boolean canDisable()
        Indicates if notification message can be disabled and will not be displayed anymore. If the flag is set to true, when notification is shown, user will be present with ability to disable it. Disabled notification id will be saved in environment options and not shown anymore.
        Returns:
        true if notification can be disabled
      • setCanDisable

        public void setCanDisable​(boolean canDisable)
        Sets notification ability to be disabled permanently by user. If canDisabled property is set to true, when notification is shown, user will be present with ability to disable it.
        Parameters:
        canDisable - notification disable status.
      • setCanDisable

        public void setCanDisable​(boolean canDisable,
                                  com.nomagic.magicdraw.ui.notification.HideNotificationRunnable actionOnDisable)
        Sets notification ability to be disabled permanently by user. If canDisabled property is set to true, when notification is shown, user will be presented with ability to disable it.
        Parameters:
        canDisable - notification disable status.
        actionOnDisable - action to be executed when notification is disabled and closed.