YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

Yahoo! UI Library

layout  2.9.0

Yahoo! UI Library > layout > YAHOO.widget.LayoutUnit
Search:
 
Filters

Class YAHOO.widget.LayoutUnit - extends YAHOO.util.Element

Provides a fixed position unit containing a header, body and footer for use with a YAHOO.widget.Layout instance.

Constructor

YAHOO.widget.LayoutUnit ( el , attrs )
Parameters:
el <String/HTMLElement> The element to make a unit.
attrs <Object> Object liternal containing configuration parameters.

Properties

_anim - private YAHOO.util.Anim

A reference to the Animation instance used by this LayouUnit

_clip - private HTMLElement

A reference to the clip element used when collapsing the unit

_collapsed - private Boolean

Flag to determine if the unit is collapsed or not.

_collapsing - private Boolean

A flag set while the unit is being collapsed, used so we don't fire events while animating the size

_gutter - private Object

A simple hash table used to store the gutter to apply to the Unit

_instances - private static Object

Internal hash table for all layout unit instances

_lastCenetrScroll - private Boolean

A holder for the last known scroll state of the center unit

_lastHeight - private Number

A holder for the last known height of the unit

_lastLeft - private Number

A holder for the last known left of the unit

_lastScroll - private Boolean

A holder for the last known scroll state of the unit

_lastScrollTop - private Number

A holder for the last known scrollTop state of the unit

_lastTop - private Number

A holder for the last known top of the unit

_lastWidth - private Number

A holder for the last known width of the unit

_loading - private Number

During the loading process this variable will be true

_resize - private YAHOO.util.Resize

A reference to the Resize instance used by this LayoutUnit

_sizes - private Object

A collection of the current sizes of the contents of this Layout Unit

body - HTMLElement

A reference to the HTML element used for the body

browser - Object

A modified version of the YAHOO.env.ua object

dataConnection - Object

YUI Connection Manager handler

footer - HTMLElement

A reference to the HTML element used for the footer

header - HTMLELement

A reference to the HTML element used for the Header

loadHandler - Object

Callback method for the YUI Connection Manager used for load the body using AJAX. NOTE: e.responseText is loaded via innerHTML.

LOADING_CLASSNAME - String

The class name applied to dynamic tabs while loading.
Default Value: "disabled"

STR_CLOSE - {String}

String used for close button title

STR_COLLAPSE - {String}

String used for collapse button title

STR_EXPAND - {String}

String used for expand button title

Properties inherited from YAHOO.util.Element:

Properties inherited from YAHOO.util.AttributeProvider:

Methods

_cleanGrids

private void _cleanGrids ( )
This method attempts to clean up the first level of the YUI CSS Grids, YAHOO.util.Selector is required for this operation.

_createClip

private void _createClip ( )
Create the clip element used when the Unit is collapsed

_createHeader

private HTMLElement _createHeader ( )
Creates the HTMLElement for the header
Returns: HTMLElement
The new HTMLElement

_fixQuirks

private Number _fixQuirks ( el , dim , side )
Fixes the box calculations for IE in QuirksMode
Parameters:
el <HTMLElement> The HTMLElement to set the dimension on
dim <Number> The number of the dimension to fix
side <String> The dimension (h or w) to fix. Defaults to h
Returns: Number
The fixed dimension

_getBorderSizes

private Array _getBorderSizes ( el )
Get the CSS border size of the element passed.
Parameters:
el <HTMLElement> The element to get the border size of
Returns: Array
An array of the top, right, bottom, left borders.

_getBoxSize

private Array _getBoxSize ( el )
Get's the elements clientHeight and clientWidth plus the size of the borders
Parameters:
el <HTMLElement> The HTMLElement to get the size of
Returns: Array
An array of height and width

_setHeight

private Number _setHeight ( el , h )
Sets the height of the element based on the border size of the element.
Parameters:
el <HTMLElement> The HTMLElement to have it's height set
h <Number> The height that you want it the element set to
Returns: Number
The new height, fixed for borders and IE QuirksMode

_setWidth

private Number _setWidth ( el , w )
Sets the width of the element based on the border size of the element.
Parameters:
el <HTMLElement> The HTMLElement to have it's width set
w <Number> The width that you want it the element set to
Returns: Number
The new width, fixed for borders and IE QuirksMode

