Class sap.m.BarModule: sap/m/Bar

extends Control
implements IBar

The Bar control can be used as a header, sub-header and a footer in a page. It has the capability to center a content like a title, while having other controls on the left and right side.
Constructor Summary
new sap.m.Bar(sId?, mSettings?)Constructor for a new Bar.
Field Summary
_applyContextClassForSets classes according to the context of the page.
_applyTagSets HTML tag according to the context of the page.
applyTagAndContextClassForSets classes and HTML tag according to the context of the page.
getContextGets the available Bar contexts.
getHTMLTagGets the HTML tag of the root element.
isContextSensitiveDetermines whether the Bar is sensitive to the container context.
setHTMLTagSets the HTML tag of the root element.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.Bar.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.Bar with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.Bar.getMetadata()Returns a metadata object for class sap.m.Bar.
addAriaLabelledBy(vAriaLabelledBy)Adds some ariaLabelledBy into the association ariaLabelledBy.
addContentLeft(oContentLeft)Adds some contentLeft to the aggregation contentLeft.
addContentMiddle(oContentMiddle)Adds some contentMiddle to the aggregation contentMiddle.
addContentRight(oContentRight)Adds some contentRight to the aggregation contentRight.
destroyContentLeft()Destroys all the contentLeft in the aggregation contentLeft.
destroyContentMiddle()Destroys all the contentMiddle in the aggregation contentMiddle.
destroyContentRight()Destroys all the contentRight in the aggregation contentRight.
getAriaLabelledBy()Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
getContentLeft()Gets content of aggregation contentLeft.
getContentMiddle()Gets content of aggregation contentMiddle.
getContentRight()Gets content of aggregation contentRight.
getDesign()Gets current value of property design.
indexOfContentLeft(oContentLeft)Checks for the provided sap.ui.core.Control in the aggregation contentLeft.
indexOfContentMiddle(oContentMiddle)Checks for the provided sap.ui.core.Control in the aggregation contentMiddle.
indexOfContentRight(oContentRight)Checks for the provided sap.ui.core.Control in the aggregation contentRight.
insertContentLeft(oContentLeft, iIndex)Inserts a contentLeft into the aggregation contentLeft.
insertContentMiddle(oContentMiddle, iIndex)Inserts a contentMiddle into the aggregation contentMiddle.
insertContentRight(oContentRight, iIndex)Inserts a contentRight into the aggregation contentRight.
removeAllAriaLabelledBy()Removes all the controls in the association named ariaLabelledBy.
removeAllContentLeft()Removes all the controls from the aggregation contentLeft.
removeAllContentMiddle()Removes all the controls from the aggregation contentMiddle.
removeAllContentRight()Removes all the controls from the aggregation contentRight.
removeAriaLabelledBy(vAriaLabelledBy)Removes an ariaLabelledBy from the association named ariaLabelledBy.
removeContentLeft(vContentLeft)Removes a contentLeft from the aggregation contentLeft.
removeContentMiddle(vContentMiddle)Removes a contentMiddle from the aggregation contentMiddle.
removeContentRight(vContentRight)Removes a contentRight from the aggregation contentRight.
setDesign(sDesign)Sets a new value for property design.
getEnableFlexBox()Gets current value of property enableFlexBox.
getTranslucent()Gets current value of property translucent.
setEnableFlexBox(bEnableFlexBox)Sets a new value for property enableFlexBox.
setTranslucent(bTranslucent)Sets a new value for property translucent.
Constructor Detail
new sap.m.Bar(sId?, mSettings?)

Constructor for a new Bar.

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:
stringsId?ID for the new control, generated automatically if no ID is given
objectmSettings?Initial settings for the new control
Field Detail
_applyContextClassFor
Sets classes according to the context of the page. Possible contexts are header, footer and subheader.
_applyTag
Sets HTML tag according to the context of the page. Possible contexts are header, footer and subheader.
applyTagAndContextClassFor
Sets classes and HTML tag according to the context of the page. Possible contexts are header, footer and subheader.
getContext
Gets the available Bar contexts.
getHTMLTag
Gets the HTML tag of the root element.
isContextSensitive

Determines whether the Bar is sensitive to the container context.

Implementation of the IBar interface.

