Class sap.ui.commons.LabelModule: sap/ui/commons/Label

extends Control
implements Label, ToolbarItem

The control is used for labeling other controls. The API provides formatting options, for example, for bold display or alignment. A label can have an icon.
Deprecated API:
Since version 1.38. Instead, use the sap.m.Label control.
Constructor Summary
new sap.ui.commons.Label(sId?, mSettings?)Constructor for a new Label.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.ui.commons.Label.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.commons.Label with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.commons.Label.getMetadata()Returns a metadata object for class sap.ui.commons.Label.
getDesign()Gets current value of property design.
getIcon()Gets current value of property icon.
getLabelFor()ID of the element which is the current target of the association labelFor, or null.
getRequired()Gets current value of property required.
getRequiredAtBegin()Gets current value of property requiredAtBegin.
getText()Gets current value of property text.
getTextAlign()Gets current value of property textAlign.
getTextDirection()Gets current value of property textDirection.
getWidth()Gets current value of property width.
getWrapping()Gets current value of property wrapping.
setDesign(sDesign)Sets a new value for property design.
setIcon(sIcon)Sets a new value for property icon.
setLabelFor(oLabelFor)Sets the associated labelFor.
setRequired(bRequired)Sets a new value for property required.
setRequiredAtBegin(bRequiredAtBegin)Sets a new value for property requiredAtBegin.
setText(sText)Sets a new value for property text.
setTextAlign(sTextAlign)Sets a new value for property textAlign.
setTextDirection(sTextDirection)Sets a new value for property textDirection.
setWidth(sWidth)Sets a new value for property width.
setWrapping(bWrapping)Sets a new value for property wrapping.
Constructor Detail
new sap.ui.commons.Label(sId?, mSettings?)

Constructor for a new Label.

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

    • labelFor : (sap.ui.core.ID | sap.ui.core.Control)

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
Method Detail
sap.ui.commons.Label.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.ui.commons.Label 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.Label.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.Label.
Returns:
sap.ui.base.MetadataMetadata object describing this class
getAccessibilityInfo()
See:
sap.ui.core.Control#getAccessibilityInfo

Gets current value of property design.

Defines whether the labels are in bold format.

Default value is Standard.

Returns:
sap.ui.commons.LabelDesignValue of property design
getIcon(): sap.ui.core.URI

Gets current value of property icon.

Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI.

Returns:
sap.ui.core.URIValue of property icon
getLabelFor(): sap.ui.core.ID
ID of the element which is the current target of the association labelFor, or null.
Returns:
sap.ui.core.ID
getRequired(): boolean

Gets current value of property required.

Allows to enforce the required indicator even when the associated control doesn't have a getRequired method (a required property) or when the flag is not set. If the associated control has a required property, the values of both required flags are combined with the OR operator, so a Label can't override a required=true value.

Default value is false.

Returns:
booleanValue of property required
Since:
1.11.0
getRequiredAtBegin(): boolean

Gets current value of property requiredAtBegin.

Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set).

Returns:
booleanValue of property requiredAtBegin
Since:
1.14.0
getText(): string

Gets current value of property text.

Determines the text to be displayed.

Default value is .

Returns:
stringValue of property text
getTextAlign(): sap.ui.core.TextAlign

Gets current value of property textAlign.

Determines the alignment of the text. Available options are Begin, Center, End, Left, and Right.

Default value is Begin.

Returns:
sap.ui.core.TextAlignValue of property textAlign
getTextDirection(): sap.ui.core.TextDirection

Gets current value of property textDirection.

Determines the text direction - right-to-left (RTL) and left-to-right (LTR).

Default value is Inherit.

Returns:
sap.ui.core.TextDirectionValue of property textDirection
getWidth(): sap.ui.core.CSSSize

Gets current value of property width.

Determines the control width as common CSS-size (for example, px or % as unit).

Default value is .

Returns:
sap.ui.core.CSSSizeValue of property width
getWrapping(): boolean

Gets current value of property wrapping.

Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is.

Default value is false.

Returns:
booleanValue of property wrapping
setDesign(sDesign): sap.ui.commons.Label

Sets a new value for property design.

Defines whether the labels are in bold format.

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

Default value is Standard.

Parameters:
sap.ui.commons.LabelDesignsDesignNew value for property design
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
setIcon(sIcon): sap.ui.commons.Label

Sets a new value for property icon.

Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI.

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

Parameters:
sap.ui.core.URIsIconNew value for property icon
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
setLabelFor(oLabelFor): sap.ui.commons.Label
Sets the associated labelFor.
Parameters:
sap.ui.core.ID|sap.ui.core.ControloLabelForID of an element which becomes the new target of this labelFor association; alternatively, an element instance may be given
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
setRequired(bRequired): sap.ui.commons.Label

Sets a new value for property required.

Allows to enforce the required indicator even when the associated control doesn't have a getRequired method (a required property) or when the flag is not set. If the associated control has a required property, the values of both required flags are combined with the OR operator, so a Label can't override a required=true value.

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

Default value is false.

Parameters:
booleanbRequiredNew value for property required
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
Since:
1.11.0
setRequiredAtBegin(bRequiredAtBegin): sap.ui.commons.Label

Sets a new value for property requiredAtBegin.

Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set).

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

Parameters:
booleanbRequiredAtBeginNew value for property requiredAtBegin
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
Since:
1.14.0
setText(sText): sap.ui.commons.Label

Sets a new value for property text.

Determines the 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.LabelReference to this in order to allow method chaining
setTextAlign(sTextAlign): sap.ui.commons.Label

Sets a new value for property textAlign.

Determines the alignment of the text. Available options are Begin, Center, End, Left, and Right.

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

Default value is Begin.

Parameters:
sap.ui.core.TextAlignsTextAlignNew value for property textAlign
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
setTextDirection(sTextDirection): sap.ui.commons.Label

Sets a new value for property textDirection.

Determines the text direction - right-to-left (RTL) and left-to-right (LTR).

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.ui.commons.LabelReference to this in order to allow method chaining
setWidth(sWidth): sap.ui.commons.Label

Sets a new value for property width.

Determines the control width as common CSS-size (for example, px or % as unit).

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

Default value is .

Parameters:
sap.ui.core.CSSSizesWidthNew value for property width
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining
setWrapping(bWrapping): sap.ui.commons.Label

Sets a new value for property wrapping.

Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is.

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

Default value is false.

Parameters:
booleanbWrappingNew value for property wrapping
Returns:
sap.ui.commons.LabelReference to this in order to allow method chaining