_toggleClip

private void _toggleClip ( )
Toggle th current state of the Clip element and set it's height, width and position

close

YAHOO.widget.Layout close ( )
Close the unit, removing it from the parent Layout.
Returns: YAHOO.widget.Layout
The parent Layout instance

collapse

YAHOO.widget.LayoutUnit collapse ( )
Collapse the Unit if it is not collapsed.
Returns: YAHOO.widget.LayoutUnit
The LayoutUnit instance

destroy

YAHOO.widget.Layout destroy ( force )
Removes this unit from the parent and cleans up after itself.
Parameters:
force <Boolean> Don't report to the parent, because we are being called from the parent.
Returns: YAHOO.widget.Layout
The parent Layout instance

expand

YAHOO.widget.LayoutUnit expand ( )
Expand the Unit if it is collapsed.
Returns: YAHOO.widget.LayoutUnit
The LayoutUnit instance

getLayoutUnitById

static Object getLayoutUnitById ( )
Get's a layout unit object by the HTML id of the element associated with the Layout Unit object.
Returns: Object
The Layout Object

getSizes

Object getSizes ( )
Get a reference to the internal sizes object for this unit
Returns: Object
An object of the sizes used for calculations

init

private void init ( )
The initalization method inherited from Element.

initAttributes

private void initAttributes ( )
Processes the config

loadContent

object loadContent ( )
Loading the content of the unit using the connection manager
Returns: object
YUI Connection Manager handler

resize

YAHOO.widget.LayoutUnit resize ( force )
Resize either the unit or it's clipped state, also updating the box inside
Parameters:
force <Boolean> This will force full calculations even when the unit is collapsed
Returns: YAHOO.widget.LayoutUnit
The LayoutUnit instance

toggle

YAHOO.widget.LayoutUnit toggle ( )
Toggles the Unit, replacing it with a clipped version.
Returns: YAHOO.widget.LayoutUnit
The LayoutUnit instance

toString

String toString ( )
Returns a string representing the LayoutUnit.

Events

animateChange

animateChange ( event )
Fires when the value for the configuration attribute 'animate' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeAnimateChange

beforeAnimateChange ( event )
Fires before the value for the configuration attribute 'animate' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeBodyChange

beforeBodyChange ( event )
Fires before the value for the configuration attribute 'body' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeCloseChange

beforeCloseChange ( event )
Fires before the value for the configuration attribute 'close' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeCollapse

beforeCollapse ( )
Fired before the unit is collapsed. If you return false, the collapse is cancelled.

beforeCollapseChange

beforeCollapseChange ( event )
Fires before the value for the configuration attribute 'collapse' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeCollapseSizeChange

beforeCollapseSizeChange ( event )
Fires before the value for the configuration attribute 'collapseSize' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDataLoadedChange

beforeDataLoadedChange ( event )
Fires before the value for the configuration attribute 'dataLoaded' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDataSrcChange

beforeDataSrcChange ( event )
Fires before the value for the configuration attribute 'dataSrc' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDataTimeoutChange

beforeDataTimeoutChange ( event )
Fires before the value for the configuration attribute 'dataTimeout' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeDurationChange

beforeDurationChange ( event )
Fires before the value for the configuration attribute 'duration' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeEasingChange

beforeEasingChange ( event )
Fires before the value for the configuration attribute 'easing' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeExpand

beforeExpand ( )
Fired before the unit is exanded. If you return false, the collapse is cancelled.

beforeFooterChange

beforeFooterChange ( event )
Fires before the value for the configuration attribute 'footer' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeGridsChange

beforeGridsChange ( event )
Fires before the value for the configuration attribute 'grids' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeGutterChange

beforeGutterChange ( event )
Fires before the value for the configuration attribute 'gutter' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeHeaderChange

beforeHeaderChange ( event )
Fires before the value for the configuration attribute 'header' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeHeightChange

beforeHeightChange ( event )
Fires before the value for the configuration attribute 'height' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeHoverChange

beforeHoverChange ( event )
Fires before the value for the configuration attribute 'hover' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeLeftChange

