Class HRefRunnable

  • All Implemented Interfaces:
    java.lang.Runnable

    @OpenApiAll
    public abstract class HRefRunnable
    extends java.lang.Object
    implements java.lang.Runnable
    Represents action element in notification window. Action element contains id (href) and displayable text. CloseOnActivation flag indicates if notification message must be closed after action was selected. By default the element is rendered as HTML link. When action is selected the run method is called. Custom code can be executed by overriding run() method passing HRefRunnable to notification.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String HREF_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      HRefRunnable​(java.lang.String text, boolean close)
      Creates href runnable with specified text as link and close boolean value indicating if notification must be closed after link was pressed.
      HRefRunnable​(java.lang.String text, boolean close, boolean idleRequired)
      Creates href runnable with specified text as link and close boolean value indicating if notification must be closed after link was pressed.
      HRefRunnable​(java.lang.String href, java.lang.String text, boolean close)
      Creates href runnable with specified href id, text as link and close boolean value indicating if notification must be closed after link was pressed.
      HRefRunnable​(java.lang.String href, java.lang.String text, boolean close, boolean idleRequired)
      Creates href runnable with specified href id, text as link and close boolean value indicating if notification must be closed after link was pressed.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static HRefRunnable create​(java.lang.String text, boolean closeOnActivation, java.lang.Runnable runnable)
      Create href runnable
      static HRefRunnable createHRefRunnableForElement​(Element element)  
      static HRefRunnable createHRefRunnableForElement​(Element element, boolean includeVersionForTW)  
      static HRefRunnable createHRefRunnableForElement​(Element element, boolean includeVersionForTW, java.lang.String branch)  
      static java.lang.String getElementName​(Element element)  
      java.lang.String getHref()
      Returns runnable href id
      java.lang.String getHrefLink()
      Creates HTML tags to have real hyperlink.
      java.lang.String getText()
      Returns href action text.
      boolean isCloseOnActivation()
      Indicates if notification will be closed after this action is selected for execution.
      boolean isIdleRequired()  
      boolean isVisible()
      Indicates if action, representing href is rendered in notification
      boolean runIfIdle()
      Run given runnable if application is in idle mode.
      boolean runIfIdle​(java.lang.Runnable preRun)
      Runs given runnable after preRun runnable was executed if application is in idle mode.
      void setCloseOnActivation​(boolean closeOnActivation)
      Sets notification close flag for this runnable.
      void setHref​(java.lang.String href)
      Sets href runnable id
      void setIdleRequired​(boolean idleRequired)
      Set flag to indicate that idle mode is required to execute this runnable.
      void setText​(java.lang.String text)
      Sets href action presentation text.
      void setVisible​(boolean visible)
      Sets visibility of action representing href.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Runnable

        run
    • Constructor Detail

      • HRefRunnable

        public HRefRunnable​(java.lang.String href,
                            java.lang.String text,
                            boolean close,
                            boolean idleRequired)
        Creates href runnable with specified href id, text as link and close boolean value indicating if notification must be closed after link was pressed.
        Parameters:
        href - runnable id
        text - link text
        close - indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
        idleRequired - true if application must be in idle mode in order to execute this runnable
      • HRefRunnable

        public HRefRunnable​(java.lang.String href,
                            java.lang.String text,
                            boolean close)
        Creates href runnable with specified href id, text as link and close boolean value indicating if notification must be closed after link was pressed.
        Parameters:
        href - runnable id
        text - link text
        close - indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
      • HRefRunnable

        public HRefRunnable​(java.lang.String text,
                            boolean close)
        Creates href runnable with specified text as link and close boolean value indicating if notification must be closed after link was pressed. Href id will be generated in format of http://n, where n is number.
        Parameters:
        text - link text
        close - indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
      • HRefRunnable

        public HRefRunnable​(java.lang.String text,
                            boolean close,
                            boolean idleRequired)
        Creates href runnable with specified text as link and close boolean value indicating if notification must be closed after link was pressed. Href id will be generated in format of http://n, where n is number.
        Parameters:
        text - link text
        close - indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
        idleRequired - true if application must be in idle mode in order to execute this runnable
    • Method Detail

      • getElementName

        public static java.lang.String getElementName​(Element element)
      • createHRefRunnableForElement

        public static HRefRunnable createHRefRunnableForElement​(Element element)
      • createHRefRunnableForElement

        public static HRefRunnable createHRefRunnableForElement​(Element element,
                                                                boolean includeVersionForTW)
      • createHRefRunnableForElement

        public static HRefRunnable createHRefRunnableForElement​(Element element,
                                                                boolean includeVersionForTW,
                                                                @CheckForNull
                                                                java.lang.String branch)
      • create

        public static HRefRunnable create​(java.lang.String text,
                                          boolean closeOnActivation,
                                          java.lang.Runnable runnable)
        Create href runnable
        Parameters:
        text - text to display
        closeOnActivation - true if notification should be closed clicked on text
        runnable - runnable to run when click on text
        Returns:
        HRefRunnable
      • setHref

        public void setHref​(@CheckForNull
                            java.lang.String href)
        Sets href runnable id
        Parameters:
        href - runnable id
      • getHref

        public java.lang.String getHref()
        Returns runnable href id
        Returns:
        runnable href id
      • setCloseOnActivation

        public void setCloseOnActivation​(boolean closeOnActivation)
        Sets notification close flag for this runnable. If set to true, notification wll be closed after href link was selected.
        Parameters:
        closeOnActivation - close flag. If set to true, notification wll be closed after href link was selected.
      • isCloseOnActivation

        public boolean isCloseOnActivation()
        Indicates if notification will be closed after this action is selected for execution.
        Returns:
        true if notification will be closed after this action is selected for execution
      • getText

        public java.lang.String getText()
        Returns href action text.
        Returns:
        href action text.
      • setText

        public void setText​(java.lang.String text)
        Sets href action presentation text.
        Parameters:
        text - new href action presentation text
      • isVisible

        public boolean isVisible()
        Indicates if action, representing href is rendered in notification
        Returns:
        true if action, representing href is rendered in notification
      • setVisible

        public void setVisible​(boolean visible)
        Sets visibility of action representing href.
        Parameters:
        visible - visibility state of action representing href
      • getHrefLink

        public java.lang.String getHrefLink()
        Creates HTML tags to have real hyperlink.
        Returns:
        <a href="getHref()">getTextt</a>.
      • runIfIdle

        public boolean runIfIdle()
        Run given runnable if application is in idle mode. Otherwise show busy warning
        Returns:
        true if runnable was executed
      • runIfIdle

        public boolean runIfIdle​(java.lang.Runnable preRun)
        Runs given runnable after preRun runnable was executed if application is in idle mode. Otherwise show busy warning
        Parameters:
        preRun - executes before given runnable
        Returns:
        true if runnable was executed
      • setIdleRequired

        public void setIdleRequired​(boolean idleRequired)
        Set flag to indicate that idle mode is required to execute this runnable.
        Parameters:
        idleRequired - set true if this runnable can be executed only while application is in idle mode
      • isIdleRequired

        public boolean isIdleRequired()
        Returns:
        true if this runnable can be executed only while application is in idle mode