Provides an absolute or relative reference to an internal or external URL. The classical target parameters are supported. Another usage scenario is triggering an action, for example to open a popup window. In both cases, the link is a hypertext link.
Constructor for a new Link.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.ui.commons.Link(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | id for the new control, generated automatically if no id is given |
|
mSettings? | object | initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
enabled | boolean | true | Whether the link can be triggered by the user. Visibility: public |
helpId | string | empty string | Unique identifier used for help service. Visibility: public |
href | sap.ui.core.URI | The link target URI. Supports standard hyperlink behavior. If an action should be triggered, this should not be set, but instead an event handler for the "press" event should be registered. Visibility: public |
|
target | string | Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered. Visibility: public |
|
text | string | empty string | Link text to be displayed. Visibility: public |
width | sap.ui.core.CSSSize | Width of text link. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text defines the size. |
Name | Cardinality | Type | Description |
---|---|---|---|
ariaDescribedBy | 0..n | sap.ui.core.Control |
Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby). |
ariaLabelledBy | 0..n | sap.ui.core.Control |
Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby). |
Event | Description |
---|---|
press |
Event is fired when the user clicks the control. Listeners may prevent the default action of this event by calling the |
Method | Description |
---|---|
addAriaDescribedBy |
Adds some ariaDescribedBy into the association ariaDescribedBy. |
addAriaLabelledBy |
Adds some ariaLabelledBy into the association ariaLabelledBy. |
attachPress |
Attaches event handler When called, the context of the event handler (its Event is fired when the user clicks the control. |
detachPress |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.commons.Link.extend |
Creates a new subclass of class sap.ui.commons.Link with name
|
firePress |
Fires event press to attached listeners. Listeners may prevent the default action of this event by calling the |
focus |
Puts the focus to the link. |
getAccessibilityInfo |
References:
|
getAriaDescribedBy |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy. |
getAriaLabelledBy |
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy. |
getEnabled |
Gets current value of property enabled. Whether the link can be triggered by the user. Default value is |
getHelpId |
Gets current value of property helpId. Unique identifier used for help service. Default value is |
getHref |
Gets current value of property href. The link target URI. Supports standard hyperlink behavior. If an action should be triggered, this should not be set, but instead an event handler for the "press" event should be registered. |
sap.ui.commons.Link.getMetadata |
Returns a metadata object for class sap.ui.commons.Link. |
getTarget |
Gets current value of property target. Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered. |
getText |
Gets current value of property text. Link text to be displayed. Default value is |
getWidth |
Gets current value of property width. Width of text link. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text defines the size. |
removeAllAriaDescribedBy |
Removes all the controls in the association named ariaDescribedBy. |
removeAllAriaLabelledBy |
Removes all the controls in the association named ariaLabelledBy. |
removeAriaDescribedBy |
Removes an ariaDescribedBy from the association named ariaDescribedBy. |
removeAriaLabelledBy |
Removes an ariaLabelledBy from the association named ariaLabelledBy. |
setEnabled |
Sets a new value for property enabled. Whether the link can be triggered by the user. When called with a value of Default value is |
setHelpId |
Sets a new value for property helpId. Unique identifier used for help service. When called with a value of Default value is |
setHref |
Sets a new value for property href. The link target URI. Supports standard hyperlink behavior. If an action should be triggered, this should not be set, but instead an event handler for the "press" event should be registered. When called with a value of |
setTarget |
Sets a new value for property target. Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered. When called with a value of |
setText |
Sets a new value for property text. Link text to be displayed. When called with a value of Default value is |
setWidth |
Sets a new value for property width. Width of text link. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text defines the size. When called with a value of |
Adds some ariaDescribedBy into the association ariaDescribedBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaDescribedBy | sap.ui.core.ID sap.ui.core.Control |
The ariaDescribedBy to add; if empty, nothing is inserted |
Adds some ariaLabelledBy into the association ariaLabelledBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaLabelledBy | sap.ui.core.ID sap.ui.core.Control |
The ariaLabelledBy to add; if empty, nothing is inserted |
Attaches event handler fnFunction
to the press event of this sap.ui.commons.Link
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.ui.commons.Link
itself.
Event is fired when the user clicks the control.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Detaches event handler fnFunction
from the press event of this sap.ui.commons.Link
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.ui.commons.Link with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event press to attached listeners.
Listeners may prevent the default action of this event by calling the preventDefault
method on the event object. The return value of this method indicates whether the default action should be executed.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Gets current value of property enabled.
Whether the link can be triggered by the user.
Default value is true
.
Gets current value of property helpId.
Unique identifier used for help service.
Default value is empty string
.
Gets current value of property href.
The link target URI. Supports standard hyperlink behavior. If an action should be triggered, this should not be set, but instead an event handler for the "press" event should be registered.
Gets current value of property target.
Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered.
Gets current value of property text.
Link text to be displayed.
Default value is empty string
.
Gets current value of property width.
Width of text link. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text defines the size.
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaDescribedBy | int sap.ui.core.ID sap.ui.core.Control |
The ariaDescribedBy to be removed or its index or ID |
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaLabelledBy | int sap.ui.core.ID sap.ui.core.Control |
The ariaLabelledBy to be removed or its index or ID |
Sets a new value for property enabled.
Whether the link can be triggered by the user.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bEnabled | boolean | true |
New value for property |
Sets a new value for property helpId.
Unique identifier used for help service.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is empty string
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sHelpId | string | '' |
New value for property |
Sets a new value for property href.
The link target URI. Supports standard hyperlink behavior. If an action should be triggered, this should not be set, but instead an event handler for the "press" event should be registered.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sHref | sap.ui.core.URI |
New value for property |
Sets a new value for property target.
Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTarget | string |
New value for property |
Sets a new value for property text.
Link text to be displayed.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is empty string
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sText | string | '' |
New value for property |
Sets a new value for property width.
Width of text link. When it is set (CSS-size such as % or px), this is the exact size. When left blank, the text defines the size.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize |
New value for property |