beforeLeftChange ( event )
Fires before the value for the configuration attribute 'left' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeLoadMethodChange

beforeLoadMethodChange ( event )
Fires before the value for the configuration attribute 'loadMethod' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMaxHeightChange

beforeMaxHeightChange ( event )
Fires before the value for the configuration attribute 'maxHeight' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMaxWidthChange

beforeMaxWidthChange ( event )
Fires before the value for the configuration attribute 'maxWidth' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMinHeightChange

beforeMinHeightChange ( event )
Fires before the value for the configuration attribute 'minHeight' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeMinWidthChange

beforeMinWidthChange ( event )
Fires before the value for the configuration attribute 'minWidth' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeParentChange

beforeParentChange ( event )
Fires before the value for the configuration attribute 'parent' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforePositionChange

beforePositionChange ( event )
Fires before the value for the configuration attribute 'position' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeProxyChange

beforeProxyChange ( event )
Fires before the value for the configuration attribute 'proxy' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeResize

beforeResize ( )
Fired at the beginning of the resize method. If you return false, the resize is cancelled.

beforeResizeChange

beforeResizeChange ( event )
Fires before the value for the configuration attribute 'resize' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeScrollChange

beforeScrollChange ( event )
Fires before the value for the configuration attribute 'scroll' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeTopChange

beforeTopChange ( event )
Fires before the value for the configuration attribute 'top' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeUseShimChange

beforeUseShimChange ( event )
Fires before the value for the configuration attribute 'useShim' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeWidthChange

beforeWidthChange ( event )
Fires before the value for the configuration attribute 'width' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeWrapChange

beforeWrapChange ( event )
Fires before the value for the configuration attribute 'wrap' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

beforeZIndexChange

beforeZIndexChange ( event )
Fires before the value for the configuration attribute 'zIndex' changes. Return false to cancel the attribute change.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

bodyChange

bodyChange ( event )
Fires when the value for the configuration attribute 'body' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

close

close ( )
Fired when the unit is closed

closeChange

closeChange ( event )
Fires when the value for the configuration attribute 'close' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

collapse

collapse ( )
Fired when the unit is collapsed

collapseChange

collapseChange ( event )
Fires when the value for the configuration attribute 'collapse' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

collapseSizeChange

collapseSizeChange ( event )
Fires when the value for the configuration attribute 'collapseSize' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

contentChange

contentChange ( )
Fired when the content in the header, body or footer is changed via the API

dataLoadedChange

dataLoadedChange ( event )
Fires when the value for the configuration attribute 'dataLoaded' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

dataSrcChange

dataSrcChange ( event )
Fires when the value for the configuration attribute 'dataSrc' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

dataTimeoutChange

dataTimeoutChange ( event )
Fires when the value for the configuration attribute 'dataTimeout' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

durationChange

durationChange ( event )
Fires when the value for the configuration attribute 'duration' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

easingChange

easingChange ( event )
Fires when the value for the configuration attribute 'easing' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

endResize

endResize ( )
Fired when the Resize Utility fires it's endResize Event.

expand

expand ( )
Fired when the unit is exanded

footerChange

footerChange ( event )
Fires when the value for the configuration attribute 'footer' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

gridsChange

gridsChange ( event )
Fires when the value for the configuration attribute 'grids' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

gutterChange

gutterChange ( event )
Fires when the value for the configuration attribute 'gutter' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

headerChange

headerChange ( event )
Fires when the value for the configuration attribute 'header' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

heightChange

heightChange ( event )
Fires when the value for the configuration attribute 'height' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

hoverChange

hoverChange ( event )
Fires when the value for the configuration attribute 'hover' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

leftChange

leftChange ( event )
Fires when the value for the configuration attribute 'left' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

load

load ( )
Fired when data is loaded via the dataSrc config.

loadError

loadError ( )
Fired when an error occurs loading data via the dataSrc config. Error message is passed as argument to this event.

loadMethodChange

loadMethodChange ( event )
Fires when the value for the configuration attribute 'loadMethod' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

maxHeightChange

maxHeightChange ( event )
Fires when the value for the configuration attribute 'maxHeight' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

maxWidthChange