setHTMLTag
Sets the HTML tag of the root element.
Method Detail
sap.m.Bar.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.m.Bar 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.Bar.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.Bar.
Returns:
sap.ui.base.MetadataMetadata object describing this class
addAriaLabelledBy(vAriaLabelledBy): sap.m.Bar
Adds some ariaLabelledBy into the association ariaLabelledBy.
Parameters:
sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledBythe ariaLabelledBy to add; if empty, nothing is inserted
Returns:
sap.m.BarReference to this in order to allow method chaining
addContentLeft(oContentLeft): sap.m.Bar
Adds some contentLeft to the aggregation contentLeft.
Parameters:
sap.ui.core.ControloContentLeftthe contentLeft to add; if empty, nothing is inserted
Returns:
sap.m.BarReference to this in order to allow method chaining
addContentMiddle(oContentMiddle): sap.m.Bar
Adds some contentMiddle to the aggregation contentMiddle.
Parameters:
sap.ui.core.ControloContentMiddlethe contentMiddle to add; if empty, nothing is inserted
Returns:
sap.m.BarReference to this in order to allow method chaining
addContentRight(oContentRight): sap.m.Bar
Adds some contentRight to the aggregation contentRight.
Parameters:
sap.ui.core.ControloContentRightthe contentRight to add; if empty, nothing is inserted
Returns:
sap.m.BarReference to this in order to allow method chaining
destroyContentLeft(): sap.m.Bar
Destroys all the contentLeft in the aggregation contentLeft.
Returns:
sap.m.BarReference to this in order to allow method chaining
destroyContentMiddle(): sap.m.Bar
Destroys all the contentMiddle in the aggregation contentMiddle.
Returns:
sap.m.BarReference to this in order to allow method chaining
destroyContentRight(): sap.m.Bar
Destroys all the contentRight in the aggregation contentRight.
Returns:
sap.m.BarReference to this in order to allow method chaining
getAriaLabelledBy(): sap.ui.core.ID[]
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Returns:
sap.ui.core.ID[]
getContentLeft(): sap.ui.core.Control[]

Gets content of aggregation contentLeft.

Represents the left content area, usually containing a button or an app icon. If it is overlapped by the right content, its content will disappear and the text will show an ellipsis.

Returns:
sap.ui.core.Control[]
getContentMiddle(): sap.ui.core.Control[]

Gets content of aggregation contentMiddle.

Represents the middle content area. Controls such as label, segmented buttons or select can be placed here. The content is centrally positioned if there is enough space. If the right or left content overlaps the middle content, the middle content will be centered in the space between the left and the right content.

Returns:
sap.ui.core.Control[]
getContentRight(): sap.ui.core.Control[]

Gets content of aggregation contentRight.

Represents the right content area. Controls such as action buttons or search field can be placed here.

Returns:
sap.ui.core.Control[]
getDesign(): sap.m.BarDesign

Gets current value of property design.

Determines the design of the bar. If set to auto, it becomes dependent on the place where the bar is placed.

Default value is Auto.

Returns:
sap.m.BarDesignValue of property design
Since:
1.22
indexOfContentLeft(oContentLeft): int
Checks for the provided sap.ui.core.Control in the aggregation contentLeft. and returns its index if found or -1 otherwise.
Parameters:
sap.ui.core.ControloContentLeftThe contentLeft whose index is looked for
Returns:
intThe index of the provided control in the aggregation if found, or -1 otherwise
indexOfContentMiddle(oContentMiddle): int
Checks for the provided sap.ui.core.Control in the aggregation contentMiddle. and returns its index if found or -1 otherwise.
Parameters:
sap.ui.core.ControloContentMiddleThe contentMiddle whose index is looked for
Returns:
intThe index of the provided control in the aggregation if found, or -1 otherwise
indexOfContentRight(oContentRight): int
Checks for the provided sap.ui.core.Control in the aggregation contentRight. and returns its index if found or -1 otherwise.
Parameters:
sap.ui.core.ControloContentRightThe contentRight whose index is looked for
Returns:
intThe index of the provided control in the aggregation if found, or -1 otherwise
insertContentLeft(oContentLeft, iIndex): sap.m.Bar
Inserts a contentLeft into the aggregation contentLeft.
Parameters:
sap.ui.core.ControloContentLeftthe contentLeft to insert; if empty, nothing is inserted
intiIndexthe 0-based index the contentLeft should be inserted at; for a negative value of iIndex, the contentLeft is inserted at position 0; for a value greater than the current size of the aggregation, the contentLeft is inserted at the last position
Returns:
sap.m.BarReference to this in order to allow method chaining
insertContentMiddle(oContentMiddle, iIndex): sap.m.Bar
Inserts a contentMiddle into the aggregation contentMiddle.
Parameters:
sap.ui.core.ControloContentMiddlethe contentMiddle to insert; if empty, nothing is inserted
intiIndexthe 0-based index the contentMiddle should be inserted at; for a negative value of iIndex, the contentMiddle is inserted at position 0; for a value greater than the current size of the aggregation, the contentMiddle is inserted at the last position
Returns:
sap.m.BarReference to this in order to allow method chaining
insertContentRight(oContentRight, iIndex): sap.m.Bar
Inserts a contentRight into the aggregation contentRight.
Parameters:
sap.ui.core.ControloContentRightthe contentRight to insert; if empty, nothing is inserted
intiIndexthe 0-based index the contentRight should be inserted at; for a negative value of iIndex, the contentRight is inserted at position 0; for a value greater than the current size of the aggregation, the contentRight is inserted at the last position
Returns:
sap.m.BarReference to this in order to allow method chaining
removeAllAriaLabelledBy(): sap.ui.core.ID[]
Removes all the controls in the association named ariaLabelledBy.
Returns:
sap.ui.core.ID[]An array of the removed elements (might be empty)
removeAllContentLeft(): sap.ui.core.Control[]

