Class Index | File Index

## Classes

- _global_
- Array
- Function
- pockets
- pockets.managers
- pockets.managers.EventManager
- pockets.managers.EventRegistration
- pockets.managers.EventTargetRegistration
- pockets.managers.MenuManager

# Class pockets.managers.MenuManager

Helper class to make it easier to work with Mojo's menus. Application, View, Command, and popup menus are supported. The primary value the MenuManager provides is mapping each menu item to a separate handler function - the default behavior is to send all menu actions to an assistant's #handleCommand method (the MenuManager will pass through to SceneAssistant#handleCommand, if present). Once you've separated your menu actions into separate handlers, you can test them in isolation, have the handlers be in other classes, all the while having code that is easier to maintain. The MenuManager is constructed with a SceneAssistant, usually in the SceneAssistant's constructor. It holds the models for the widgets for the menus - the SceneAssistant needs to setup the models & attributes and then call MenuManager#refreshAllMenus.
Defined in: pockets-managers.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| pockets.managers.MenuManager(assistant)

Field Summary
Field Attributes | Field Name and Description
--- | ---
| attributes Holds the widget attributes for the built-in widgets for the App, View and Command menus.
| models Holds the widget models for the built-in widgets for the App, View and Command menus.

Method Summary
Method Attributes | Method Name and Description
--- | ---
| appMenu(items) Directly sets the items for the App menu & calls setupWiget.
| commandMenu(items) Directly sets the items for the Command menu & calls setupWiget.
| handleCommand(event)
| lookupHandler(handlerPropertyName, command, items)
| onChoose(command)
| popupSubmenu(placeNear, items, attributes, modelExtras) Displays a popup menu with the given items.
| refreshAllMenus() Calls SceneController#modelChanged in order to update the Scene's App, View, and Command menu.
| setupAllMenus()
| viewMenu(items) Directly sets the items for the View menu & calls setupWiget.

Class Detail
pockets.managers.MenuManager(assistant)

    // construct the MenuManager in your SceneAssistant constructor
    // setup your menu models in your SceneAssistant activate method (manipulate the models directly)
    // popup examples

Parameters:
assistant
  {Function} A Mojo Scene Assistant, ready for adding menus.

Field Detail
attributes
Holds the widget attributes for the built-in widgets for the App, View and Command menus. The SceneAssistant can manipulate these directly.

models
Holds the widget models for the built-in widgets for the App, View and Command menus. The SceneAssistant can manipulate these models directly.
Method Detail
appMenu(items)
Directly sets the items for the App menu & calls setupWiget.

Parameters:
items

commandMenu(items)
Directly sets the items for the Command menu & calls setupWiget.

Parameters:
items

handleCommand(event)

Parameters:
event

lookupHandler(handlerPropertyName, command, items)

Parameters:
handlerPropertyName
command
items

onChoose(command)

Parameters:
command

popupSubmenu(placeNear, items, attributes, modelExtras)
Displays a popup menu with the given items. Acts like the other menus of the MenuManager, but since it is not a widget (like the other menus),

Parameters:
{Element} placeNear
{Array} items
{Object} attributes
{Object} modelExtras

refreshAllMenus()
Calls SceneController#modelChanged in order to update the Scene's App, View, and Command menu. This will call setupWidget on each menu that hasn't yet been setup.

setupAllMenus()

viewMenu(items)
Directly sets the items for the View menu & calls setupWiget.

Parameters:
items

Documentation generated by JsDoc Toolkit 2.3.0 on Sat Jun 27 2009 08:38:33 GMT-0700 (PDT)