maxWidthChange ( event )
Fires when the value for the configuration attribute 'maxWidth' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

minHeightChange

minHeightChange ( event )
Fires when the value for the configuration attribute 'minHeight' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

minWidthChange

minWidthChange ( event )
Fires when the value for the configuration attribute 'minWidth' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

parentChange

parentChange ( event )
Fires when the value for the configuration attribute 'parent' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

positionChange

positionChange ( event )
Fires when the value for the configuration attribute 'position' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

proxyChange

proxyChange ( event )
Fires when the value for the configuration attribute 'proxy' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

resize

resize ( )
Fired when this.resize is called

resizeChange

resizeChange ( event )
Fires when the value for the configuration attribute 'resize' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

scrollChange

scrollChange ( event )
Fires when the value for the configuration attribute 'scroll' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

startResize

startResize ( )
Fired when the Resize Utility fires it's startResize Event.

topChange

topChange ( event )
Fires when the value for the configuration attribute 'top' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

useShimChange

useShimChange ( event )
Fires when the value for the configuration attribute 'useShim' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

widthChange

widthChange ( event )
Fires when the value for the configuration attribute 'width' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

wrapChange

wrapChange ( event )
Fires when the value for the configuration attribute 'wrap' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

zIndexChange

zIndexChange ( event )
Fires when the value for the configuration attribute 'zIndex' changes.
Parameters:
event <{oldValue: any, newValue: any}> An object containing the previous attribute value and the new value.

Configuration Attributes

animate - Boolean

Use animation to collapse/expand the unit

body - {HTML}

The content for the body. If we find an element in the page with an id that matches the passed option we will move that element into the body of this unit. (sets via innerHTML)

close - object

Adds a close icon to the unit

collapse - object

Adds a collapse icon to the unit

collapseSize - Number

The pixel size of the Clip that we will collapse to

dataLoaded - Boolean

Whether or not any data has been loaded from the server.

dataSrc - String

The unit data source, used for loading content dynamically.

dataTimeout - Number

Number if milliseconds before aborting and calling failure handler.
Default Value: null

duration - object

The duration to give the Animation Utility when animating the opening and closing of Units

easing - object

The Animation Easing to apply to the Animation instance for this unit.

footer - {HTML}

The content for the footer. If we find an element in the page with an id that matches the passed option we will move that element into the footer of this unit. (sets via innerHTML)

grids - Boolean

Set this option to true if you want the LayoutUnit to fix the first layer of YUI CSS Grids (margins)

gutter - String

The gutter that we should apply to the parent Layout around this Unit. Supports standard CSS markup: (2 4 0 5) or (2) or (2 5)

header - {HTML}

The html to use as the Header of the Unit (sets via innerHTML)

height - Number

The height of the Unit

hover - object

Config option to pass to the Resize Utility

left - private Number

The current left position of the Unit

loadMethod - String

The method to use for the data request.
Default Value: "GET"

maxHeight - Number

The maxHeight parameter passed to the Resize Utility

maxWidth - Number

The maxWidth parameter passed to the Resize Utility

minHeight - Number

The minHeight parameter passed to the Resize Utility

minWidth - Number

The minWidth parameter passed to the Resize Utility

parent - {Object} YAHOO.widget.Layout

The parent Layout that we are assigned to

position - {String}

The position (top, right, bottom, left or center) of the Unit in the Layout

proxy - Boolean

Use the proxy config setting for the Resize Utility

resize - object

Should a Resize instance be added to this unit

scroll - Boolean/Null

Adds a class to the unit to allow for overflow: auto (yui-layout-scroll), default is overflow: hidden (yui-layout-noscroll). If true scroll bars will be placed on the element when the content exceeds the given area, false will put overflow hidden to hide the content. Passing null will render the content as usual overflow.

top - private Number

The current top positioning of the Unit

useShim - object

Config option to pass to the Resize Utility

width - Number

The width of the Unit

wrap - private HTMLElement

A reference to the wrap element

zIndex - {Number}

The CSS zIndex to give to the unit, so you can have overlapping elements such as menus in a unit.

Configuration attributes inherited from YAHOO.util.Element:


Copyright © 2011 Yahoo! Inc. All rights reserved.