Class sap.ui.commons.LinkModule: sap/ui/commons/Link

extends Control

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.

Deprecated API:Since version 1.38. Instead, use the sap.m.Link control.

Constructor Summary
new sap.ui.commons.Link(sId?, mSettings?)Constructor for a new Link.
Event Summary
press(oControlEvent)Event is fired when the user clicks the control.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.Link.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.Link with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.Link.getMetadata()Returns a metadata object for class sap.ui.commons.Link.
addAriaDescribedBy(vAriaDescribedBy)Adds some ariaDescribedBy into the association ariaDescribedBy.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the press event of this sap.ui.commons.Link.
detachPress(fnFunction, oListener)Detaches event handler fnFunction from the press event of this sap.ui.commons.Link.
firePress(mArguments?)Fires event press to attached listeners.
focus()Puts the focus to the link.
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.
getHelpId()Gets current value of property helpId.
getHref()Gets current value of property href.
getTarget()Gets current value of property target.
getText()Gets current value of property text.
getWidth()Gets current value of property width.
removeAllAriaDescribedBy()Removes all the controls in the association named ariaDescribedBy.
removeAllAriaLabelledBy()Removes all the controls in the association named ariaLabelledBy.
removeAriaDescribedBy(vAriaDescribedBy)Removes an ariaDescribedBy from the association named ariaDescribedBy.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
setEnabled(bEnabled)Sets a new value for property enabled.
setHelpId(sHelpId)Sets a new value for property helpId.
setHref(sHref)Sets a new value for property href.
setTarget(sTarget)Sets a new value for property target.
setText(sText)Sets a new value for property text.
setWidth(sWidth)Sets a new value for property width.
Constructor Detail
new sap.ui.commons.Link(sId?, mSettings?)
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 for a general description of the syntax of the settings object.

The supported settings are:

  • Properties
  • Events
    • press : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
{string}sId? id for the new control, generated automatically if no id is given
{object}mSettings? initial settings for the new control
Deprecated:
Since version 1.38. Instead, use the sap.m.Link control.
Event Detail
press(oControlEvent)
Event is fired when the user clicks the control.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
Method Detail
sap.ui.commons.Link.extend(sClassName, oClassInfo?, FNMetaImpl?): function
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.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.ui.commons.Link.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.Link.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.Link
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
{string|sap.ui.core.Control}vAriaDescribedBy the ariaDescribedBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.Link
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
{string|sap.ui.core.Control}vAriaLabelledBy the ariaLabelledBy to add; if empty, nothing is inserted
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
attachPress(oData?, fnFunction, oListener?): sap.ui.commons.Link
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.

Parameters:
{object}oData? An application-specific payload object that will be passed to the event handler along with the event object when firing the event
{function}fnFunction The function to be called when the event occurs
{object}oListener? Context object to call the event handler with. Defaults to this sap.ui.commons.Link itself
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
detachPress(fnFunction, oListener): sap.ui.commons.Link
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.

Parameters:
{function}fnFunction The function to be called, when the event occurs
{object}oListener Context object on which the given function had to be called
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
firePress(mArguments?): boolean
Fires event press to attached listeners.

Listeners may prevent the default action of this event by using the preventDefault-method on the event object.

Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{boolean} Whether or not to prevent the default action
focus(): void
Puts the focus to the link.
getAccessibilityInfo()
See:
{sap.ui.core.Control#getAccessibilityInfo}
getAriaDescribedBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
{sap.ui.core.Control[]}
getAriaLabelledBy(): sap.ui.core.Control[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
{sap.ui.core.Control[]}
getEnabled(): boolean
Gets current value of property enabled.

Whether the link can be triggered by the user.

Default value is true.

Returns:
{boolean} Value of property enabled
getHelpId(): string
Gets current value of property helpId.

Unique identifier used for help service.

Default value is .

Returns:
{string} Value of property helpId
getHref(): sap.ui.core.URI
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.

Returns:
{sap.ui.core.URI} Value of property href
getTarget(): string
Gets current value of property target.

Options are _self, _top, _blank, _parent, _search. Alternatively, a frame name can be entered.

Returns:
{string} Value of property target
getText(): string
Gets current value of property text.

Link text to be displayed.

Default value is .

Returns:
{string} Value of property text
getWidth(): sap.ui.core.CSSSize
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.

Since:
1.8.0
Returns:
{sap.ui.core.CSSSize} Value of property width
removeAllAriaDescribedBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.Control[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
{sap.ui.core.Control[]} An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.Control
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaDescribedBy The ariaDescribedByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.Control
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
{int|string|sap.ui.core.Control}vAriaLabelledBy The ariaLabelledByto be removed or its index or ID
Returns:
{sap.ui.core.Control} the removed ariaLabelledBy or null
setEnabled(bEnabled): sap.ui.commons.Link
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.

Parameters:
{boolean}bEnabled New value for property enabled
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
setHelpId(sHelpId): sap.ui.commons.Link
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 .

Parameters:
{string}sHelpId New value for property helpId
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
setHref(sHref): sap.ui.commons.Link
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.

Parameters:
{sap.ui.core.URI}sHref New value for property href
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
setTarget(sTarget): sap.ui.commons.Link
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.

Parameters:
{string}sTarget New value for property target
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
setText(sText): sap.ui.commons.Link
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 .

Parameters:
{string}sText New value for property text
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.Link
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.

Parameters:
{sap.ui.core.CSSSize}sWidth New value for property width
Since:
1.8.0
Returns:
{sap.ui.commons.Link} Reference to this in order to allow method chaining