Class HRefRunnable
- java.lang.Object
-
- com.nomagic.magicdraw.ui.notification.HRefRunnable
-
- All Implemented Interfaces:
java.lang.Runnable
@OpenApiAll public abstract class HRefRunnable extends java.lang.Object implements java.lang.RunnableRepresents 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 private booleancloseOnActivationprivate static intcountprivate java.lang.Stringhrefstatic java.lang.StringHREF_PREFIXprivate static java.lang.StringHREF_PREFIX_Sprivate booleanidleRequiredprivate booleanisVisibleprivate java.lang.Stringtext
-
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 HRefRunnablecreate(java.lang.String text, boolean closeOnActivation, java.lang.Runnable runnable)Create href runnablestatic HRefRunnablecreateHRefRunnableForElement(Element element)static HRefRunnablecreateHRefRunnableForElement(Element element, boolean includeVersionForTW)static HRefRunnablecreateHRefRunnableForElement(Element element, boolean includeVersionForTW, java.lang.String branch)private static java.lang.StringformatHRef(java.lang.String href)static java.lang.StringgetElementName(Element element)java.lang.StringgetHref()Returns runnable href idjava.lang.StringgetHrefLink()Creates HTML tags to have real hyperlink.java.lang.StringgetText()Returns href action text.booleanisCloseOnActivation()Indicates if notification will be closed after this action is selected for execution.booleanisIdleRequired()booleanisVisible()Indicates if action, representing href is rendered in notificationbooleanrunIfIdle()Run given runnable if application is in idle mode.booleanrunIfIdle(java.lang.Runnable preRun)Runs given runnable after preRun runnable was executed if application is in idle mode.voidsetCloseOnActivation(boolean closeOnActivation)Sets notification close flag for this runnable.voidsetHref(java.lang.String href)Sets href runnable idvoidsetIdleRequired(boolean idleRequired)Set flag to indicate that idle mode is required to execute this runnable.voidsetText(java.lang.String text)Sets href action presentation text.voidsetVisible(boolean visible)Sets visibility of action representing href.
-
-
-
Field Detail
-
HREF_PREFIX
public static final java.lang.String HREF_PREFIX
- See Also:
- Constant Field Values
-
HREF_PREFIX_S
private static final java.lang.String HREF_PREFIX_S
- See Also:
- Constant Field Values
-
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 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
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 idtext- link textclose- 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 textclose- 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 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 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 displaycloseOnActivation- true if notification should be closed clicked on textrunnable- 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.
-
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
-
-