Class HRefRunnable

java.lang.Object
com.nomagic.magicdraw.ui.notification.HRefRunnable
All Implemented Interfaces:
Runnable

@OpenApiAll public abstract class HRefRunnable extends Object implements 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 Details

  • Constructor Details

    • HRefRunnable

      public HRefRunnable(String href, 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(String href, 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(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(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 Details

    • getElementName

      public static 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 String branch)
    • create

      public static HRefRunnable create(String text, boolean closeOnActivation, 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 String href)
      Sets href runnable id
      Parameters:
      href - runnable id
    • getHref

      public 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 String getText()
      Returns href action text.
      Returns:
      href action text.
    • setText

      public void setText(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 String getHrefLink()
      Creates HTML tags to have real hyperlink.
      Returns:
      <a href="getHref()">getTextt</a>.
    • formatHRef

      protected String formatHRef(@CheckForNull 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(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
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object