class sap.ui.commons.MessageBar

Control sample: sap.ui.commons.MessageBar
Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/MessageBar
Application Component: CA-UI5-CTR

Creates an instance of a MessageBar Control, for displaying messages.


Constructor

Constructor for a new MessageBar.

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.ui.commons.MessageBar(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
anchorID string empty string

Element ID upon which the MessageBar will be initially positioned.

Visibility: public
anchorSnapPoint string begin top

Type: sap.ui.core.Popup.Dock SnapPoint of MessageBar over anchorId. Note: Use "begin" or "end" for RTL support. Note: "center" is not indicated, as positioning is only set once, either via the css "left" or the "right" attribute. Therefore a MessageBar will only be extended in one direction, as Messages come in.

Visibility: public
maxListed int 7

Maximum number of messages being displayed in the List before a scrollbar appears. Value '0' means no limit.

Visibility: public
maxToasted int 3

Maximum number of simultaneous messages being toasted in a row. Value '0' means this dynamic part is switched off.

Visibility: public
visible boolean true

Specifies whether or not the MessageBar is visible. Invisible controls are not rendered.

Visibility: public

Methods Overview

Method Description
addMessages

Adds/updates a supplied list of messages. The MessageBar will appear if at least one message exists.

deleteAllMessages

Deletes all messages.

deleteMessages

Deletes a supplied list of messages. The MessageBar will disappear when no message remains.

sap.ui.commons.MessageBar.extend

Creates a new subclass of class sap.ui.commons.MessageBar 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.

getAnchorID

Gets current value of property anchorID.

Element ID upon which the MessageBar will be initially positioned.

Default value is empty string.

getAnchorSnapPoint

Gets current value of property anchorSnapPoint.

Type: sap.ui.core.Popup.Dock SnapPoint of MessageBar over anchorId. Note: Use "begin" or "end" for RTL support. Note: "center" is not indicated, as positioning is only set once, either via the css "left" or the "right" attribute. Therefore a MessageBar will only be extended in one direction, as Messages come in.

Default value is "begin top".

getMaxListed

Gets current value of property maxListed.

Maximum number of messages being displayed in the List before a scrollbar appears. Value '0' means no limit.

Default value is 7.

getMaxToasted

Gets current value of property maxToasted.

Maximum number of simultaneous messages being toasted in a row. Value '0' means this dynamic part is switched off.

Default value is 3.

sap.ui.commons.MessageBar.getMetadata

Returns a metadata object for class sap.ui.commons.MessageBar.

getVisible

Gets current value of property visible.

Specifies whether or not the MessageBar is visible. Invisible controls are not rendered.

Default value is true.

setAnchorID

Sets a new value for property anchorID.

Element ID upon which the MessageBar will be initially positioned.

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

Default value is empty string.

setAnchorSnapPoint

Sets a new value for property anchorSnapPoint.

Type: sap.ui.core.Popup.Dock SnapPoint of MessageBar over anchorId. Note: Use "begin" or "end" for RTL support. Note: "center" is not indicated, as positioning is only set once, either via the css "left" or the "right" attribute. Therefore a MessageBar will only be extended in one direction, as Messages come in.

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

Default value is "begin top".

setMaxListed

Sets a new value for property maxListed.

Maximum number of messages being displayed in the List before a scrollbar appears. Value '0' means no limit.

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

Default value is 7.

setMaxToasted

Sets a new value for property maxToasted.

Maximum number of simultaneous messages being toasted in a row. Value '0' means this dynamic part is switched off.

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

Default value is 3.

setVisible

Setter for property visible.

Default value is true

The default implementation of function setVisible() is enhanced in order to toggle the visibility:hidden; attribute over the control.

addMessages

Adds/updates a supplied list of messages. The MessageBar will appear if at least one message exists.

Param Type DefaultValue Description
aAMessages sap.ui.commons.Message[]

Array of messages.

deleteAllMessages

Deletes all messages.

deleteMessages

Deletes a supplied list of messages. The MessageBar will disappear when no message remains.

Param Type DefaultValue Description
aIds string[]

Messages IDs to be deleted.

sap.ui.commons.MessageBar.extend

Creates a new subclass of class sap.ui.commons.MessageBar 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

getAnchorID

Gets current value of property anchorID.

Element ID upon which the MessageBar will be initially positioned.

Default value is empty string.

getAnchorSnapPoint

Gets current value of property anchorSnapPoint.

Type: sap.ui.core.Popup.Dock SnapPoint of MessageBar over anchorId. Note: Use "begin" or "end" for RTL support. Note: "center" is not indicated, as positioning is only set once, either via the css "left" or the "right" attribute. Therefore a MessageBar will only be extended in one direction, as Messages come in.

Default value is "begin top".

getMaxListed

Gets current value of property maxListed.

Maximum number of messages being displayed in the List before a scrollbar appears. Value '0' means no limit.

Default value is 7.

getMaxToasted

Gets current value of property maxToasted.

Maximum number of simultaneous messages being toasted in a row. Value '0' means this dynamic part is switched off.

Default value is 3.

sap.ui.commons.MessageBar.getMetadata

Returns a metadata object for class sap.ui.commons.MessageBar.

getVisible

Gets current value of property visible.

Specifies whether or not the MessageBar is visible. Invisible controls are not rendered.

Default value is true.

setAnchorID

Sets a new value for property anchorID.

Element ID upon which the MessageBar will be initially positioned.

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

Default value is empty string.

Param Type DefaultValue Description
sAnchorID string ''

New value for property anchorID

setAnchorSnapPoint

Sets a new value for property anchorSnapPoint.

Type: sap.ui.core.Popup.Dock SnapPoint of MessageBar over anchorId. Note: Use "begin" or "end" for RTL support. Note: "center" is not indicated, as positioning is only set once, either via the css "left" or the "right" attribute. Therefore a MessageBar will only be extended in one direction, as Messages come in.

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

Default value is "begin top".

Param Type DefaultValue Description
sAnchorSnapPoint string "begin top"

New value for property anchorSnapPoint

setMaxListed

Sets a new value for property maxListed.

Maximum number of messages being displayed in the List before a scrollbar appears. Value '0' means no limit.

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

Default value is 7.

Param Type DefaultValue Description
iMaxListed int 7

New value for property maxListed

setMaxToasted

Sets a new value for property maxToasted.

Maximum number of simultaneous messages being toasted in a row. Value '0' means this dynamic part is switched off.

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

Default value is 3.

Param Type DefaultValue Description
iMaxToasted int 3

New value for property maxToasted

setVisible

Setter for property visible.

Default value is true

The default implementation of function setVisible() is enhanced in order to toggle the visibility:hidden; attribute over the control.

Param Type DefaultValue Description
bVisible boolean

New value for property visible