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.
    • 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.
    • Field Detail

      • count

        private static int count
      • href

        private java.lang.String href
      • text

        private java.lang.String text
      • closeOnActivation

        private boolean closeOnActivation
      • isVisible

        private boolean isVisible
      • idleRequired

        private boolean idleRequired
    • 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)
      • 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>.
      • formatHRef

        private static java.lang.String formatHRef​(@CheckForNull
                                                   java.lang.String href)
      • 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