class sap.ui.commons.Toolbar

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

A horizontal row of items where in many cases the single toolbar items are buttons containing icons. Note that all controls with the sap.ui.commons.ToolbarItem interface can be used as item: Button, ComboBox, TextField.


Constructor

Constructor for a new Toolbar.

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.Toolbar(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
design sap.ui.commons.ToolbarDesign Flat

Design settings are theme-dependent.

Visibility: public
standalone boolean true

Per default, tool bars have the stand alone status. Alternatively, they can be nested in other controls and then inherit the design from their parent control.

Visibility: public
width sap.ui.core.CSSSize auto

When there is not enough space for the toolbar to display all items, the rightmost items are overflowing into a drop-down menu.

Visibility: public

Aggregations

Default Aggregation: items

Name Cardinality Type Description
items (default) 0..n sap.ui.commons.ToolbarItem

Aggregating the tool bar items.

rightItems 0..n sap.ui.commons.ToolbarItem

Aggregating the right side tool bar items.


Methods Overview

Method Description
addItem

Adds some item to the aggregation items.

addRightItem

Adds some rightItem to the aggregation rightItems.

destroyItems

Destroys all the items in the aggregation items.

destroyRightItems

Destroys all the rightItems in the aggregation rightItems.

sap.ui.commons.Toolbar.extend

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

getDesign

Gets current value of property design.

Design settings are theme-dependent.

Default value is Flat.

getItems

Gets content of aggregation items.

Aggregating the tool bar items.

sap.ui.commons.Toolbar.getMetadata

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

getRightItems

Gets content of aggregation rightItems.

Aggregating the right side tool bar items.

getStandalone

Gets current value of property standalone.

Per default, tool bars have the stand alone status. Alternatively, they can be nested in other controls and then inherit the design from their parent control.

Default value is true.

getWidth

Gets current value of property width.

When there is not enough space for the toolbar to display all items, the rightmost items are overflowing into a drop-down menu.

Default value is 'auto'.

indexOfItem

Checks for the provided sap.ui.commons.ToolbarItem in the aggregation items. and returns its index if found or -1 otherwise.

indexOfRightItem

Checks for the provided sap.ui.commons.ToolbarItem in the aggregation rightItems. and returns its index if found or -1 otherwise.

insertItem

Inserts a item into the aggregation items.

insertRightItem

Inserts a rightItem into the aggregation rightItems.

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeAllRightItems

Removes all the controls from the aggregation rightItems.

Additionally, it unregisters them from the hosting UIArea.

removeItem

Removes a item from the aggregation items.

removeRightItem

Removes a rightItem from the aggregation rightItems.

setDesign

Sets a new value for property design.

Design settings are theme-dependent.

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

Default value is Flat.

setStandalone

Sets a new value for property standalone.

Per default, tool bars have the stand alone status. Alternatively, they can be nested in other controls and then inherit the design from their parent control.

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

Default value is true.

setWidth

Sets a new value for property width.

When there is not enough space for the toolbar to display all items, the rightmost items are overflowing into a drop-down menu.

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

Default value is 'auto'.

addItem

Adds some item to the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.commons.ToolbarItem

The item to add; if empty, nothing is inserted

addRightItem

Adds some rightItem to the aggregation rightItems.

Param Type DefaultValue Description
oRightItem sap.ui.commons.ToolbarItem

The rightItem to add; if empty, nothing is inserted

destroyItems

Destroys all the items in the aggregation items.

destroyRightItems

Destroys all the rightItems in the aggregation rightItems.

sap.ui.commons.Toolbar.extend

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

getDesign

Gets current value of property design.

Design settings are theme-dependent.

Default value is Flat.

getItems

Gets content of aggregation items.

Aggregating the tool bar items.

sap.ui.commons.Toolbar.getMetadata

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

getRightItems

Gets content of aggregation rightItems.

Aggregating the right side tool bar items.

getStandalone

Gets current value of property standalone.

Per default, tool bars have the stand alone status. Alternatively, they can be nested in other controls and then inherit the design from their parent control.

Default value is true.

getWidth

Gets current value of property width.

When there is not enough space for the toolbar to display all items, the rightmost items are overflowing into a drop-down menu.

Default value is 'auto'.

indexOfItem

Checks for the provided sap.ui.commons.ToolbarItem in the aggregation items. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oItem sap.ui.commons.ToolbarItem

The item whose index is looked for

indexOfRightItem

Checks for the provided sap.ui.commons.ToolbarItem in the aggregation rightItems. and returns its index if found or -1 otherwise.

Param Type DefaultValue Description
oRightItem sap.ui.commons.ToolbarItem

The rightItem whose index is looked for

insertItem

Inserts a item into the aggregation items.

Param Type DefaultValue Description
oItem sap.ui.commons.ToolbarItem

The item to insert; if empty, nothing is inserted

iIndex int

The 0-based index the item should be inserted at; for a negative value of iIndex, the item is inserted at position 0; for a value greater than the current size of the aggregation, the item is inserted at the last position

insertRightItem

Inserts a rightItem into the aggregation rightItems.

Param Type DefaultValue Description
oRightItem sap.ui.commons.ToolbarItem

The rightItem to insert; if empty, nothing is inserted

iIndex int

The 0-based index the rightItem should be inserted at; for a negative value of iIndex, the rightItem is inserted at position 0; for a value greater than the current size of the aggregation, the rightItem is inserted at the last position

removeAllItems

Removes all the controls from the aggregation items.

Additionally, it unregisters them from the hosting UIArea.

removeAllRightItems

Removes all the controls from the aggregation rightItems.

Additionally, it unregisters them from the hosting UIArea.

removeItem

Removes a item from the aggregation items.

Param Type DefaultValue Description
vItem int string sap.ui.commons.ToolbarItem

The item to remove or its index or id

removeRightItem

Removes a rightItem from the aggregation rightItems.

Param Type DefaultValue Description
vRightItem int string sap.ui.commons.ToolbarItem

The rightItem to remove or its index or id

setDesign

Sets a new value for property design.

Design settings are theme-dependent.

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

Default value is Flat.

Param Type DefaultValue Description
sDesign sap.ui.commons.ToolbarDesign Flat

New value for property design

setStandalone

Sets a new value for property standalone.

Per default, tool bars have the stand alone status. Alternatively, they can be nested in other controls and then inherit the design from their parent control.

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

Default value is true.

Param Type DefaultValue Description
bStandalone boolean true

New value for property standalone

setWidth

Sets a new value for property width.

When there is not enough space for the toolbar to display all items, the rightmost items are overflowing into a drop-down menu.

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

Default value is 'auto'.

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize 'auto'

New value for property width