Abstract base class for menu item which provides common properties and events for all concrete item implementations.
Abstract base class MenuItemBase
for menu item elements. Please use concrete subclasses.
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.unified.MenuItemBase(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 |
---|---|---|---|
enabled | boolean | true | When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled). Visibility: public |
startsSection | boolean | false | Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown. Visibility: public |
visible | boolean | true | Invisible items do not appear in the menu. Visibility: public |
Default Aggregation: submenu
Name | Cardinality | Type | Description |
---|---|---|---|
submenu (default) | 0..1 | sap.ui.unified.Menu |
An optional submenu of the item which is opened when the item is selected by the user. |
Event | Description |
---|---|
select |
Fired when the item is selected by the user. Note: The event is also available for items which have a submenu. In general, applications must not handle event in this case because the user selection opens the sub menu. |
Fired when the item is selected by the user. Note: The event is also available for items which have a submenu. In general, applications must not handle event in this case because the user selection opens the sub menu.
Param | Type | Description |
---|---|---|
oControlEvent | sap.ui.base.Event | |
getSource | sap.ui.base.EventProvider | |
getParameters | object | |
item | sap.ui.unified.MenuItemBase |
The current item |
Method | Description |
---|---|
attachSelect |
Attaches event handler When called, the context of the event handler (its Fired when the item is selected by the user. Note: The event is also available for items which have a submenu. In general, applications must not handle event in this case because the user selection opens the sub menu. |
destroySubmenu |
Destroys the submenu in the aggregation submenu. |
detachSelect |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.ui.unified.MenuItemBase.extend |
Creates a new subclass of class sap.ui.unified.MenuItemBase with name
|
fireSelect |
Fires event select to attached listeners. |
getEnabled |
Gets current value of property enabled. When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled). Default value is |
sap.ui.unified.MenuItemBase.getMetadata |
Returns a metadata object for class sap.ui.unified.MenuItemBase. |
getStartsSection |
Gets current value of property startsSection. Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown. Default value is |
getSubmenu |
Gets content of aggregation submenu. An optional submenu of the item which is opened when the item is selected by the user. |
getVisible |
Gets current value of property visible. Invisible items do not appear in the menu. Default value is |
hover |
Changes the visual hover state of the menu item. Subclasses may override this function. |
onAfterRendering |
Informs the item that the item HTML is now applied to the DOM. Subclasses may override this function. |
onSubmenuToggle |
Event handler which is called whenever the submenu of the item is opened or closed. Subclasses may override this function. |
render |
Produces the HTML of an item and writes it to render-output-buffer during the rendering of the corresponding menu. Subclasses may override this function. |
setEnabled |
Sets a new value for property enabled. When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled). When called with a value of Default value is |
setStartsSection |
Sets a new value for property startsSection. Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown. When called with a value of Default value is |
setSubmenu |
Sets the aggregated submenu. |
setVisible |
Sets a new value for property visible. Invisible items do not appear in the menu. When called with a value of Default value is |
Attaches event handler fnFunction
to the select event of this sap.ui.unified.MenuItemBase
.
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.ui.unified.MenuItemBase
itself.
Fired when the item is selected by the user. Note: The event is also available for items which have a submenu. In general, applications must not handle event in this case because the user selection opens the sub menu.
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 |
Detaches event handler fnFunction
from the select event of this sap.ui.unified.MenuItemBase
.
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.ui.unified.MenuItemBase 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.Element.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 select to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
item | sap.ui.unified.MenuItemBase |
The current item |
Gets current value of property enabled.
When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled).
Default value is true
.
Returns a metadata object for class sap.ui.unified.MenuItemBase.
Gets current value of property startsSection.
Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown.
Default value is false
.
Gets current value of property visible.
Invisible items do not appear in the menu.
Default value is true
.
Changes the visual hover state of the menu item.
Subclasses may override this function.
Param | Type | DefaultValue | Description |
---|---|---|---|
bHovered | boolean |
Specifies whether the item is currently hovered or not. |
|
oMenu | sap.ui.unified.Menu |
The menu to which this item belongs |
Informs the item that the item HTML is now applied to the DOM.
Subclasses may override this function.
Produces the HTML of an item and writes it to render-output-buffer during the rendering of the corresponding menu.
Subclasses may override this function.
Param | Type | DefaultValue | Description |
---|---|---|---|
oRenderManager | sap.ui.core.RenderManager |
The |
|
oItem | sap.ui.unified.MenuItemBase |
The item which should be rendered |
|
oMenu | sap.ui.unified.Menu |
The menu to which this item belongs |
Sets a new value for property enabled.
When an item is disabled the item can not be selected by the user. The enabled property of the item has no effect when the menu of the item is disabled (Menu#getEnabled).
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 |
---|---|---|---|
bEnabled | boolean | true |
New value for property |
Sets a new value for property startsSection.
Defines whether a visual separator should be rendered before the item. Note: If an item is invisible also the separator of this item is not shown.
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 |
---|---|---|---|
bStartsSection | boolean | false |
New value for property |
Sets a new value for property visible.
Invisible items do not appear in the menu.
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 |
---|---|---|---|
bVisible | boolean | true |
New value for property |