API: container YAHOO.widget.OverlayManager (YUI Library)

# Yahoo! UI Library

### Container 2.2.2

Yahoo! UI Library > container > YAHOO.widget.OverlayManager

## Class YAHOO.widget.OverlayManager

OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget

### Constructor

YAHOO.widget.OverlayManager `( overlays , userConfig )`

Parameters:
  `overlays <Array>` Optional. A collection of Overlays to register with the manager.
  `userConfig <Object>` The object literal representing the user configuration of the OverlayManager

### Properties

#### activeOverlay `- private YAHOO.widget.Overlay`

The currently activated Overlay

#### cfg `- YAHOO.util.Config`

The OverlayManager's Config object used for monitoring configuration properties.

#### contructor `- Function`

The class's constructor function

#### overlays `- YAHOO.widget.Overlay[]`

The array of Overlays that are currently registered

#### YAHOO.widget.OverlayManager.CSS_FOCUSED `- static final String`

The CSS class representing a focused Overlay

### Methods

#### _onOverlayDestroy

`private void _onOverlayDestroy ( p_sType , p_aArgs , p_oOverlay )`
"destroy" event handler for the Overlay.

Parameters:
  `p_sType <String>` String representing the name of the event that was fired.
  `p_aArgs <Array>` Array of arguments sent when the event was fired.
  `p_oOverlay <YAHOO.widget.Overlay>` Object representing the menu that fired the event.

Returns: `void`

#### _onOverlayElementFocus

`private void _onOverlayElementFocus ( p_oEvent )`
Event handler for the DOM event that is used to focus the Overlay instance as specified by the "focusevent" configuration property.

Parameters:
  `p_oEvent <Event>` Object representing the DOM event object passed back by the event utility (YAHOO.util.Event).

Returns: `void`

#### blurAll

`void blurAll ( )`
Removes focus from all registered Overlays in the manager

Returns: `void`

#### compareZIndexDesc

`private Number compareZIndexDesc ( )`
Used for sorting the manager's Overlays by z-index.

Returns: `Number`
  0, 1, or -1, depending on where the Overlay should fall in the stacking order.

#### find

`YAHOO.widget.Overlay find ( overlay )`
Attempts to locate an Overlay by instance or ID.

Parameters:
  `overlay <YAHOO.widget.Overlay>` An Overlay to locate within the manager
  `overlay <String>` An Overlay id to locate within the manager

Returns: `YAHOO.widget.Overlay`
  The requested Overlay, if found, or null if it cannot be located.

#### focus

`void focus ( overlay )`
Focuses the specified Overlay

Parameters:
  `overlay <YAHOO.widget.Overlay>` The Overlay to focus
  `overlay <String>` The id of the Overlay to focus

Returns: `void`

#### getActive

`YAHOO.widget.Overlay getActive ( )`
Returns the currently focused Overlay

Returns: `YAHOO.widget.Overlay`
  The currently focused Overlay

#### hideAll

`void hideAll ( )`
Hides all Overlays in the manager.

Returns: `void`

#### init

`void init ( overlays , userConfig )`
Initializes the OverlayManager

Parameters:
  `overlays <YAHOO.widget.Overlay[]>` Optional. A collection of Overlays to register with the manager.
  `userConfig <Object>` The object literal representing the user configuration of the OverlayManager

Returns: `void`

#### initDefaultConfig

`void initDefaultConfig ( )`
Initializes the default configuration of the OverlayManager

Returns: `void`

#### register

`Boolean register ( overlay )`
Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.

Parameters:
  `overlay <YAHOO.widget.Overlay>` An Overlay to register with the manager.
  `overlay <YAHOO.widget.Overlay[]>` An array of Overlays to register with the manager.

Returns: `Boolean`
  True if any Overlays are registered.

#### remove

`void remove ( overlay )`
Removes the specified Overlay from the manager

Parameters:
  `overlay <YAHOO.widget.Overlay>` The Overlay to remove
  `overlay <String>` The id of the Overlay to remove

Returns: `void`

#### showAll

`void showAll ( )`
Shows all Overlays in the manager.

Returns: `void`

#### toString

`String toString ( )`
Returns a string representation of the object.

Returns: `String`
  The string representation of the OverlayManager

### Configuration Attributes

#### focusevent `- String`

The default DOM event that should be used to focus an Overlay
Default Value: "mousedown"

#### overlays `- YAHOO.widget.Overlay[]`

The collection of registered Overlays in use by the OverlayManager
Default Value: null

Copyright © 2007 Yahoo! Inc. All rights reserved.