Removes all the controls from the aggregation contentLeft.

Additionally, it unregisters them from the hosting UIArea.

Returns:
sap.ui.core.Control[]An array of the removed elements (might be empty)
removeAllContentMiddle(): sap.ui.core.Control[]

Removes all the controls from the aggregation contentMiddle.

Additionally, it unregisters them from the hosting UIArea.

Returns:
sap.ui.core.Control[]An array of the removed elements (might be empty)
removeAllContentRight(): sap.ui.core.Control[]

Removes all the controls from the aggregation contentRight.

Additionally, it unregisters them from the hosting UIArea.

Returns:
sap.ui.core.Control[]An array of the removed elements (might be empty)
removeAriaLabelledBy(vAriaLabelledBy): sap.ui.core.ID
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Parameters:
int|sap.ui.core.ID|sap.ui.core.ControlvAriaLabelledByThe ariaLabelledBy to be removed or its index or ID
Returns:
sap.ui.core.IDThe removed ariaLabelledBy or null
removeContentLeft(vContentLeft): sap.ui.core.Control
Removes a contentLeft from the aggregation contentLeft.
Parameters:
int|string|sap.ui.core.ControlvContentLeftThe contentLeft to remove or its index or id
Returns:
sap.ui.core.ControlThe removed contentLeft or null
removeContentMiddle(vContentMiddle): sap.ui.core.Control
Removes a contentMiddle from the aggregation contentMiddle.
Parameters:
int|string|sap.ui.core.ControlvContentMiddleThe contentMiddle to remove or its index or id
Returns:
sap.ui.core.ControlThe removed contentMiddle or null
removeContentRight(vContentRight): sap.ui.core.Control
Removes a contentRight from the aggregation contentRight.
Parameters:
int|string|sap.ui.core.ControlvContentRightThe contentRight to remove or its index or id
Returns:
sap.ui.core.ControlThe removed contentRight or null
setDesign(sDesign): sap.m.Bar

Sets a new value for property design.

Determines the design of the bar. If set to auto, it becomes dependent on the place where the bar is placed.

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

Default value is Auto.

Parameters:
sap.m.BarDesignsDesignNew value for property design
Returns:
sap.m.BarReference to this in order to allow method chaining
Since:
1.22
getEnableFlexBox(): boolean

Gets current value of property enableFlexBox.

If this flag is set to true, contentMiddle will be rendered as a HBox and layoutData can be used to allocate available space.

Default value is false.

Returns:
booleanValue of property enableFlexBox
Deprecated API:
Since version 1.16. This property is no longer supported, instead, contentMiddle will always occupy 100% width when no contentLeft and contentRight are being set.
getTranslucent(): boolean

Gets current value of property translucent.

Indicates whether the Bar is partially translucent. It is only applied for touch devices.

Default value is false.

Returns:
booleanValue of property translucent
Deprecated API:
Since version 1.18.6. This property has no effect since release 1.18.6 and should not be used. Translucent bar may overlay an input and make it difficult to edit.
Since:
1.12
setEnableFlexBox(bEnableFlexBox): sap.m.Bar

Sets a new value for property enableFlexBox.

If this flag is set to true, contentMiddle will be rendered as a HBox and layoutData can be used to allocate available space.

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

Default value is false.

Parameters:
booleanbEnableFlexBoxNew value for property enableFlexBox
Returns:
sap.m.BarReference to this in order to allow method chaining
Deprecated API:
Since version 1.16. This property is no longer supported, instead, contentMiddle will always occupy 100% width when no contentLeft and contentRight are being set.
setTranslucent(bTranslucent): sap.m.Bar

Sets a new value for property translucent.

Indicates whether the Bar is partially translucent. It is only applied for touch devices.

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

Default value is false.

Parameters:
booleanbTranslucentNew value for property translucent
Returns:
sap.m.BarReference to this in order to allow method chaining
Deprecated API:
Since version 1.18.6. This property has no effect since release 1.18.6 and should not be used. Translucent bar may overlay an input and make it difficult to edit.
Since:
1.12