This widget is the base to be used when constructing menus. Typically this widget should be configured with a combination of menu bar items and popup menus (although custom menu widgets could also be included). This widget supports keyboard navigation using the cursor keys and enter or space for selection (please note that using the tab key will jump to the next widget - tab is not used to navigate items within the menu bar).
The default menu bar behaviour is for all popup menus to appear below the menu bar, however it is possible to configure this widget so that they appear above the menu bar by configuring the popupMenusAbove attribute to be true.
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Examples
{
name: "alfresco/menus/AlfMenuBar",
config: {
widgets: [
{
name: "alfresco/menus/AlfMenuBarItem",
config: {
label: "Do something",
publishTopic: "DO_SOMETHING",
publishPayload: {
data: "INFO_ABOUT_WHAT_TO_DO"
}
}
}
]
}
}
{
name: "alfresco/menus/AlfMenuBar",
config: {
popupMenusAbove: true,
widgets: [
{
name: "alfresco/menus/AlfMenuBarPopup",
config: {
label: "More options...",
widgets: [
{
name: "alfresco/menus/AlfMenuItem",
config: {
label: "Do something",
publishTopic: "DO_SOMETHING",
publishPayload: {
data: "INFO_ABOUT_WHAT_TO_DO"
}
}
}
]
}
}
]
}
}
Extends
Mixes In
- external:dojo/_TemplatedMixin
- module:alfresco/core/Core
- module:alfresco/core/CoreWidgetProcessing
Members
-
_lockPopupsOpen :boolean
-
This boolean attribute is used as an indicator of whether or not the MenuBar popups should be locked in the open state.
Type:
- boolean
- Source:
-
_menuBar :Object
-
A reference to the MenuBar
Type:
- Object
- Source:
-
cssRequirements :Array
-
An array of the CSS files to use with this widget.
Type:
- Array
- Source:
-
i18nRequirements :Array
-
An array of the i18n files to use with this widget.
Type:
- Array
- Source:
-
i18nScope :String
-
The scope to use for i18n messages.
Type:
- String
- Source:
-
popupMenusAbove :boolean
-
In some circumstances it may be required to have the popup menus appear above the menu bar (e.g. if the menu bar is at the bottom of a page or layout control). This attribute can be configured to be true in order to support that requirement. The default value is false which will result in popup menus being displayed below the menu bar.
Type:
- boolean
- Default Value:
- false
- Source:
-
templateString :String
-
The HTML template to use for the widget.
Type:
- String
- Source:
Methods
-
_closeChild()
-
Overriden to only allow the default implementation to execute if the _lockPopupsOpen attribute is set to false.
- Source:
-
allWidgetsProcessed(widgets)
-
Implements the callback to add all of the widgets into the MenuBar.
Parameters:
Name Type Description widgets
The widgets that have been successfully instantiated. - Source:
-
lockPopupsOpen(b)
-
This function has been provided to set the _lockPopupsOpen attribute in the custom MenuBar implementation (declared above) to prevent the _closeChild function from executing. This function (and the associated custom MenuBar) has been implemented to handle calls from the alfresco/header/UserStatus widget which needs to prevent the MenuBar from closing popups when the dijit/form/Textarea used for capturing user status has focus.
Parameters:
Name Type Description b
boolean - Source:
-
postCreate()
-
Instantiates the MenuBar (a custom declared implementation) and processes the widgets assigned to ensure that the labels are localized before being sent for processing.
- Source: