Print Friendly

# Class YAHOO.ext.LayoutRegion

Package: | YAHOO.ext
Class: | LayoutRegion
Extends: | Observable
Subclasses: | SplitLayoutRegion
Defined In: | LayoutRegion.js

This class represents a region in a layout manager.

## Public Properties

Property | Defined By
--- | ---
| bodyEl : YAHOO.ext.Element | LayoutRegion
This regions body element
| collapsedEl : YAHOO.ext.Element | LayoutRegion
This regions collapsed element
| el : YAHOO.ext.Element | LayoutRegion
This regions container element
| panels : YAHOO.ext.util.MixedCollection | LayoutRegion
A collection of panels in this region.
| titleEl : YAHOO.ext.Element | LayoutRegion
This regions title element
| titleTextEl : HTMLElement | LayoutRegion
This regions title text element

## Public Methods

Method | Defined By
--- | ---
| add(`ContentPanel... panel`) : YAHOO.ext.ContentPanel | LayoutRegion
Add the passed ContentPanel(s)
| addListener(`String eventName`, `Function handler`, [`Object scope`], [`boolean override`]) : void | Observable
Appends an event handler to this component
| bufferedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number millis`]) : Function | Observable
Appends an event handler to this component that is buffered. If the event is triggered more than once in the specifie...
| collapse([`Boolean skipAnim`]) : void | LayoutRegion
Collapses this region.
| delayedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number delay`]) : Function | Observable
Appends an event handler to this component that is delayed the specified number of milliseconds. This is useful for e...
| expand(`YAHOO.ext.EventObject e`, [`Boolean skipAnim`]) : void | LayoutRegion
Expand this region if it was previously collapsed.
| fireEvent(`String eventName`, `Object... args`) : Boolean | Observable
Fires the specified event with the passed parameters (minus the event name).
| getActivePanel() : YAHOO.ext.ContentPanel | LayoutRegion
Get the active panel for this region.
| getEl() : YAHOO.ext.Element | LayoutRegion
Returns the container element for this region.
| getPanel(`Number/String/ContentPanel panel`) : YAHOO.ext.ContentPanel | LayoutRegion
Returns the panel specified or null if it's not in this region.
| getPosition() : String | LayoutRegion
Returns this regions position (north/south/east/west/center).
| getTabs() : YAHOO.ext.TabPanel | LayoutRegion
Returns the TabPanel component used by this region
| hasPanel(`Number/String/ContentPanel panel`) : Boolean | LayoutRegion
Returns true if the panel is in this region.
| hide() : void | LayoutRegion
Hides this region.
| hidePanel(`Number/String/ContentPanel panel`) : void | LayoutRegion
Hides the tab for the specified panel.
| isVisible() : Boolean | LayoutRegion
Returns true if this region is currently visible.
| on(`String eventName`, `Function handler`, [`Object scope`], [`boolean override`]) : void | Observable
Appends an event handler to this element (shorthand for addListener)
| purgeListeners() : void | Observable
Removes all listeners for this object
| remove(`Number/String/ContentPanel panel`, `Boolean preservePanel`) : YAHOO.ext.ContentPanel | LayoutRegion
Removes the specified panel. If preservePanel is not true (either here or in the config), the panel is destroyed.
| removeListener(`String eventName`, `Function handler`, [`Object scope`]) : void | Observable
Removes a listener
| resizeTo(`Number newSize`) : void | LayoutRegion
Resizes the region to the specified size. For vertical regions (west, east) this adjusts the width, for horizontal (...
| show() : void | LayoutRegion
Shows this region if it was previously hidden.
| showPanel(`Number/String/ContentPanel panelId`) : YAHOO.ext.ContentPanel | LayoutRegion
Show the specified panel.
| unhidePanel(`Number/String/ContentPanel panel`) : void | LayoutRegion
Unhides the tab for a previously hidden panel.

## Public Events

Event | Defined By
--- | ---
| beforeremove : (`YAHOO.ext.LayoutRegion this`, `YAHOO.ext.ContentPanel panel`, `Object e`) | LayoutRegion
Fires before a panel is removed (or closed). To cancel the removal set "e.cancel = true" on the event argument.
| collapsed : (`YAHOO.ext.LayoutRegion this`) | LayoutRegion
Fires when this region is collapsed.
| expanded : (`YAHOO.ext.LayoutRegion this`) | LayoutRegion
Fires when this region is expanded.
| invalidated : (`YAHOO.ext.LayoutRegion this`) | LayoutRegion
Fires when the layout for this region is changed.
| panelactivated : (`YAHOO.ext.LayoutRegion this`, `YAHOO.ext.ContentPanel panel`) | LayoutRegion
Fires when a panel is activated.
| paneladded : (`YAHOO.ext.LayoutRegion this`, `YAHOO.ext.ContentPanel panel`) | LayoutRegion
Fires when a panel is added.
| panelremoved : (`YAHOO.ext.LayoutRegion this`, `YAHOO.ext.ContentPanel panel`) | LayoutRegion
Fires when a panel is removed.
| resized : (`YAHOO.ext.LayoutRegion this`, `Number newSize`) | LayoutRegion
Fires when the user resizes this region.
| visibilitychange : (`YAHOO.ext.LayoutRegion this`, `Boolean visibility`) | LayoutRegion
Fires when this region is shown or hidden

## Property Details

### bodyEl

`public YAHOO.ext.Element bodyEl`
This regions body element
This property is defined by LayoutRegion.

### collapsedEl

`public YAHOO.ext.Element collapsedEl`
This regions collapsed element
This property is defined by LayoutRegion.

### el

`public YAHOO.ext.Element el`
This regions container element
This property is defined by LayoutRegion.

### panels

`public YAHOO.ext.util.MixedCollection panels`
A collection of panels in this region.
This property is defined by LayoutRegion.

### titleEl

`public YAHOO.ext.Element titleEl`
This regions title element
This property is defined by LayoutRegion.

### titleTextEl

`public HTMLElement titleTextEl`
This regions title text element
This property is defined by LayoutRegion.

## Method Details

### add

`public function add(`ContentPanel... panel`)`
Add the passed ContentPanel(s)
Parameters:

- `panel` : ContentPanel...
  The ContentPanel(s) to add (you can pass more than one)

Returns:

- `YAHOO.ext.ContentPanel`
  The panel added (if only one was added)

This method is defined by LayoutRegion.

### addListener

`public function addListener(`String eventName`, `Function handler`, [`Object scope`], [`boolean override`])`
Appends an event handler to this component
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `override` : boolean
  (optional) If true, scope becomes the scope

Returns:

- `void`

This method is defined by Observable.

### bufferedListener

`public function bufferedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number millis`])`
Appends an event handler to this component that is buffered. If the event is triggered more than once in the specified time-frame, only the last one actually fires.
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `millis` : Number
  (optional) The number of milliseconds to buffer (defaults to 250)

Returns:

- `Function`
  The wrapped function that was created (can be used to remove the listener)

This method is defined by Observable.

### collapse

`public function collapse([`Boolean skipAnim`])`
Collapses this region.
Parameters:

- `skipAnim` : Boolean
  (optional) true to collapse the element without animation (if animate is true)

Returns:

- `void`

This method is defined by LayoutRegion.

### delayedListener

`public function delayedListener(`String eventName`, `Function handler`, [`Object scope`], [`Number delay`])`
Appends an event handler to this component that is delayed the specified number of milliseconds. This is useful for events that modify the DOM and need to wait for the browser to catch up.
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `delay` : Number
  (optional) The number of milliseconds to delay (defaults to 1 millisecond)

Returns:

- `Function`
  The wrapped function that was created (can be used to remove the listener)

This method is defined by Observable.

### expand

`public function expand(`YAHOO.ext.EventObject e`, [`Boolean skipAnim`])`
Expand this region if it was previously collapsed.
Parameters:

- `e` : YAHOO.ext.EventObject
  The event that triggered the expand (or null if calling manually)
- `skipAnim` : Boolean
  (optional) true to expand the element without animation (if animate is true)

Returns:

- `void`

This method is defined by LayoutRegion.

### fireEvent

`public function fireEvent(`String eventName`, `Object... args`)`
Fires the specified event with the passed parameters (minus the event name).
Parameters:

- `eventName` : String
- `args` : Object...
  Variable number of parameters are passed to handlers

Returns:

- `Boolean`
  returns false if any of the handlers return false otherwise it returns true

This method is defined by Observable.

### getActivePanel

`public function getActivePanel()`
Get the active panel for this region.
Parameters:

- None.

Returns:

- `YAHOO.ext.ContentPanel`
  The active panel or null

This method is defined by LayoutRegion.

### getEl

`public function getEl()`
Returns the container element for this region.
Parameters:

- None.

Returns:

- `YAHOO.ext.Element`

This method is defined by LayoutRegion.

### getPanel

`public function getPanel(`Number/String/ContentPanel panel`)`
Returns the panel specified or null if it's not in this region.
Parameters:

- `panel` : Number/String/ContentPanel
  The panels index, id or the panel itself

Returns:

- `YAHOO.ext.ContentPanel`

This method is defined by LayoutRegion.

### getPosition

`public function getPosition()`
Returns this regions position (north/south/east/west/center).
Parameters:

- None.

Returns:

- `String`

This method is defined by LayoutRegion.

### getTabs

`public function getTabs()`
Returns the TabPanel component used by this region
Parameters:

- None.

Returns:

- `YAHOO.ext.TabPanel`

This method is defined by LayoutRegion.

### hasPanel

`public function hasPanel(`Number/String/ContentPanel panel`)`
Returns true if the panel is in this region.
Parameters:

- `panel` : Number/String/ContentPanel
  The panels index, id or the panel itself

Returns:

- `Boolean`

This method is defined by LayoutRegion.

### hide

`public function hide()`
Hides this region.
Parameters:

- None.

Returns:

- `void`

This method is defined by LayoutRegion.

### hidePanel

`public function hidePanel(`Number/String/ContentPanel panel`)`
Hides the tab for the specified panel.
Parameters:

- `panel` : Number/String/ContentPanel
  The panels index, id or the panel itself

Returns:

- `void`

This method is defined by LayoutRegion.

### isVisible

`public function isVisible()`
Returns true if this region is currently visible.
Parameters:

- None.

Returns:

- `Boolean`

This method is defined by LayoutRegion.

### on

`public function on(`String eventName`, `Function handler`, [`Object scope`], [`boolean override`])`
Appends an event handler to this element (shorthand for addListener)
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The method the event invokes
- `scope` : Object
  (optional) The scope (this object) for the handler
- `override` : boolean
  (optional) If true, scope becomes the scope

Returns:

- `void`

This method is defined by Observable.

### purgeListeners

`public function purgeListeners()`
Removes all listeners for this object
Parameters:

- None.

Returns:

- `void`

This method is defined by Observable.

### remove

`public function remove(`Number/String/ContentPanel panel`, `Boolean preservePanel`)`
Removes the specified panel. If preservePanel is not true (either here or in the config), the panel is destroyed.
Parameters:

- `panel` : Number/String/ContentPanel
  The panels index, id or the panel itself
- `preservePanel` : Boolean
  Overrides the config preservePanel option

Returns:

- `YAHOO.ext.ContentPanel`
  The panel that was removed

This method is defined by LayoutRegion.

### removeListener

`public function removeListener(`String eventName`, `Function handler`, [`Object scope`])`
Removes a listener
Parameters:

- `eventName` : String
  The type of event to listen for
- `handler` : Function
  The handler to remove
- `scope` : Object
  (optional) The scope (this object) for the handler

Returns:

- `void`

This method is defined by Observable.

### resizeTo

`public function resizeTo(`Number newSize`)`
Resizes the region to the specified size. For vertical regions (west, east) this adjusts the width, for horizontal (north, south) the height.
Parameters:

- `newSize` : Number
  The new width or height

Returns:

- `void`

This method is defined by LayoutRegion.

### show

`public function show()`
Shows this region if it was previously hidden.
Parameters:

- None.

Returns:

- `void`

This method is defined by LayoutRegion.

### showPanel

`public function showPanel(`Number/String/ContentPanel panelId`)`
Show the specified panel.
Parameters:

- `panelId` : Number/String/ContentPanel
  The panels index, id or the panel itself

Returns:

- `YAHOO.ext.ContentPanel`
  The shown panel or null

This method is defined by LayoutRegion.

### unhidePanel

`public function unhidePanel(`Number/String/ContentPanel panel`)`
Unhides the tab for a previously hidden panel.
Parameters:

- `panel` : Number/String/ContentPanel
  The panels index, id or the panel itself

Returns:

- `void`

This method is defined by LayoutRegion.

## Event Details

### beforeremove

`public event beforeremove`
Fires before a panel is removed (or closed). To cancel the removal set "e.cancel = true" on the event argument.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `panel` : YAHOO.ext.ContentPanel
  The panel
- `e` : Object
  The cancel event object

This event is defined by LayoutRegion.

### collapsed

`public event collapsed`
Fires when this region is collapsed.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion

This event is defined by LayoutRegion.

### expanded

`public event expanded`
Fires when this region is expanded.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion

This event is defined by LayoutRegion.

### invalidated

`public event invalidated`
Fires when the layout for this region is changed.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion

This event is defined by LayoutRegion.

### panelactivated

`public event panelactivated`
Fires when a panel is activated.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `panel` : YAHOO.ext.ContentPanel
  The activated panel

This event is defined by LayoutRegion.

### paneladded

`public event paneladded`
Fires when a panel is added.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `panel` : YAHOO.ext.ContentPanel
  The panel

This event is defined by LayoutRegion.

### panelremoved

`public event panelremoved`
Fires when a panel is removed.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `panel` : YAHOO.ext.ContentPanel
  The panel

This event is defined by LayoutRegion.

### resized

`public event resized`
Fires when the user resizes this region.
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `newSize` : Number
  The new size (width for east/west, height for north/south)

This event is defined by LayoutRegion.

### visibilitychange

`public event visibilitychange`
Fires when this region is shown or hidden
Subscribers will be called with the following parameters:

- `this` : YAHOO.ext.LayoutRegion
- `visibility` : Boolean
  true or false

This event is defined by LayoutRegion.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.