class sap.m.ObjectNumber

Control sample: sap.m.ObjectNumber
Visiblity: public
UX Guidelines: Object Number
Implements: sap.ui.core.IFormContent
Available since: N/A
Module: sap/m/ObjectNumber
Application Component: CA-UI5-CTR

The ObjectNumber control displays number and number unit properties for an object. The number can be displayed using semantic colors to provide additional meaning about the object to the user.

With 1.63, large design of the control is supported by setting sapMObjectNumberLarge CSS class to the ObjectNumber.

Note: To fulfill the design guidelines when you are using sapMObjectNumberLarge CSS class set the emphasized property to false.

This control can be a drag source.

Constructor

Constructor for a new ObjectNumber.

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.m.ObjectNumber(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


Properties

Name Type Default Value Description
active boolean false

Indicates if the ObjectNumber text and icon can be clicked/tapped by the user.

Note: If you set this property to true, you have to set also the number or unit property.

Since: 1.86.

Visibility: public
emphasized boolean true

Indicates if the object number should appear emphasized.

Visibility: public
emptyIndicatorMode sap.m.EmptyIndicatorMode Off

Specifies if an empty indicator should be displayed when there is no number.

Since: 1.89.

Visibility: public
inverted boolean false

Determines whether the background color reflects the set state instead of the control's text.

Since: 1.86.

Visibility: public
number string

Defines the number field.

Visibility: public
numberUnit string

Defines the number units qualifier.

Visibility: public
state sap.ui.core.ValueState None

Determines the object number's value state. Setting this state will cause the number to be rendered in state-specific colors.

Visibility: public
textAlign sap.ui.core.TextAlign Begin

Sets the horizontal alignment of the number and unit.

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

Available options for the number and unit text direction are LTR(left-to-right) and RTL(right-to-left). By default, the control inherits the text direction from its parent control.

Visibility: public
unit string

Defines the number units qualifier. If numberUnit and unit are both set, the unit value is used.

Since: 1.16.1.

Visibility: public

Associations

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).


Events Overview

Event Description
press

Fires when the user clicks/taps on active Object Number.

Since: 1.86.

press

Fires when the user clicks/taps on active Object Number.

Since: 1.86.

Param Type Description
oControlEvent sap.ui.base.Event
getSource sap.ui.base.EventProvider
getParameters object

Methods Overview

Method Description
addAriaDescribedBy

Adds some ariaDescribedBy into the association ariaDescribedBy.

addAriaLabelledBy

Adds some ariaLabelledBy into the association ariaLabelledBy.

attachPress

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

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.ObjectNumber itself.

Fires when the user clicks/taps on active Object Number.

detachPress

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

The passed function and listener object must match the ones used for event registration.

sap.m.ObjectNumber.extend

Creates a new subclass of class sap.m.ObjectNumber 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.

firePress

Fires event press to attached listeners.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

getActive

Gets current value of property active.

Indicates if the ObjectNumber text and icon can be clicked/tapped by the user.

Note: If you set this property to true, you have to set also the number or unit property.

Default value is false.

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.

getEmphasized

Gets current value of property emphasized.

Indicates if the object number should appear emphasized.

Default value is true.

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no number.

Default value is Off.

getInverted

Gets current value of property inverted.

Determines whether the background color reflects the set state instead of the control's text.

Default value is false.

sap.m.ObjectNumber.getMetadata

Returns a metadata object for class sap.m.ObjectNumber.

getNumber

Gets current value of property number.

Defines the number field.

getNumberUnit

Gets current value of property numberUnit.

Defines the number units qualifier.

Since 1.16.1 replaced by <code>unit</code> property
getState

Gets current value of property state.

Determines the object number's value state. Setting this state will cause the number to be rendered in state-specific colors.

Default value is None.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the number and unit.

Default value is Begin.

getTextDirection

Gets current value of property textDirection.

Available options for the number and unit 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.

getUnit

Gets current value of property unit.

Defines the number units qualifier. If numberUnit and unit are both set, the unit value is used.

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.

setActive

Sets a new value for property active.

Indicates if the ObjectNumber text and icon can be clicked/tapped by the user.

Note: If you set this property to true, you have to set also the number or unit property.

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

Default value is false.

setEmphasized

Sets a new value for property emphasized.

Indicates if the object number should appear emphasized.

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

Default value is true.

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no number.

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

Default value is Off.

setInverted

Sets a new value for property inverted.

Determines whether the background color reflects the set state instead of the control's text.

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

Default value is false.

setNumber

Sets a new value for property number.

Defines the number field.

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

setNumberUnit

Sets a new value for property numberUnit.

