MessageStrip is a control that enables the embedding of application-related messages in the application.
The message strip displays 4 types of messages, each with a corresponding semantic color and icon: Information, Success, Warning and Error.
Each message can have a close button, so that it can be removed from the UI if needed.
You can use a limited set of formatting tags for the message text by setting enableFormattedText
. The allowed tags are: With version 1.50
To meet the accessibility requirements when using dynamically generated Message Strip you must implement it alongside sap.ui.core.InvisibleMessage
. This will allow screen readers to announce it in real time. We suggest such dynamically generated message strips to be announced as Information Bar, as shown in our “Dynamic Message Strip Generator sample.”
Constructor for a new MessageStrip.
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.m.MessageStrip(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 |
Name | Type | Default Value | Description |
---|---|---|---|
customIcon | sap.ui.core.URI | empty string | Determines a custom icon which is displayed. If none is set, the default icon for this message type is used. Visibility: public |
enableFormattedText | boolean | false | Determines the limited collection of HTML elements passed to the Note: If this property is set to true the string passed to
Since: 1.50.Visibility: public |
showCloseButton | boolean | false | Determines if the message has a close button in the upper right corner. Visibility: public |
showIcon | boolean | false | Determines if an icon is displayed for the message. Visibility: public |
text | string | empty string | Determines the text of the message. Visibility: public |
type | sap.ui.core.MessageType | Information | Determines the type of messages that are displayed in the MessageStrip. Possible values are: Information (default), Success, Warning, Error. If None is passed, the value is set to Information and a warning is displayed in the console. Visibility: public |
Default Aggregation: link
Name | Cardinality | Type | Description |
---|---|---|---|
_closeButton | 0..1 | sap.m.Button |
Hidden aggregation which is used to create the close button with sap.m.Button control. |
_formattedText | 0..1 | sap.m.FormattedText |
Hidden aggregation which is used to transform the string message into sap.m.Text control. |
_text | 0..1 | sap.m.Text |
Hidden aggregation which is used to transform the string message into sap.m.Text control. |
link (default) | 0..1 | sap.m.Link |
Adds an sap.m.Link control which will be displayed at the end of the message. |
Method | Description |
---|---|
attachClose |
Attaches event handler When called, the context of the event handler (its This event will be fired after the container is closed. |
close |
Closes the MessageStrip. This method sets the visible property of the MessageStrip to false. The MessageStrip can be shown again by setting the visible property to true. |
destroyLink |
Destroys the link in the aggregation link. |
detachClose |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.m.MessageStrip.extend |
Creates a new subclass of class sap.m.MessageStrip with name
|
fireClose |
Fires event close to attached listeners. |
getCustomIcon |
Gets current value of property customIcon. Determines a custom icon which is displayed. If none is set, the default icon for this message type is used. Default value is |
getEnableFormattedText |
Gets current value of property enableFormattedText. Determines the limited collection of HTML elements passed to the Note: If this property is set to true the string passed to
Default value is |
getLink |
Gets content of aggregation link. Adds an sap.m.Link control which will be displayed at the end of the message. |
sap.m.MessageStrip.getMetadata |
Returns a metadata object for class sap.m.MessageStrip. |
getShowCloseButton |
Gets current value of property showCloseButton. Determines if the message has a close button in the upper right corner. Default value is |
getShowIcon |
Gets current value of property showIcon. Determines if an icon is displayed for the message. Default value is |
getText |
Gets current value of property text. Determines the text of the message. Default value is |
getType |
Gets current value of property type. Determines the type of messages that are displayed in the MessageStrip. Possible values are: Information (default), Success, Warning, Error. If None is passed, the value is set to Information and a warning is displayed in the console. Default value is |
setCustomIcon |
Sets a new value for property customIcon. Determines a custom icon which is displayed. If none is set, the default icon for this message type is used. When called with a value of Default value is |
setEnableFormattedText |
Sets a new value for property enableFormattedText. Determines the limited collection of HTML elements passed to the Note: If this property is set to true the string passed to
When called with a value of Default value is |
setLink |
Sets the aggregated link. |
setShowCloseButton |
Sets a new value for property showCloseButton. Determines if the message has a close button in the upper right corner. When called with a value of Default value is |
setShowIcon |
Sets a new value for property showIcon. Determines if an icon is displayed for the message. When called with a value of Default value is |
setText |
Setter for property text. Default value is empty/undefined |
setType |
Sets a new value for property type. Determines the type of messages that are displayed in the MessageStrip. Possible values are: Information (default), Success, Warning, Error. If None is passed, the value is set to Information and a warning is displayed in the console. When called with a value of Default value is |
Attaches event handler fnFunction
to the close event of this sap.m.MessageStrip
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.MessageStrip
itself.
This event will be fired after the container is closed.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Closes the MessageStrip. This method sets the visible property of the MessageStrip to false. The MessageStrip can be shown again by setting the visible property to true.
Detaches event handler fnFunction
from the close event of this sap.m.MessageStrip
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.m.MessageStrip 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 |
Fires event close to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
Gets current value of property customIcon.
Determines a custom icon which is displayed. If none is set, the default icon for this message type is used.
Default value is empty string
.
Gets current value of property enableFormattedText.
Determines the limited collection of HTML elements passed to the text
property should be evaluated.
Note: If this property is set to true the string passed to text
property can evaluate the following list of limited HTML elements. All other HTML elements and their nested content will not be rendered by the control:
a
br
em
strong
u
Default value is false
.
Gets content of aggregation link.
Adds an sap.m.Link control which will be displayed at the end of the message.
Gets current value of property showCloseButton.
Determines if the message has a close button in the upper right corner.
Default value is false
.
Gets current value of property showIcon.
Determines if an icon is displayed for the message.
Default value is false
.
Gets current value of property text.
Determines the text of the message.
Default value is empty string
.
Gets current value of property type.
Determines the type of messages that are displayed in the MessageStrip. Possible values are: Information (default), Success, Warning, Error. If None is passed, the value is set to Information and a warning is displayed in the console.
Default value is Information
.
Sets a new value for property customIcon.
Determines a custom icon which is displayed. If none is set, the default icon for this message type is used.
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 |
---|---|---|---|
sCustomIcon | sap.ui.core.URI | "" |
New value for property |
Sets a new value for property enableFormattedText.
Determines the limited collection of HTML elements passed to the text
property should be evaluated.
Note: If this property is set to true the string passed to text
property can evaluate the following list of limited HTML elements. All other HTML elements and their nested content will not be rendered by the control:
a
br
em
strong
u
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bEnableFormattedText | boolean | false |
New value for property |
Sets the aggregated link.
Param | Type | DefaultValue | Description |
---|---|---|---|
oLink | sap.m.Link |
The link to set |
Sets a new value for property showCloseButton.
Determines if the message has a close button in the upper right corner.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowCloseButton | boolean | false |
New value for property |
Sets a new value for property showIcon.
Determines if an icon is displayed for the message.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowIcon | boolean | false |
New value for property |
Setter for property text. Default value is empty/undefined
Param | Type | DefaultValue | Description |
---|---|---|---|
sText | string |
new value for property text |
Sets a new value for property type.
Determines the type of messages that are displayed in the MessageStrip. Possible values are: Information (default), Success, Warning, Error. If None is passed, the value is set to Information and a warning is displayed in the console.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Information
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sType | sap.ui.core.MessageType | Information |
New value for property |