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
applyTagAndContextClassForSets classes and tag according to the context of the page.
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.
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.
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.
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.
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:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? Initial settings for the new control
Field Detail
applyTagAndContextClassFor
Sets classes and tag according to the context of the page. Possible contexts are header, footer and sub-header.
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:
{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.Bar.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.Bar.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
addContentLeft(oContentLeft): sap.m.Bar
Adds some contentLeft to the aggregation contentLeft.
Parameters:
{sap.ui.core.Control}oContentLeft the contentLeft to add; if empty, nothing is inserted
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
addContentMiddle(oContentMiddle): sap.m.Bar
Adds some contentMiddle to the aggregation contentMiddle.
Parameters:
{sap.ui.core.Control}oContentMiddle the contentMiddle to add; if empty, nothing is inserted
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
addContentRight(oContentRight): sap.m.Bar
Adds some contentRight to the aggregation contentRight.
Parameters:
{sap.ui.core.Control}oContentRight the contentRight to add; if empty, nothing is inserted
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
destroyContentLeft(): sap.m.Bar
Destroys all the contentLeft in the aggregation contentLeft.
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
destroyContentMiddle(): sap.m.Bar
Destroys all the contentMiddle in the aggregation contentMiddle.
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
destroyContentRight(): sap.m.Bar
Destroys all the contentRight in the aggregation contentRight.
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
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.

Since:
1.22
Returns:
{sap.m.BarDesign} Value of property design
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.Control}oContentLeft The contentLeft whose index is looked for
Returns:
{int} The 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.Control}oContentMiddle The contentMiddle whose index is looked for
Returns:
{int} The 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.Control}oContentRight The contentRight whose index is looked for
Returns:
{int} The 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.Control}oContentLeft the contentLeft to insert; if empty, nothing is inserted
{int}iIndex the 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.Bar} Reference 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.Control}oContentMiddle the contentMiddle to insert; if empty, nothing is inserted
{int}iIndex the 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.Bar} Reference 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.Control}oContentRight the contentRight to insert; if empty, nothing is inserted
{int}iIndex the 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.Bar} Reference to this in order to allow method chaining
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)
removeContentLeft(vContentLeft): sap.ui.core.Control
Removes a contentLeft from the aggregation contentLeft.
Parameters:
{int|string|sap.ui.core.Control}vContentLeft The contentLeftto remove or its index or id
Returns:
{sap.ui.core.Control} The removed contentLeft or null
removeContentMiddle(vContentMiddle): sap.ui.core.Control
Removes a contentMiddle from the aggregation contentMiddle.
Parameters:
{int|string|sap.ui.core.Control}vContentMiddle The contentMiddleto remove or its index or id
Returns:
{sap.ui.core.Control} The removed contentMiddle or null
removeContentRight(vContentRight): sap.ui.core.Control
Removes a contentRight from the aggregation contentRight.
Parameters:
{int|string|sap.ui.core.Control}vContentRight The contentRightto remove or its index or id
Returns:
{sap.ui.core.Control} The 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.BarDesign}sDesign New value for property design
Since:
1.22
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
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.

Deprecated:
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.
Returns:
{boolean} Value of property enableFlexBox
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.

Deprecated:
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
Returns:
{boolean} Value of property translucent
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:
{boolean}bEnableFlexBox New value for property enableFlexBox
Deprecated:
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.
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining
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:
{boolean}bTranslucent New value for property translucent
Deprecated:
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
Returns:
{sap.m.Bar} Reference to this in order to allow method chaining