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(mParameters?)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

  • Associations

  • 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:
stringsId?id for the new control, generated automatically if no id is given
objectmSettings?initial settings for the new control
Event Detail
press(oControlEvent)
Event is fired when the user clicks the control.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.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:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated 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.MetadataMetadata object describing this class
addAriaDescribedBy(vAriaDescribedBy): sap.ui.commons.Link
Adds some ariaDescribedBy into the association ariaDescribedBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedBythe ariaDescribedBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.LinkReference to this in order to allow method chaining
addAriaLabelledBy(vAriaLabelledBy): sap.ui.commons.Link
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledBythe ariaLabelledBy to add; if empty, nothing is inserted
Returns:
sap.ui.commons.LinkReference 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:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.commons.Link itself
Returns:
sap.ui.commons.LinkReference 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:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.commons.LinkReference to this in order to allow method chaining
firePress(mParameters?): 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:
objectmParameters?Parameters to pass along with the event
Returns:
booleanWhether 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.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns:
sap.ui.core.ID[]
getAriaLabelledBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
sap.ui.core.ID[]
getEnabled(): boolean

Gets current value of property enabled.

Whether the link can be triggered by the user.

Default value is true.

Returns:
booleanValue of property enabled
getHelpId(): string

Gets current value of property helpId.

Unique identifier used for help service.

Default value is .

Returns:
stringValue 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.URIValue 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:
stringValue of property target
getText(): string

Gets current value of property text.

Link text to be displayed.

Default value is .

Returns:
stringValue 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.

Returns:
sap.ui.core.CSSSizeValue of property width
Since:
1.8.0
removeAllAriaDescribedBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaDescribedBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAllAriaLabelledBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAriaDescribedBy(vAriaDescribedBy): sap.ui.core.ID
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaDescribedByThe ariaDescribedBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe removed ariaDescribedBy or null
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.ID
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledByThe ariaLabelledBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe 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:
booleanbEnabledNew value for property enabled
Returns:
sap.ui.commons.LinkReference 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:
stringsHelpIdNew value for property helpId
Returns:
sap.ui.commons.LinkReference 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.URIsHrefNew value for property href
Returns:
sap.ui.commons.LinkReference 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:
stringsTargetNew value for property target
Returns:
sap.ui.commons.LinkReference 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:
stringsTextNew value for property text
Returns:
sap.ui.commons.LinkReference 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.CSSSizesWidthNew value for property width
Returns:
sap.ui.commons.LinkReference to this in order to allow method chaining
Since:
1.8.0