Class HRefRunnable
java.lang.Object
com.nomagic.magicdraw.ui.notification.HRefRunnable
- All Implemented Interfaces:
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
-
Constructor Summary
ConstructorDescriptionHRefRunnable
(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
(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
(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.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. -
Method Summary
Modifier and TypeMethodDescriptionstatic HRefRunnable
Create href runnablestatic HRefRunnable
createHRefRunnableForElement
(Element element) static HRefRunnable
createHRefRunnableForElement
(Element element, boolean includeVersionForTW) static HRefRunnable
createHRefRunnableForElement
(Element element, boolean includeVersionForTW, String branch) boolean
protected String
formatHRef
(String href) static String
getElementName
(Element element) getHref()
Returns runnable href idCreates HTML tags to have real hyperlink.getText()
Returns href action text.int
hashCode()
boolean
Indicates if notification will be closed after this action is selected for execution.boolean
boolean
Indicates if action, representing href is rendered in notificationboolean
Run given runnable if application is in idle mode.boolean
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
Sets href runnable idvoid
setIdleRequired
(boolean idleRequired) Set flag to indicate that idle mode is required to execute this runnable.void
Sets href action presentation text.void
setVisible
(boolean visible) Sets visibility of action representing href.
-
Field Details
-
HREF_PREFIX
- See Also:
-
-
Constructor Details
-
HRefRunnable
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 idtext
- link textclose
- 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
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 idtext
- link textclose
- indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
-
HRefRunnable
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 textclose
- indicates if notification must be closed after link was pressed. If set to true, notification will be closed.
-
HRefRunnable
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 textclose
- 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
-
createHRefRunnableForElement
-
createHRefRunnableForElement
public static HRefRunnable createHRefRunnableForElement(Element element, boolean includeVersionForTW) -
createHRefRunnableForElement
public static HRefRunnable createHRefRunnableForElement(Element element, boolean includeVersionForTW, @CheckForNull String branch) -
create
Create href runnable- Parameters:
text
- text to displaycloseOnActivation
- true if notification should be closed clicked on textrunnable
- runnable to run when click on text- Returns:
- HRefRunnable
-
setHref
Sets href runnable id- Parameters:
href
- runnable id
-
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
Returns href action text.- Returns:
- href action text.
-
setText
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
Creates HTML tags to have real hyperlink. -
formatHRef
-
runIfIdle
public boolean runIfIdle()Run given runnable if application is in idle mode. Otherwise show busy warning- Returns:
- true if runnable was executed
-
runIfIdle
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
-
hashCode
public int hashCode()
-