Class sap.m.ObjectAttributeModule: sap/m/ObjectAttribute

extends Control

The ObjectAttribute control displays a text field that can be normal or active. The ObjectAttribute fires a press event when the user chooses the active text.

Note: If property active is set to true, only the value of the text property is styled and acts as a link. In this case the text property must also be set, as otherwise there will be no link displayed for the user.


Since: 1.12.
Constructor Summary
new sap.m.ObjectAttribute(sId?, mSettings?)Constructor for a new ObjectAttribute.
Event Summary
press(oControlEvent)Fires when the user clicks on active text.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.ObjectAttribute.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.ObjectAttribute with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.ObjectAttribute.getMetadata()Returns a metadata object for class sap.m.ObjectAttribute.
attachPress(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the press event of this sap.m.ObjectAttribute.
destroyCustomContent()Destroys the customContent in the aggregation customContent.
detachPress(fnFunction, oListener)Detaches event handler fnFunction from the press event of this sap.m.ObjectAttribute.
firePress(mParameters?)Fires event press to attached listeners.
getActive()Gets current value of property active.
getCustomContent()Gets content of aggregation customContent.
getPopupAnchorDomRef()Defines to which DOM reference the Popup should be docked.
getText()Gets current value of property text.
getTextDirection()Gets current value of property textDirection.
getTitle()Gets current value of property title.
setActive(bActive)Sets a new value for property active.
setCustomContent(oCustomContent)Sets the aggregated customContent.
setText(sText)Sets a new value for property text.
setTextDirection(sTextDirection)Sets a new value for property textDirection.
setTitle(sTitle)Sets a new value for property title.
Constructor Detail
new sap.m.ObjectAttribute(sId?, mSettings?)

Constructor for a new ObjectAttribute.

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

  • Aggregations

  • 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)
Fires when the user clicks on active text.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
stringoControlEvent.getParameters.domRefDOM reference of the ObjectAttribute's text to be used for positioning.
Method Detail
sap.m.ObjectAttribute.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.m.ObjectAttribute 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.m.ObjectAttribute.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.ObjectAttribute.
Returns:
sap.ui.base.MetadataMetadata object describing this class
attachPress(oData?, fnFunction, oListener?): sap.m.ObjectAttribute

Attaches event handler fnFunction to the press event of this sap.m.ObjectAttribute.

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.m.ObjectAttribute itself.

Fires when the user clicks on active text.

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.m.ObjectAttribute itself
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
destroyCustomContent(): sap.m.ObjectAttribute
Destroys the customContent in the aggregation customContent.
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
detachPress(fnFunction, oListener): sap.m.ObjectAttribute

Detaches event handler fnFunction from the press event of this sap.m.ObjectAttribute.

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.m.ObjectAttributeReference to this in order to allow method chaining
firePress(mParameters?): sap.m.ObjectAttribute
Fires event press to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
stringmParameters.domRef?DOM reference of the ObjectAttribute's text to be used for positioning.
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
getActive(): boolean

Gets current value of property active.

Indicates if the ObjectAttribute text is selectable for the user.

Note: As of version 1.48, only the value of the text property becomes active (styled and acts like a link) as opposed to both the title and text in the previous versions. If you set this property to true, you have to also set the text property.

Returns:
booleanValue of property active
getCustomContent(): sap.ui.core.Control

Gets content of aggregation customContent.

When the aggregation is set, it replaces the text, active and textDirection properties. This also ignores the press event. The provided control is displayed as an active link. Note: It will only allow sap.m.Text and sap.m.Link controls.

Returns:
sap.ui.core.Control
getPopupAnchorDomRef(): DomNode
Defines to which DOM reference the Popup should be docked.
Returns:
DomNodeThe DOM reference that Popup should dock to
getText(): string

Gets current value of property text.

Defines the ObjectAttribute text.

Returns:
stringValue of property text
getTextDirection(): sap.ui.core.TextDirection

Gets current value of property textDirection.

Determines the direction of the text, not including the title. Available options for the text direction are LTR (left-to-right) and RTL (right-to-left). By default the control inherits the text direction from its parent control.

Default value is Inherit.

Returns:
sap.ui.core.TextDirectionValue of property textDirection
getTitle(): string

Gets current value of property title.

Defines the ObjectAttribute title.

Returns:
stringValue of property title
setActive(bActive): sap.m.ObjectAttribute

Sets a new value for property active.

Indicates if the ObjectAttribute text is selectable for the user.

Note: As of version 1.48, only the value of the text property becomes active (styled and acts like a link) as opposed to both the title and text in the previous versions. If you set this property to true, you have to also set the text property.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
booleanbActiveNew value for property active
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
setCustomContent(oCustomContent): sap.m.ObjectAttribute
Sets the aggregated customContent.
Parameters:
sap.ui.core.ControloCustomContentThe customContent to set
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
setText(sText): sap.m.ObjectAttribute

Sets a new value for property text.

Defines the ObjectAttribute text.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsTextNew value for property text
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
setTextDirection(sTextDirection): sap.m.ObjectAttribute

Sets a new value for property textDirection.

Determines the direction of the text, not including the title. Available options for the text direction are LTR (left-to-right) and RTL (right-to-left). By default the control inherits the text direction from its parent control.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is Inherit.

Parameters:
sap.ui.core.TextDirectionsTextDirectionNew value for property textDirection
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining
setTitle(sTitle): sap.m.ObjectAttribute

Sets a new value for property title.

Defines the ObjectAttribute title.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsTitleNew value for property title
Returns:
sap.m.ObjectAttributeReference to this in order to allow method chaining