Abstract Class sap.ui.unified.MenuItemBaseModule: sap/ui/unified/MenuItemBase

extends Element
known direct subclasses: MenuItem, MenuItemBase, MenuTextFieldItem

Abstract base class for menu item which provides common properties and events for all concrete item implementations.
Since: 1.21.0.
Constructor Summary
new sap.ui.unified.MenuItemBase(sId?, mSettings?)Abstract base class MenuItemBase for menu item elements.
Event Summary
select(oControlEvent)Fired when the item is selected by the user.
Method Summary
sap.ui.unified.MenuItemBase.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.ui.unified.MenuItemBase with name sClassName and enriches it with the information contained in oClassInfo.
sap.ui.unified.MenuItemBase.getMetadata()Returns a metadata object for class sap.ui.unified.MenuItemBase.
attachSelect(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the select event of this sap.ui.unified.MenuItemBase.
destroySubmenu()Destroys the submenu in the aggregation submenu.
detachSelect(fnFunction, oListener)Detaches event handler fnFunction from the select event of this sap.ui.unified.MenuItemBase.
fireSelect(mParameters?)Fires event select to attached listeners.
getEnabled()Gets current value of property enabled.
getStartsSection()Gets current value of property startsSection.
getSubmenu()Gets content of aggregation submenu.
getVisible()Gets current value of property visible.
hover(bHovered, oMenu)Changes the visual hover state of the menu item.
onAfterRendering()Informs the item that the item HTML is now applied to the DOM.
onSubmenuToggle(bOpened)Event handler which is called whenever the submenu of the item is opened or closed.
render(oRenderManager, oItem, oMenu)Produces the HTML of an item and writes it to render-output-buffer during the rendering of the corresponding menu.
setEnabled(bEnabled)Sets a new value for property enabled.
setStartsSection(bStartsSection)Sets a new value for property startsSection.
setSubmenu(oSubmenu)Sets the aggregated submenu.
setVisible(bVisible)Sets a new value for property visible.
Methods borrowed from class sap.ui.base.Object
Constructor Detail
new sap.ui.unified.MenuItemBase(sId?, mSettings?)

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 for a general description of the syntax of the settings object.

The supported settings are:

  • Properties

  • Aggregations

    • submenu : sap.ui.unified.Menu (default)

  • Events

    • select : fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]

In addition, all settings applicable to the base type sap.ui.core.Element can be used as well.

Parameters:
stringsId?Id for the new control, generated automatically if no id is given
objectmSettings?Initial settings for the new control
Event Detail
select(oControlEvent)
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.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
sap.ui.unified.MenuItemBaseoControlEvent.getParameters.itemThe current item
Method Detail
sap.ui.unified.MenuItemBase.extend(sClassName, oClassInfo?, FNMetaImpl?): function

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.

Parameters:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated class / constructor function
sap.ui.unified.MenuItemBase.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.ui.unified.MenuItemBase.
Returns:
sap.ui.base.MetadataMetadata object describing this class
attachSelect(oData?, fnFunction, oListener?): sap.ui.unified.MenuItemBase

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.

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.ui.unified.MenuItemBase itself
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
destroySubmenu(): sap.ui.unified.MenuItemBase
Destroys the submenu in the aggregation submenu.
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
detachSelect(fnFunction, oListener): sap.ui.unified.MenuItemBase

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.

Parameters:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
fireSelect(mParameters?): sap.ui.unified.MenuItemBase
Fires event select to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
sap.ui.unified.MenuItemBasemParameters.item?The current item
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
getEnabled(): boolean

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:
booleanValue of property enabled
getStartsSection(): boolean

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.

Returns:
booleanValue of property startsSection
getSubmenu(): sap.ui.unified.Menu

Gets content of aggregation submenu.

An optional submenu of the item which is opened when the item is selected by the user.

Returns:
sap.ui.unified.Menu
getVisible(): boolean

Gets current value of property visible.

Invisible items do not appear in the menu.

Default value is true.

Returns:
booleanValue of property visible
hover(bHovered, oMenu)

Changes the visual hover state of the menu item.

Subclasses may override this function.

Parameters:
booleanbHoveredSpecifies whether the item is currently hovered or not.
sap.ui.unified.MenuoMenuThe menu to which this item belongs
onAfterRendering()

Informs the item that the item HTML is now applied to the DOM.

Subclasses may override this function.

onSubmenuToggle(bOpened)

Event handler which is called whenever the submenu of the item is opened or closed.

Subclasses may override this function.

Parameters:
booleanbOpenedSpecifies whether the submenu of the item is opened or closed
render(oRenderManager, oItem, oMenu)

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.

Parameters:
sap.ui.core.RenderManageroRenderManagerThe RenderManager that can be used for writing to the render-output-buffer
sap.ui.unified.MenuItemBaseoItemThe item which should be rendered
sap.ui.unified.MenuoMenuThe menu to which this item belongs
setEnabled(bEnabled): sap.ui.unified.MenuItemBase

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.

Parameters:
booleanbEnabledNew value for property enabled
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
setStartsSection(bStartsSection): sap.ui.unified.MenuItemBase

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.

Parameters:
booleanbStartsSectionNew value for property startsSection
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
setSubmenu(oSubmenu): sap.ui.unified.MenuItemBase
Sets the aggregated submenu.
Parameters:
sap.ui.unified.MenuoSubmenuThe submenu to set
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining
setVisible(bVisible): sap.ui.unified.MenuItemBase

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.

Parameters:
booleanbVisibleNew value for property visible
Returns:
sap.ui.unified.MenuItemBaseReference to this in order to allow method chaining