Defines the number units qualifier.

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

Since 1.16.1 replaced by <code>unit</code> property
setState

Sets a new value for property state.

Determines the object number's value state. Setting this state will cause the number to be rendered in state-specific colors.

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

Default value is None.

setTextAlign

Sets a new value for property textAlign.

Sets the horizontal alignment of the number and unit.

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

Default value is Begin.

setTextDirection

Sets a new value for property textDirection.

Available options for the number and unit 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.

setUnit

Sets a new value for property unit.

Defines the number units qualifier. If numberUnit and unit are both set, the unit value is used.

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

addAriaDescribedBy

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

addAriaLabelledBy

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

attachPress

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

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.ObjectNumber itself.

Fires when the user clicks/taps on active Object Number.

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 sap.m.ObjectNumber itself

detachPress

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

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

sap.m.ObjectNumber.extend

Creates a new subclass of class sap.m.ObjectNumber 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

firePress

Fires event press to attached listeners.

Param Type DefaultValue Description
mParameters object

Parameters to pass along with the event

getAccessibilityInfo

References:

getActive

Gets current value of property active.

Indicates if the ObjectNumber text and icon can be clicked/tapped by the user.

Note: If you set this property to true, you have to set also the number or unit property.

Default value is false.

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.

getEmphasized

Gets current value of property emphasized.

Indicates if the object number should appear emphasized.

Default value is true.

getEmptyIndicatorMode

Gets current value of property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no number.

Default value is Off.

getInverted

Gets current value of property inverted.

Determines whether the background color reflects the set state instead of the control's text.

Default value is false.

sap.m.ObjectNumber.getMetadata

Returns a metadata object for class sap.m.ObjectNumber.

getNumber

Gets current value of property number.

Defines the number field.

getNumberUnit

Gets current value of property numberUnit.

Defines the number units qualifier.

Since 1.16.1 replaced by <code>unit</code> property

getState

Gets current value of property state.

Determines the object number's value state. Setting this state will cause the number to be rendered in state-specific colors.

Default value is None.

getTextAlign

Gets current value of property textAlign.

Sets the horizontal alignment of the number and unit.

Default value is Begin.

getTextDirection

Gets current value of property textDirection.

Available options for the number and unit 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.

getUnit

Gets current value of property unit.

Defines the number units qualifier. If numberUnit and unit are both set, the unit value is used.

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.

Param Type DefaultValue Description
vAriaDescribedBy int sap.ui.core.ID sap.ui.core.Control

The ariaDescribedBy to be removed or its index or ID

removeAriaLabelledBy

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

setActive

Sets a new value for property active.

Indicates if the ObjectNumber text and icon can be clicked/tapped by the user.

Note: If you set this property to true, you have to set also the number or unit property.

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

Default value is false.

Param Type DefaultValue Description
bActive boolean false

New value for property active

setEmphasized

Sets a new value for property emphasized.

Indicates if the object number should appear emphasized.

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
bEmphasized boolean true

New value for property emphasized

setEmptyIndicatorMode

Sets a new value for property emptyIndicatorMode.

Specifies if an empty indicator should be displayed when there is no number.

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

Default value is Off.

Param Type DefaultValue Description
sEmptyIndicatorMode sap.m.EmptyIndicatorMode Off

New value for property emptyIndicatorMode

setInverted

Sets a new value for property inverted.

Determines whether the background color reflects the set state instead of the control's text.

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

Default value is false.

Param Type DefaultValue Description
bInverted boolean false

New value for property inverted

setNumber

Sets a new value for property number.

Defines the number field.

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

Param Type DefaultValue Description
sNumber string

New value for property number

setNumberUnit

Sets a new value for property numberUnit.

Defines the number units qualifier.

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

Since 1.16.1 replaced by <code>unit</code> property
Param Type DefaultValue Description
sNumberUnit string

New value for property numberUnit

setState

Sets a new value for property state.

Determines the object number's value state. Setting this state will cause the number to be rendered in state-specific colors.

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

Default value is None.

Param Type DefaultValue Description
sState sap.ui.core.ValueState None

New value for property state

setTextAlign

Sets a new value for property textAlign.

Sets the horizontal alignment of the number and unit.

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

Default value is Begin.

Param Type DefaultValue Description
sTextAlign sap.ui.core.TextAlign Begin

New value for property textAlign

setTextDirection

Sets a new value for property textDirection.

Available options for the number and unit 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.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setUnit

Sets a new value for property unit.

Defines the number units qualifier. If numberUnit and unit are both set, the unit value is used.

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

Param Type DefaultValue Description
sUnit string

New value for property unit