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 selects active text.


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(mArguments?)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:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? Initial settings for the new control
Event Detail
press(oControlEvent)
Fires when the user clicks on active text.
Parameters:
{sap.ui.base.Event}oControlEvent
{sap.ui.base.EventProvider}oControlEvent.getSource
{object}oControlEvent.getParameters
{string}oControlEvent.getParameters.domRef DOM 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:
{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.m.ObjectAttribute.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.ObjectAttribute.
Returns:
{sap.ui.base.Metadata} Metadata 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:
{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.m.ObjectAttribute itself
Returns:
{sap.m.ObjectAttribute} Reference to this in order to allow method chaining
destroyCustomContent(): sap.m.ObjectAttribute
Destroys the customContent in the aggregation customContent.
Returns:
{sap.m.ObjectAttribute} Reference 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:
{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.m.ObjectAttribute} Reference to this in order to allow method chaining
firePress(mArguments?): sap.m.ObjectAttribute
Fires event press to attached listeners.

Expects the following event parameters:

  • domRef of type stringDOM reference of the ObjectAttribute's text to be used for positioning.
Parameters:
{Map}mArguments? The arguments to pass along with the event
Returns:
{sap.m.ObjectAttribute} Reference 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.

Returns:
{boolean} Value 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:
{DomNode} The DOM reference that Popup should dock to
getText(): string
Gets current value of property text.

Defines the ObjectAttribute text.

Returns:
{string} Value 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.TextDirection} Value of property textDirection
getTitle(): string
Gets current value of property title.

Defines the ObjectAttribute title.

Returns:
{string} Value 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.

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

Parameters:
{boolean}bActive New value for property active
Returns:
{sap.m.ObjectAttribute} Reference to this in order to allow method chaining
setCustomContent(oCustomContent): sap.m.ObjectAttribute
Sets the aggregated customContent.
Parameters:
{sap.ui.core.Control}oCustomContent The customContent to set
Returns:
{sap.m.ObjectAttribute} Reference 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:
{string}sText New value for property text
Returns:
{sap.m.ObjectAttribute} Reference 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.TextDirection}sTextDirection New value for property textDirection
Returns:
{sap.m.ObjectAttribute} Reference 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:
{string}sTitle New value for property title
Returns:
{sap.m.ObjectAttribute} Reference to this in order to allow method chaining