# Yahoo! UI Library

### widget-stack 3.3.0

Yahoo! UI Library > widget-stack > WidgetStack
Search:
Filters Show Private Show Protected Show Deprecated

## Class WidgetStack

Widget extension, which can be used to add stackable (z-index) support to the base Widget class along with a shimming solution, through the Base.build method.

### Properties

#### WidgetStack.ATTRS - `static Object`

Static property used to define the default attribute configuration introduced by WidgetStack.

#### WidgetStack.HTML_PARSER - `static Object`

The HTML parsing rules for the WidgetStack class.

#### WidgetStack.SHIM_CLASS_NAME - `static String`

Default class used to mark the shim element
Default Value: "yui-widget-shim"

#### WidgetStack.SHIM_TEMPLATE - `static String`

Default markup template used to generate the shim element.

#### WidgetStack.STACKED_CLASS_NAME - `static String`

Default class used to mark the boundingBox of a stacked widget.
Default Value: "yui-widget-stacked"

### Methods

#### _addShimResizeHandlers

`private void _addShimResizeHandlers ( )`
Sets up event listeners to resize the shim when the size of the Widget changes.

NOTE: This method is only used for IE6 currently, since IE6 doesn't support a way to resize the shim purely through CSS, when the Widget does not have an explicit width/height set.

#### _afterShimChange

`protected void _afterShimChange ( e )`
Default attribute change listener for the shim attribute, responsible for updating the UI, in response to attribute changes.

Parameters:
  `e <EventFacade>` The event facade for the attribute change

#### _afterZIndexChange

`protected void _afterZIndexChange ( e )`
Default attribute change listener for the zIndex attribute, responsible for updating the UI, in response to attribute changes.

Parameters:
  `e <EventFacade>` The event facade for the attribute change

#### _bindUIStack

`protected void _bindUIStack ( )`
Binds event listeners responsible for updating the UI state in response to Widget stack related state changes.

This method is invoked after bindUI is invoked for the Widget class using YUI's aop infrastructure.

#### _destroyShim

`private void _destroyShim ( )`
Removes the shim from the DOM, and detaches any related event listeners.

#### _detachStackHandles

`private void _detachStackHandles ( String )`
Detaches any handles stored for the provided key

Parameters:
  `String <object>` handleKey The key defining the group of handles which should be detached

#### _getShimTemplate

`private Node _getShimTemplate ( )`
Creates a cloned shim node, using the SHIM_TEMPLATE html template, for use on a new instance.

Returns: `Node`
  node A new shim Node instance.

#### _renderShim

`private void _renderShim ( )`
Creates the shim element and adds it to the DOM

#### _renderShimDeferred

`private void _renderShimDeferred ( )`
Sets up change handlers for the visible attribute, to defer shim creation/rendering until the Widget is made visible.

#### _renderUIStack

`protected void _renderUIStack ( )`
Creates/Initializes the DOM to support stackability.

This method in invoked after renderUI is invoked for the Widget class using YUI's aop infrastructure.

#### _setZIndex

`protected Number _setZIndex ( zIndex )`
Default setter for zIndex attribute changes. Normalizes zIndex values to numbers, converting non-numerical values to 0.

Parameters:
  `zIndex <String | Number>`

Returns: `Number`
  Normalized zIndex

#### _syncUIStack

`protected void _syncUIStack ( )`
Synchronizes the UI to match the Widgets stack state. This method in invoked after syncUI is invoked for the Widget class using YUI's aop infrastructure.

#### _uiSetShim

`protected void _uiSetShim ( enable )`
Updates the UI to enable/disable the shim. If the widget is not currently visible, creation of the shim is deferred until it is made visible, for performance reasons.

Parameters:
  `enable <boolean>` If true, creates/renders the shim, if false, removes it.

#### _uiSetZIndex

`protected void _uiSetZIndex ( zIndex )`
Updates the UI to reflect the zIndex value passed in.

Parameters:
  `zIndex <number>` The zindex to be reflected in the UI

#### sizeShim

`void sizeShim ( )`
For IE6, synchronizes the size and position of iframe shim to that of Widget bounding box which it is protecting. For all other browsers, this method does not do anything.

### Events

#### shimChange

`shimChange ( event )`
Fires when the value for the configuration attribute 'shim' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

#### zIndexChange

`zIndexChange ( event )`
Fires when the value for the configuration attribute 'zIndex' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:
  `event <Event.Facade>` An Event Facade object with the following attribute specific properties added:
  prevVal
    The value of the attribute, prior to it being set
  newVal
    The value the attribute is to be set to
  attrName
    The name of the attribute being set
  subAttrName
    If setting a property within the attribute's value, the name of the sub-attribute property being set

### Configuration Attributes

#### shim `- boolean`

Boolean flag to indicate whether or not a shim should be added to the Widgets boundingBox, to protect it from select box bleedthrough.
Default Value: false, for all browsers other than IE6, for which a shim is enabled by default.

#### zIndex `- number`

The z-index to apply to the Widgets boundingBox. Non-numerical values for zIndex will be converted to 0
Default Value: 0

Copyright © 2011 Yahoo! Inc. All rights reserved.