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.
isRequired()Checks whether the Label itself or the associated control is marked as required (they are mutually exclusive).
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:

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
Deprecated:
Since version 1.38. Instead, use the sap.m.Label 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:
{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.ui.commons.Label.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.commons.Label.
Returns:
{sap.ui.base.Metadata} Metadata 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.LabelDesign} Value 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 an URI to an image or an icon font URI.

Returns:
{sap.ui.core.URI} Value of property icon
getLabelFor(): sap.ui.core.Control
ID of the element which is the current target of the association labelFor, or null.
Returns:
{sap.ui.core.Control}
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.

Since:
1.11.0
Returns:
{boolean} Value of property required
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).

Since:
1.14.0
Returns:
{boolean} Value of property requiredAtBegin
getText(): string
Gets current value of property text.

Determines the text to be displayed.

Default value is .

Returns:
{string} Value 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.TextAlign} Value 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.TextDirection} Value 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.CSSSize} Value 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:
{boolean} Value of property wrapping
isRequired(): Boolean
Checks whether the Label itself or the associated control is marked as required (they are mutually exclusive).
Returns:
{Boolean} Returns if the Label or the labelled control are required
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.LabelDesign}sDesign New value for property design
Returns:
{sap.ui.commons.Label} Reference 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 an 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.URI}sIcon New value for property icon
Returns:
{sap.ui.commons.Label} Reference to this in order to allow method chaining
setLabelFor(oLabelFor): sap.ui.commons.Label
Sets the associated labelFor.
Parameters:
{sap.ui.core.Control}oLabelFor Id of an element which becomes the new target of this labelFor association; alternatively, an element instance may be given
Returns:
{sap.ui.commons.Label} Reference 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:
{boolean}bRequired New value for property required
Since:
1.11.0
Returns:
{sap.ui.commons.Label} Reference to this in order to allow method chaining
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:
{boolean}bRequiredAtBegin New value for property requiredAtBegin
Since:
1.14.0
Returns:
{sap.ui.commons.Label} Reference to this in order to allow method chaining
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:
{string}sText New value for property text
Returns:
{sap.ui.commons.Label} Reference 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.TextAlign}sTextAlign New value for property textAlign
Returns:
{sap.ui.commons.Label} Reference 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.TextDirection}sTextDirection New value for property textDirection
Returns:
{sap.ui.commons.Label} Reference 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.CSSSize}sWidth New value for property width
Returns:
{sap.ui.commons.Label} Reference 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:
{boolean}bWrapping New value for property wrapping
Returns:
{sap.ui.commons.Label} Reference to this in order to allow method chaining